Register all database views asynchronously.

pull/1/head
Matthew Chen 7 years ago
parent 5cf89a0f3d
commit 100adae245

@ -401,7 +401,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
[self ensureRootViewController]; [self ensureRootViewController];
[AppReadiness.sharedManager runNowOrWhenAppIsReady:^{ [AppReadiness runNowOrWhenAppIsReady:^{
[self handleActivation]; [self handleActivation];
}]; }];
@ -768,7 +768,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
[OWSPreferences setIsRegistered:[TSAccountManager isRegistered]]; [OWSPreferences setIsRegistered:[TSAccountManager isRegistered]];
[AppReadiness.sharedManager setAppIsReady]; [AppReadiness setAppIsReady];
if ([TSAccountManager isRegistered]) { if ([TSAccountManager isRegistered]) {
DDLogInfo(@"localNumber: %@", [TSAccountManager localNumber]); DDLogInfo(@"localNumber: %@", [TSAccountManager localNumber]);

@ -314,11 +314,6 @@ typedef NSData *_Nullable (^CreateDatabaseMetadataBlock)(void);
- (BOOL)areAllRegistrationsComplete - (BOOL)areAllRegistrationsComplete
{ {
DDLogInfo(@"%@ areAllRegistrationsComplete: %d %d = %d",
self.logTag,
self.areSyncRegistrationsComplete,
self.areAsyncRegistrationsComplete,
self.areSyncRegistrationsComplete && self.areAsyncRegistrationsComplete);
return self.areSyncRegistrationsComplete && self.areAsyncRegistrationsComplete; return self.areSyncRegistrationsComplete && self.areAsyncRegistrationsComplete;
} }

@ -10,10 +10,17 @@ typedef void (^AppReadyBlock)(void);
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
// This method can be called on any thread.
+ (BOOL)isAppReady; + (BOOL)isAppReady;
// This method should only be called on the main thread.
+ (void)setAppIsReady; + (void)setAppIsReady;
// If the app is ready, the block is called immediately;
// otherwise it is called when the app becomes ready.
//
// This method should only be called on the main thread.
// The block will always be called on the main thread.
+ (void)runNowOrWhenAppIsReady:(AppReadyBlock)block; + (void)runNowOrWhenAppIsReady:(AppReadyBlock)block;
@end @end

@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (BOOL)isAppReady + (BOOL)isAppReady
{ {
return self.sharedManager.isAppReady; return [self.sharedManager isAppReady];
} }
+ (void)runNowOrWhenAppIsReady:(AppReadyBlock)block + (void)runNowOrWhenAppIsReady:(AppReadyBlock)block

Loading…
Cancel
Save