Respond to CR.
This commit is contained in:
parent
eb3569d8f8
commit
7f23dfa258
|
@ -6,8 +6,8 @@
|
|||
#import "AppStoreRating.h"
|
||||
#import "AppUpdateNag.h"
|
||||
#import "CodeVerificationViewController.h"
|
||||
#import "HomeViewController.h"
|
||||
#import "DebugLogger.h"
|
||||
#import "HomeViewController.h"
|
||||
#import "MainAppContext.h"
|
||||
#import "NotificationsManager.h"
|
||||
#import "OWS2FASettingsViewController.h"
|
||||
|
@ -156,7 +156,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
|||
// This block will be cleared in storageIsReady.
|
||||
[DeviceSleepManager.sharedInstance addBlockWithBlockObject:self];
|
||||
|
||||
[AppSetup setupEnvironment:^{
|
||||
[AppSetup setupEnvironmentWithCallMessageHandlerBlock:^{
|
||||
return SignalApp.sharedApp.callMessageHandler;
|
||||
}
|
||||
notificationsProtocolBlock:^{
|
||||
|
@ -1086,6 +1086,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
|||
[AppVersion.instance mainAppLaunchDidComplete];
|
||||
|
||||
[Environment.current.contactsManager loadSignalAccountsFromCache];
|
||||
[Environment.current.contactsManager startObserving];
|
||||
|
||||
// If there were any messages in our local queue which we hadn't yet processed.
|
||||
[[OWSMessageReceiver sharedInstance] handleAnyUnprocessedEnvelopesAsync];
|
||||
|
|
|
@ -13,9 +13,9 @@ typedef id<NotificationsProtocol> _Nonnull (^NotificationsManagerBlock)(void);
|
|||
// This is _NOT_ a singleton and will be instantiated each time that the SAE is used.
|
||||
@interface AppSetup : NSObject
|
||||
|
||||
+ (void)setupEnvironment:(CallMessageHandlerBlock)callMessageHandlerBlock
|
||||
notificationsProtocolBlock:(NotificationsManagerBlock)notificationsManagerBlock
|
||||
migrationCompletion:(dispatch_block_t)migrationCompletion;
|
||||
+ (void)setupEnvironmentWithCallMessageHandlerBlock:(CallMessageHandlerBlock)callMessageHandlerBlock
|
||||
notificationsProtocolBlock:(NotificationsManagerBlock)notificationsManagerBlock
|
||||
migrationCompletion:(dispatch_block_t)migrationCompletion;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
@implementation AppSetup
|
||||
|
||||
+ (void)setupEnvironment:(CallMessageHandlerBlock)callMessageHandlerBlock
|
||||
notificationsProtocolBlock:(NotificationsManagerBlock)notificationsManagerBlock
|
||||
migrationCompletion:(dispatch_block_t)migrationCompletion
|
||||
+ (void)setupEnvironmentWithCallMessageHandlerBlock:(CallMessageHandlerBlock)callMessageHandlerBlock
|
||||
notificationsProtocolBlock:(NotificationsManagerBlock)notificationsManagerBlock
|
||||
migrationCompletion:(dispatch_block_t)migrationCompletion
|
||||
{
|
||||
OWSAssert(callMessageHandlerBlock);
|
||||
OWSAssert(notificationsManagerBlock);
|
||||
|
@ -51,19 +51,16 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[NSKeyedUnarchiver setClass:[OWSUserProfile class] forClassName:[OWSUserProfile collection]];
|
||||
[NSKeyedUnarchiver setClass:[OWSDatabaseMigration class] forClassName:[OWSDatabaseMigration collection]];
|
||||
|
||||
[OWSStorage setupStorageWithMigrationBlock:^() {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
// Don't start database migrations until storage is ready.
|
||||
[VersionMigrations performUpdateCheckWithCompletion:^() {
|
||||
OWSAssertIsOnMainThread();
|
||||
[OWSStorage registerExtensionsWithMigrationBlock:^() {
|
||||
// Don't start database migrations until storage is ready.
|
||||
[VersionMigrations performUpdateCheckWithCompletion:^() {
|
||||
OWSAssertIsOnMainThread();
|
||||
|
||||
migrationCompletion();
|
||||
migrationCompletion();
|
||||
|
||||
backgroundTask = nil;
|
||||
}];
|
||||
});
|
||||
backgroundTask = nil;
|
||||
}];
|
||||
}];
|
||||
[[Environment current].contactsManager startObserving];
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -88,8 +88,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[self clearBloomFilterCache];
|
||||
}
|
||||
|
||||
[[[OWSDatabaseMigrationRunner alloc] initWithPrimaryStorage:[OWSPrimaryStorage sharedManager]]
|
||||
runAllOutstandingWithCompletion:completion];
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
[[[OWSDatabaseMigrationRunner alloc] initWithPrimaryStorage:[OWSPrimaryStorage sharedManager]]
|
||||
runAllOutstandingWithCompletion:completion];
|
||||
});
|
||||
}
|
||||
|
||||
+ (BOOL)isVersion:(NSString *)thisVersionString
|
||||
|
|
|
@ -58,7 +58,7 @@ typedef void (^OWSStorageMigrationBlock)(void);
|
|||
// This object can be used to filter database notifications.
|
||||
@property (nonatomic, readonly, nullable) id dbNotificationObject;
|
||||
|
||||
+ (void)setupStorageWithMigrationBlock:(OWSStorageMigrationBlock)migrationBlock;
|
||||
+ (void)registerExtensionsWithMigrationBlock:(OWSStorageMigrationBlock)migrationBlock;
|
||||
|
||||
+ (void)resetAllStorage;
|
||||
|
||||
|
|
|
@ -325,7 +325,7 @@ typedef NSData *_Nullable (^CreateDatabaseMetadataBlock)(void);
|
|||
OWS_ABSTRACT_METHOD();
|
||||
}
|
||||
|
||||
+ (void)setupStorageWithMigrationBlock:(OWSStorageMigrationBlock)migrationBlock
|
||||
+ (void)registerExtensionsWithMigrationBlock:(OWSStorageMigrationBlock)migrationBlock
|
||||
{
|
||||
OWSAssert(migrationBlock);
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailed
|
|||
}.retainUntilComplete()
|
||||
|
||||
// We shouldn't set up our environment until after we've consulted isReadyForAppExtensions.
|
||||
AppSetup.setupEnvironment({
|
||||
AppSetup.setupEnvironment(callMessageHandlerBlock: {
|
||||
return NoopCallMessageHandler()
|
||||
},
|
||||
notificationsProtocolBlock: {
|
||||
|
@ -268,6 +268,7 @@ public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailed
|
|||
AppVersion.instance().saeLaunchDidComplete()
|
||||
|
||||
Environment.current().contactsManager.loadSignalAccountsFromCache()
|
||||
Environment.current().contactsManager.startObserving()
|
||||
|
||||
ensureRootViewController()
|
||||
|
||||
|
|
Loading…
Reference in New Issue