Block device from sleeping while Debug UI is visible and during database upgrades.
// FREEBIE
This commit is contained in:
parent
0244e134f5
commit
9cbc1e6a1b
|
@ -110,6 +110,12 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
|||
// XXX - careful when moving this. It must happen before we initialize TSStorageManager.
|
||||
[self verifyDBKeysAvailableBeforeBackgroundLaunch];
|
||||
|
||||
// Prevent the device from sleeping during database view async registration
|
||||
// (e.g. long database upgrades).
|
||||
//
|
||||
// This block will be cleared in databaseViewRegistrationComplete.
|
||||
[DeviceSleepManager.sharedInstance addBlockWithBlockObject:self];
|
||||
|
||||
[self setupEnvironment];
|
||||
|
||||
[UIUtil applySignalAppearence];
|
||||
|
@ -783,6 +789,8 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
|||
{
|
||||
DDLogInfo(@"databaseViewRegistrationComplete");
|
||||
|
||||
[DeviceSleepManager.sharedInstance removeBlockWithBlockObject:self];
|
||||
|
||||
[AppVersion.instance appLaunchDidComplete];
|
||||
|
||||
[self ensureRootViewController];
|
||||
|
|
|
@ -28,6 +28,24 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return self.class.tag;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
|
||||
// Block device from sleeping while in the Debug UI.
|
||||
//
|
||||
// This is useful if you're using long-running actions in the
|
||||
// Debug UI, like "send 1k messages", etc.
|
||||
[DeviceSleepManager.sharedInstance addBlockWithBlockObject:self];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated
|
||||
{
|
||||
[super viewWillDisappear:animated];
|
||||
|
||||
[DeviceSleepManager.sharedInstance removeBlockWithBlockObject:self];
|
||||
}
|
||||
|
||||
#pragma mark - Factory Methods
|
||||
|
||||
- (void)pushPageWithSection:(OWSTableSection *)section
|
||||
|
|
Loading…
Reference in New Issue