|
|
|
@ -131,7 +131,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
|
|
|
|
SetRandFunctionSeed();
|
|
|
|
|
|
|
|
|
|
// XXX - careful when moving this. It must happen before we initialize TSStorageManager.
|
|
|
|
|
[TSStorageManager verifyDBKeysAvailableBeforeBackgroundLaunch];
|
|
|
|
|
[self verifyDBKeysAvailableBeforeBackgroundLaunch];
|
|
|
|
|
|
|
|
|
|
// Prevent the device from sleeping during database view async registration
|
|
|
|
|
// (e.g. long database upgrades).
|
|
|
|
@ -192,6 +192,24 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
|
|
|
|
return YES;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The user must unlock the device once after reboot before the database encryption key can be accessed.
|
|
|
|
|
*/
|
|
|
|
|
- (void)verifyDBKeysAvailableBeforeBackgroundLaunch
|
|
|
|
|
{
|
|
|
|
|
if (CurrentAppContext().isMainApp && CurrentAppContext().mainApplicationState != UIApplicationStateBackground) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (![TSStorageManager isDatabasePasswordAccessible]) {
|
|
|
|
|
DDLogInfo(
|
|
|
|
|
@"%@ exiting because we are in the background and the database password is not accessible.", self.logTag);
|
|
|
|
|
[DDLog flushLog];
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)ensureIsReadyForAppExtensions
|
|
|
|
|
{
|
|
|
|
|
if ([OWSPreferences isReadyForAppExtensions]) {
|
|
|
|
|