Merge branch 'mkirk-2.19.3/fixup-account-cache' into hotfix/2.19.3
This commit is contained in:
commit
162b33ed5a
@ -46,6 +46,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
actionBlock:^{
|
||||
[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
|
||||
{
|
||||
[self deleteContactsWithFilter:^(CNContact *contact) {
|
||||
|
||||
@ -396,14 +396,34 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
// No Contacts
|
||||
OWSTableSection *contactsSection = [OWSTableSection new];
|
||||
|
||||
if (self.contactsViewHelper.contactsManager.isSystemContactsAuthorized
|
||||
&& self.contactsViewHelper.hasUpdatedContactsAtLeastOnce) {
|
||||
|
||||
[contactsSection
|
||||
addItem:[OWSTableItem
|
||||
softCenterLabelItemWithText:NSLocalizedString(@"SETTINGS_BLOCK_LIST_NO_CONTACTS",
|
||||
@"A label that indicates the user has no Signal contacts.")
|
||||
customRowHeight:self.actionCellHeight]];
|
||||
if (self.contactsViewHelper.contactsManager.isSystemContactsAuthorized) {
|
||||
if (self.contactsViewHelper.hasUpdatedContactsAtLeastOnce) {
|
||||
|
||||
[contactsSection
|
||||
addItem:[OWSTableItem softCenterLabelItemWithText:
|
||||
NSLocalizedString(@"SETTINGS_BLOCK_LIST_NO_CONTACTS",
|
||||
@"A label that indicates the user has no Signal contacts.")
|
||||
customRowHeight:self.actionCellHeight]];
|
||||
} else {
|
||||
UITableViewCell *loadingCell = [UITableViewCell new];
|
||||
OWSAssert(loadingCell.contentView);
|
||||
|
||||
UIActivityIndicatorView *activityIndicatorView =
|
||||
[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
|
||||
[loadingCell.contentView addSubview:activityIndicatorView];
|
||||
[activityIndicatorView startAnimating];
|
||||
|
||||
[activityIndicatorView autoCenterInSuperview];
|
||||
[activityIndicatorView setCompressionResistanceHigh];
|
||||
[activityIndicatorView setContentHuggingHigh];
|
||||
|
||||
// hide separator for loading cell. The loading cell doesn't really feel like a cell
|
||||
loadingCell.backgroundView = [UIView new];
|
||||
|
||||
OWSTableItem *loadingItem =
|
||||
[OWSTableItem itemWithCustomCell:loadingCell customRowHeight:40 actionBlock:nil];
|
||||
[contactsSection addItem:loadingItem];
|
||||
}
|
||||
}
|
||||
|
||||
return @[ contactsSection ];
|
||||
|
||||
@ -273,6 +273,10 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
|
||||
self.signalAccountMap = [signalAccountMap copy];
|
||||
self.signalAccounts = [signalAccounts copy];
|
||||
[self.profileManager setContactRecipientIds:signalAccountMap.allKeys];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationNameAsync:OWSContactsManagerSignalAccountsDidChangeNotification
|
||||
object:nil];
|
||||
}
|
||||
|
||||
// TODO dependency inject, avoid circular dependencies.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user