post-merge formatting fixup

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent 16448e2a0b
commit 3affb07a11

@ -736,7 +736,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
[AppVersion.instance appLaunchDidComplete]; [AppVersion.instance appLaunchDidComplete];
[Environment.current.contactsManager loadSignalAccountsFromCache]; [Environment.current.contactsManager loadSignalAccountsFromCache];
[self ensureRootViewController]; [self ensureRootViewController];
// If there were any messages in our local queue which we hadn't yet processed. // If there were any messages in our local queue which we hadn't yet processed.

@ -49,17 +49,17 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
// TODO: We need to configure the limits of this cache. // TODO: We need to configure the limits of this cache.
_avatarCache = [ImageCache new]; _avatarCache = [ImageCache new];
_dbReadConnection = [TSStorageManager sharedManager].newDatabaseConnection; _dbReadConnection = [TSStorageManager sharedManager].newDatabaseConnection;
_dbWriteConnection = [TSStorageManager sharedManager].newDatabaseConnection; _dbWriteConnection = [TSStorageManager sharedManager].newDatabaseConnection;
_allContacts = @[]; _allContacts = @[];
_allContactsMap = @{}; _allContactsMap = @{};
_signalAccountMap = @{}; _signalAccountMap = @{};
_signalAccounts = @[]; _signalAccounts = @[];
_systemContactsFetcher = [SystemContactsFetcher new]; _systemContactsFetcher = [SystemContactsFetcher new];
_systemContactsFetcher.delegate = self; _systemContactsFetcher.delegate = self;
OWSSingletonAssert(); OWSSingletonAssert();
return self; return self;
@ -68,14 +68,16 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
- (void)loadSignalAccountsFromCache - (void)loadSignalAccountsFromCache
{ {
__block NSMutableArray<SignalAccount *> *signalAccounts; __block NSMutableArray<SignalAccount *> *signalAccounts;
[self.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction * _Nonnull transaction) { [self.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *_Nonnull transaction) {
signalAccounts = [[NSMutableArray alloc] initWithCapacity:[SignalAccount numberOfKeysInCollectionWithTransaction:transaction]]; signalAccounts = [[NSMutableArray alloc]
initWithCapacity:[SignalAccount numberOfKeysInCollectionWithTransaction:transaction]];
[SignalAccount enumerateCollectionObjectsWithTransaction:transaction usingBlock:^(SignalAccount *signalAccount, BOOL * _Nonnull stop) {
[signalAccounts addObject:signalAccount]; [SignalAccount enumerateCollectionObjectsWithTransaction:transaction
}]; usingBlock:^(SignalAccount *signalAccount, BOOL *_Nonnull stop) {
[signalAccounts addObject:signalAccount];
}];
}]; }];
[self updateSignalAccounts:signalAccounts]; [self updateSignalAccounts:signalAccounts];
} }
@ -253,14 +255,14 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
[orphanedKeys removeObject:signalAccount.uniqueId]; [orphanedKeys removeObject:signalAccount.uniqueId];
[signalAccount saveWithTransaction:transaction]; [signalAccount saveWithTransaction:transaction];
} }
if (orphanedKeys.count > 0) { if (orphanedKeys.count > 0) {
DDLogInfo(@"%@ Removing %lu orphaned SignalAccounts", self.logTag, (unsigned long)orphanedKeys.count); DDLogInfo(@"%@ Removing %lu orphaned SignalAccounts", self.logTag, (unsigned long)orphanedKeys.count);
[transaction removeObjectsForKeys:orphanedKeys.allObjects inCollection:[SignalAccount collection]]; [transaction removeObjectsForKeys:orphanedKeys.allObjects inCollection:[SignalAccount collection]];
} }
}]; }];
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self updateSignalAccounts:signalAccounts]; [self updateSignalAccounts:signalAccounts];
}); });
@ -270,12 +272,12 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
- (void)updateSignalAccounts:(NSArray<SignalAccount *> *)signalAccounts - (void)updateSignalAccounts:(NSArray<SignalAccount *> *)signalAccounts
{ {
AssertIsOnMainThread(); AssertIsOnMainThread();
NSMutableDictionary<NSString *, SignalAccount *> *signalAccountMap = [NSMutableDictionary new]; NSMutableDictionary<NSString *, SignalAccount *> *signalAccountMap = [NSMutableDictionary new];
for (SignalAccount *signalAccount in signalAccounts) { for (SignalAccount *signalAccount in signalAccounts) {
signalAccountMap[signalAccount.recipientId] = signalAccount; signalAccountMap[signalAccount.recipientId] = signalAccount;
} }
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];
@ -593,8 +595,8 @@ NSString *const OWSContactsManagerSignalAccountsDidChangeNotification
// If contact intersection hasn't completed, it might exist on disk // If contact intersection hasn't completed, it might exist on disk
// even if it doesn't exist in memory yet. // even if it doesn't exist in memory yet.
if (!signalAccount) { if (!signalAccount) {
[self.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction * _Nonnull transaction) { [self.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *_Nonnull transaction) {
signalAccount = [SignalAccount fetchObjectWithUniqueID:recipientId transaction: transaction]; signalAccount = [SignalAccount fetchObjectWithUniqueID:recipientId transaction:transaction];
}]; }];
} }

@ -194,23 +194,22 @@ public class ShareViewController: UINavigationController, ShareViewDelegate, SAE
// TODO: Should we distinguish main app and SAE "completion"? // TODO: Should we distinguish main app and SAE "completion"?
AppVersion.instance().appLaunchDidComplete() AppVersion.instance().appLaunchDidComplete()
Environment.current().contactsManager.loadSignalAccountsFromCache() Environment.current().contactsManager.loadSignalAccountsFromCache()
ensureRootViewController() ensureRootViewController()
// We don't need to use OWSMessageReceiver in the SAE. // We don't need to use OWSMessageReceiver in the SAE.
// We don't need to use OWSBatchMessageProcessor in the SAE. // We don't need to use OWSBatchMessageProcessor in the SAE.
OWSProfileManager.shared().ensureLocalProfileCached() OWSProfileManager.shared().ensureLocalProfileCached()
// We don't need to use OWSOrphanedDataCleaner in the SAE. // We don't need to use OWSOrphanedDataCleaner in the SAE.
OWSProfileManager.shared().fetchLocalUsersProfile() OWSProfileManager.shared().fetchLocalUsersProfile()
OWSReadReceiptManager.shared().prepareCachedValues() OWSReadReceiptManager.shared().prepareCachedValues()
} }
@objc @objc

Loading…
Cancel
Save