From c6cc497eaf357b8706544c78e669a194059b3f41 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Fri, 19 Jan 2018 10:42:07 -0500 Subject: [PATCH] Don't migrate database until verifying keychain is accessible // FREEBIE --- Signal/src/AppDelegate.m | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 4a91a3440..e99603917 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -112,9 +112,10 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; DDLogWarn(@"%@ application: didFinishLaunchingWithOptions.", self.logTag); - // We need to do this _after_ we set up logging but _before_ we do - // anything else. - [self ensureIsReadyForAppExtensions]; + SetRandFunctionSeed(); + + // XXX - careful when moving this. It must happen before we initialize TSStorageManager. + [self verifyDBKeysAvailableBeforeBackgroundLaunch]; #if RELEASE // ensureIsReadyForAppExtensions may have changed the state of the logging @@ -125,14 +126,14 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; } #endif + // We need to do this _after_ we set up logging, when the keychain is unlocked, + // but before we access YapDatabase, files on disk, or NSUserDefaults + [self ensureIsReadyForAppExtensions]; + [AppVersion instance]; [self startupLogging]; - SetRandFunctionSeed(); - - // XXX - careful when moving this. It must happen before we initialize TSStorageManager. - [self verifyDBKeysAvailableBeforeBackgroundLaunch]; // If a backup restore is in progress, try to complete it. // Otherwise, cleanup backup state.