* By providing a view extension for secondary devices we can use that in a view mapping to power our devices view controller, and avoid any race conditions with uncommitted transactions. * Fix crash when you're not in your own contacts * New device appears on top * Don't show "edit" button unless there are devices, or rather, the helpers to do so. * Fix glitchy refresh Saving unchanged records was causing the tableview to redraw, which was mostly invisible, except that if the refresh indicator were running, it would twitch. // FREEBIE
46 lines
1.3 KiB
Objective-C
46 lines
1.3 KiB
Objective-C
// Copyright (c) 2016 Open Whisper Systems. All rights reserved.
|
|
|
|
#import "SignalRecipient.h"
|
|
#import "TSStorageManager+keyingMaterial.h"
|
|
#import "TSStorageManager.h"
|
|
#import <XCTest/XCTest.h>
|
|
|
|
@interface SignalRecipientTest : XCTestCase
|
|
|
|
@end
|
|
|
|
@implementation SignalRecipientTest
|
|
|
|
- (void)setUp {
|
|
[super setUp];
|
|
[TSStorageManager storePhoneNumber:@"+13231231234"];
|
|
}
|
|
|
|
- (void)testSelfRecipientWithExistingRecord
|
|
{
|
|
// Sanity Check
|
|
NSString *localNumber = @"+13231231234";
|
|
XCTAssertNotNil(localNumber);
|
|
[[[SignalRecipient alloc] initWithTextSecureIdentifier:localNumber relay:nil supportsVoice:YES] save];
|
|
XCTAssertNotNil([SignalRecipient recipientWithTextSecureIdentifier:localNumber]);
|
|
|
|
SignalRecipient *me = [SignalRecipient selfRecipient];
|
|
XCTAssert(me);
|
|
XCTAssertEqualObjects(localNumber, me.uniqueId);
|
|
}
|
|
|
|
- (void)testSelfRecipientWithoutExistingRecord
|
|
{
|
|
NSString *localNumber = @"+13231231234";
|
|
XCTAssertNotNil(localNumber);
|
|
[[SignalRecipient fetchObjectWithUniqueID:localNumber] remove];
|
|
// Sanity Check that there's no existing user.
|
|
XCTAssertNil([SignalRecipient recipientWithTextSecureIdentifier:localNumber]);
|
|
|
|
SignalRecipient *me = [SignalRecipient selfRecipient];
|
|
XCTAssert(me);
|
|
XCTAssertEqualObjects(localNumber, me.uniqueId);
|
|
}
|
|
|
|
@end
|