mirror of https://github.com/oxen-io/session-ios
Fixup DevicesManager
* 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. // FREEBIEpull/1/head
parent
c39e8b0bc6
commit
c8a5f50763
@ -0,0 +1,45 @@
|
||||
// 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
|
Loading…
Reference in New Issue