Clean up ahead of PR.

pull/1/head
Matthew Chen 8 years ago
parent 150f417a5e
commit f5353fc7d5

@ -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]) {

@ -65,8 +65,6 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)migrateToSharedData;
+ (void)verifyDBKeysAvailableBeforeBackgroundLaunch;
@end
NS_ASSUME_NONNULL_END

@ -718,23 +718,6 @@ void setDatabaseInitialized()
[TSAttachmentStream deleteAttachments];
}
/**
* 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);
}
}
@end
NS_ASSUME_NONNULL_END

@ -33,9 +33,6 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate {
SetRandFunctionSeed()
// XXX - careful when moving this. It must happen before we initialize TSStorageManager.
TSStorageManager.verifyDBKeysAvailableBeforeBackgroundLaunch()
// TODO:
// // Prevent the device from sleeping during database view async registration
// // (e.g. long database upgrades).

Loading…
Cancel
Save