mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Clean up ahead of PR.
This commit is contained in:
parent
08ca4fdb50
commit
87ea1dcae1
|
@ -237,7 +237,7 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView
|
|||
let contact = Contact(systemContact: cnContact)
|
||||
|
||||
cell.configure(contact: contact, subtitleType: subtitleCellType, showsWhenSelected: self.allowsMultipleSelection, contactsManager: self.contactsManager)
|
||||
let isSelected = selectedContacts.contains(where: { $0.cnContactId == contact.cnContactId })
|
||||
let isSelected = selectedContacts.contains(where: { $0.uniqueId == contact.uniqueId })
|
||||
cell.isSelected = isSelected
|
||||
|
||||
// Make sure we preserve selection across tableView.reloadData which happens when toggling between
|
||||
|
@ -256,7 +256,7 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView
|
|||
let deselectedContact = cell.contact!
|
||||
|
||||
selectedContacts = selectedContacts.filter {
|
||||
return $0.cnContactId != deselectedContact.cnContactId
|
||||
return $0.uniqueId != deselectedContact.uniqueId
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -318,13 +318,13 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
|
|||
[self.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
|
||||
for (Contact *contact in contacts) {
|
||||
NSArray<SignalRecipient *> *signalRecipients = [contact signalRecipientsWithTransaction:transaction];
|
||||
contactIdToSignalRecipientsMap[contact.cnContactId] = signalRecipients;
|
||||
contactIdToSignalRecipientsMap[contact.uniqueId] = signalRecipients;
|
||||
}
|
||||
}];
|
||||
|
||||
NSMutableSet<NSString *> *seenRecipientIds = [NSMutableSet new];
|
||||
for (Contact *contact in contacts) {
|
||||
NSArray<SignalRecipient *> *signalRecipients = contactIdToSignalRecipientsMap[contact.cnContactId];
|
||||
NSArray<SignalRecipient *> *signalRecipients = contactIdToSignalRecipientsMap[contact.uniqueId];
|
||||
for (SignalRecipient *signalRecipient in [signalRecipients sortedArrayUsingSelector:@selector(compare:)]) {
|
||||
if ([seenRecipientIds containsObject:signalRecipient.recipientId]) {
|
||||
DDLogDebug(@"Ignoring duplicate contact: %@, %@", signalRecipient.recipientId, contact.fullName);
|
||||
|
|
|
@ -26,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@property (readonly, nonatomic) NSArray<PhoneNumber *> *parsedPhoneNumbers;
|
||||
@property (readonly, nonatomic) NSArray<NSString *> *userTextPhoneNumbers;
|
||||
@property (readonly, nonatomic) NSArray<NSString *> *emails;
|
||||
@property (readonly, nonatomic) NSString *uniqueId;
|
||||
@property (nonatomic, readonly) BOOL isSignalContact;
|
||||
@property (nonatomic, readonly) NSString *cnContactId;
|
||||
|
||||
|
|
|
@ -117,6 +117,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return self;
|
||||
}
|
||||
|
||||
- (nullable NSString *)uniqueId
|
||||
{
|
||||
return self.cnContactId;
|
||||
}
|
||||
|
||||
+ (nullable Contact *)contactWithVCardData:(NSData *)data
|
||||
{
|
||||
CNContact *_Nullable cnContact = [self cnContactWithVCardData:data];
|
||||
|
|
Loading…
Reference in a new issue