Sketch out the backup restore view.
This commit is contained in:
parent
56fe3663e6
commit
4ee0958384
|
@ -142,6 +142,11 @@ static NSTimeInterval launchStartedAt;
|
|||
return Environment.shared.windowManager;
|
||||
}
|
||||
|
||||
- (OWSBackup *)backup
|
||||
{
|
||||
return AppEnvironment.shared.backup;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
|
@ -547,6 +552,10 @@ static NSTimeInterval launchStartedAt;
|
|||
OWSFailDebug(@"app launch failed");
|
||||
return NO;
|
||||
}
|
||||
if (self.backup.hasPendingRestoreDecision) {
|
||||
OWSLogInfo(@"Ignoring URL; pending restore decision.");
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (!AppReadiness.isAppReady) {
|
||||
OWSLogWarn(@"Ignoring openURL: app not ready.");
|
||||
|
@ -744,6 +753,12 @@ static NSTimeInterval launchStartedAt;
|
|||
|
||||
if (self.didAppLaunchFail) {
|
||||
OWSFailDebug(@"app launch failed");
|
||||
completionHandler(NO);
|
||||
return;
|
||||
}
|
||||
if (self.backup.hasPendingRestoreDecision) {
|
||||
OWSLogInfo(@"Ignoring shortcut action; pending restore decision.");
|
||||
completionHandler(NO);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -795,6 +810,10 @@ static NSTimeInterval launchStartedAt;
|
|||
OWSFailDebug(@"app launch failed");
|
||||
return NO;
|
||||
}
|
||||
if (self.backup.hasPendingRestoreDecision) {
|
||||
OWSLogInfo(@"Ignoring user activity; pending restore decision.");
|
||||
return NO;
|
||||
}
|
||||
|
||||
if ([userActivity.activityType isEqualToString:@"INStartVideoCallIntent"]) {
|
||||
if (!SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(10, 0)) {
|
||||
|
@ -950,6 +969,10 @@ static NSTimeInterval launchStartedAt;
|
|||
OWSFailDebug(@"app launch failed");
|
||||
return;
|
||||
}
|
||||
if (self.backup.hasPendingRestoreDecision) {
|
||||
OWSLogInfo(@"Ignoring remote notification; pending restore decision.");
|
||||
return;
|
||||
}
|
||||
|
||||
// It is safe to continue even if the app isn't ready.
|
||||
[[PushManager sharedManager] application:application didReceiveRemoteNotification:userInfo];
|
||||
|
@ -964,6 +987,10 @@ static NSTimeInterval launchStartedAt;
|
|||
OWSFailDebug(@"app launch failed");
|
||||
return;
|
||||
}
|
||||
if (self.backup.hasPendingRestoreDecision) {
|
||||
OWSLogInfo(@"Ignoring remote notification; pending restore decision.");
|
||||
return;
|
||||
}
|
||||
|
||||
// It is safe to continue even if the app isn't ready.
|
||||
[[PushManager sharedManager] application:application
|
||||
|
@ -978,6 +1005,10 @@ static NSTimeInterval launchStartedAt;
|
|||
OWSFailDebug(@"app launch failed");
|
||||
return;
|
||||
}
|
||||
if (self.backup.hasPendingRestoreDecision) {
|
||||
OWSLogInfo(@"Ignoring local notification; pending restore decision.");
|
||||
return;
|
||||
}
|
||||
|
||||
OWSLogInfo(@"%@", notification);
|
||||
[AppReadiness runNowOrWhenAppDidBecomeReady:^{
|
||||
|
@ -994,6 +1025,12 @@ static NSTimeInterval launchStartedAt;
|
|||
|
||||
if (self.didAppLaunchFail) {
|
||||
OWSFailDebug(@"app launch failed");
|
||||
completionHandler();
|
||||
return;
|
||||
}
|
||||
if (self.backup.hasPendingRestoreDecision) {
|
||||
OWSLogInfo(@"Ignoring action; pending restore decision.");
|
||||
completionHandler();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1023,6 +1060,12 @@ static NSTimeInterval launchStartedAt;
|
|||
|
||||
if (self.didAppLaunchFail) {
|
||||
OWSFailDebug(@"app launch failed");
|
||||
completionHandler();
|
||||
return;
|
||||
}
|
||||
if (self.backup.hasPendingRestoreDecision) {
|
||||
OWSLogInfo(@"Ignoring action; pending restore decision.");
|
||||
completionHandler();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1220,18 +1263,21 @@ static NSTimeInterval launchStartedAt;
|
|||
NSTimeInterval startupDuration = CACurrentMediaTime() - launchStartedAt;
|
||||
OWSLogInfo(@"Presenting app %.2f seconds after launch started.", startupDuration);
|
||||
|
||||
UIViewController *rootViewController;
|
||||
if ([self.tsAccountManager isRegistered]) {
|
||||
HomeViewController *homeView = [HomeViewController new];
|
||||
SignalsNavigationController *navigationController =
|
||||
[[SignalsNavigationController alloc] initWithRootViewController:homeView];
|
||||
self.window.rootViewController = navigationController;
|
||||
if (self.backup.hasPendingRestoreDecision) {
|
||||
rootViewController = [BackupRestoreViewController new];
|
||||
} else {
|
||||
rootViewController = [HomeViewController new];
|
||||
}
|
||||
} else {
|
||||
RegistrationViewController *viewController = [RegistrationViewController new];
|
||||
OWSNavigationController *navigationController =
|
||||
[[OWSNavigationController alloc] initWithRootViewController:viewController];
|
||||
navigationController.navigationBarHidden = YES;
|
||||
self.window.rootViewController = navigationController;
|
||||
rootViewController = [RegistrationViewController new];
|
||||
}
|
||||
OWSAssertDebug(rootViewController);
|
||||
OWSNavigationController *navigationController =
|
||||
[[OWSNavigationController alloc] initWithRootViewController:rootViewController];
|
||||
navigationController.navigationBarHidden = YES;
|
||||
self.window.rootViewController = navigationController;
|
||||
|
||||
[AppUpdateNag.sharedInstance showAppUpgradeNagIfNecessary];
|
||||
}
|
||||
|
|
|
@ -426,9 +426,6 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
|
|||
{
|
||||
OWSLogVerbose(@"");
|
||||
|
||||
[self checkCanImportBackup];
|
||||
return;
|
||||
|
||||
// Dismiss this view.
|
||||
switch (self.profileViewMode) {
|
||||
case ProfileViewMode_AppSettings:
|
||||
|
|
|
@ -115,18 +115,27 @@ public class BackupRestoreViewController: OWSTableViewController {
|
|||
|
||||
backup.setHasPendingRestoreDecision(false)
|
||||
|
||||
self.dismiss(animated: true)
|
||||
dismiss(animated: true)
|
||||
}
|
||||
|
||||
@objc
|
||||
private func startImport() {
|
||||
Logger.info("")
|
||||
|
||||
hasBegunImport = true
|
||||
|
||||
backup.tryToImport()
|
||||
}
|
||||
|
||||
private func showHomeView() {
|
||||
SignalApp.shared().showHomeView()
|
||||
let isModal = navigationController?.presentingViewController != nil
|
||||
if isModal {
|
||||
dismiss(animated: true, completion: {
|
||||
SignalApp.shared().showHomeView()
|
||||
})
|
||||
} else {
|
||||
SignalApp.shared().showHomeView()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Notifications
|
||||
|
@ -134,7 +143,12 @@ public class BackupRestoreViewController: OWSTableViewController {
|
|||
@objc func backupStateDidChange() {
|
||||
AssertIsOnMainThread()
|
||||
|
||||
Logger.verbose("backup.backupImportState: \(NSStringForBackupImportState(backup.backupImportState))")
|
||||
Logger.flush()
|
||||
|
||||
if backup.backupImportState == .succeeded {
|
||||
backup.setHasPendingRestoreDecision(false)
|
||||
|
||||
showHomeView()
|
||||
} else {
|
||||
updateTableContents()
|
||||
|
|
|
@ -259,6 +259,11 @@ NSString *NSStringForBackupImportState(OWSBackupState state)
|
|||
if (!self.isBackupEnabled) {
|
||||
return NO;
|
||||
}
|
||||
if (self.hasPendingRestoreDecision) {
|
||||
// Don't backup while awaiting user decision about
|
||||
// whether to import previous backup.
|
||||
return NO;
|
||||
}
|
||||
if (UIApplication.sharedApplication.applicationState != UIApplicationStateActive) {
|
||||
// Don't start backups when app is in the background.
|
||||
return NO;
|
||||
|
|
|
@ -234,13 +234,13 @@
|
|||
"BACKUP_RESTORE_DECISION_TITLE" = "Backup Available";
|
||||
|
||||
/* Label for the backup restore description. */
|
||||
"BACKUP_RESTORE_DESCRIPTION" = "BACKUP_RESTORE_DESCRIPTION";
|
||||
"BACKUP_RESTORE_DESCRIPTION" = "Restoring Backup";
|
||||
|
||||
/* Label for the backup restore progress. */
|
||||
"BACKUP_RESTORE_PROGRESS" = "BACKUP_RESTORE_PROGRESS";
|
||||
"BACKUP_RESTORE_PROGRESS" = "Progress";
|
||||
|
||||
/* Label for the backup restore status. */
|
||||
"BACKUP_RESTORE_STATUS" = "BACKUP_RESTORE_STATUS";
|
||||
"BACKUP_RESTORE_STATUS" = "Status";
|
||||
|
||||
/* An explanation of the consequences of blocking a group. */
|
||||
"BLOCK_GROUP_BEHAVIOR_EXPLANATION" = "You will no longer receive messages or updates from this group.";
|
||||
|
|
Loading…
Reference in New Issue