Reinstate notification when SignalAccounts change

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 6f7cae691c
commit c07d7777cb

@ -46,6 +46,10 @@ NS_ASSUME_NONNULL_BEGIN
actionBlock:^{ actionBlock:^{
[DebugUIContacts deleteAllContacts]; [DebugUIContacts deleteAllContacts];
}], }],
[OWSTableItem itemWithTitle:@"Clear SignalAccount Cache"
actionBlock:^{
[DebugUIContacts clearSignalAccountCache];
}],
]]; ]];
} }
@ -1280,6 +1284,12 @@ NS_ASSUME_NONNULL_BEGIN
}]; }];
} }
+ (void)clearSignalAccountCache
{
DDLogWarn(@"%@ Deleting all signal accounts.", self.logTag);
[SignalAccount removeAllObjectsInCollection];
}
+ (void)deleteAllContacts + (void)deleteAllContacts
{ {
[self deleteContactsWithFilter:^(CNContact *contact) { [self deleteContactsWithFilter:^(CNContact *contact) {

@ -273,6 +273,10 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
self.signalAccountMap = [signalAccountMap copy]; self.signalAccountMap = [signalAccountMap copy];
self.signalAccounts = [signalAccounts copy]; self.signalAccounts = [signalAccounts copy];
[self.profileManager setContactRecipientIds:signalAccountMap.allKeys]; [self.profileManager setContactRecipientIds:signalAccountMap.allKeys];
[[NSNotificationCenter defaultCenter]
postNotificationNameAsync:OWSContactsManagerSignalAccountsDidChangeNotification
object:nil];
} }
// TODO dependency inject, avoid circular dependencies. // TODO dependency inject, avoid circular dependencies.

Loading…
Cancel
Save