Show 'restore backup' view after registration.
This commit is contained in:
parent
b2d75eb1ae
commit
5c0d98b83a
|
@ -432,6 +432,10 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
|
|||
[self.navigationController popViewControllerAnimated:YES];
|
||||
break;
|
||||
case ProfileViewMode_Registration:
|
||||
if (![TSAccountManager sharedInstance].isReregistering) {
|
||||
[self checkCanImportBackup];
|
||||
return;
|
||||
}
|
||||
[self showHomeView];
|
||||
break;
|
||||
case ProfileViewMode_UpgradeOrNag:
|
||||
|
@ -450,6 +454,53 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
|
|||
OWSAssertDebug([navigationController.topViewController isKindOfClass:[HomeViewController class]]);
|
||||
}
|
||||
|
||||
- (void)showBackupRestoreView
|
||||
{
|
||||
HomeViewController *homeView = [HomeViewController new];
|
||||
SignalsNavigationController *navigationController =
|
||||
[[SignalsNavigationController alloc] initWithRootViewController:homeView];
|
||||
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
||||
appDelegate.window.rootViewController = navigationController;
|
||||
OWSAssertDebug([navigationController.topViewController isKindOfClass:[HomeViewController class]]);
|
||||
}
|
||||
|
||||
- (void)checkCanImportBackup
|
||||
{
|
||||
[OWSBackup.sharedManager
|
||||
checkCanImportBackup:^(BOOL value) {
|
||||
OWSLogInfo(@"has backup available for import? %d", value);
|
||||
|
||||
if (value) {
|
||||
[self showBackupRestoreView];
|
||||
} else {
|
||||
[self showHomeView];
|
||||
}
|
||||
}
|
||||
failure:^(NSError *error) {
|
||||
UIAlertController *controller = [UIAlertController
|
||||
alertControllerWithTitle:
|
||||
NSLocalizedString(@"CHECK_FOR_BACKUP_FAILED_TITLE",
|
||||
@"Title for alert shown when the app failed to check for an existing backup.")
|
||||
message:NSLocalizedString(@"CHECK_FOR_BACKUP_FAILED_MESSAGE",
|
||||
@"Message for alert shown when the app failed to check for an existing "
|
||||
@"backup.")
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[controller addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"REGISTER_FAILED_TRY_AGAIN", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *action) {
|
||||
[self checkCanImportBackup];
|
||||
}]];
|
||||
[controller
|
||||
addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"CHECK_FOR_BACKUP_DO_NOT_RESTORE",
|
||||
@"The label for the 'do not restore backup' button.")
|
||||
style:UIAlertActionStyleDestructive
|
||||
handler:^(UIAlertAction *action) {
|
||||
[self showHomeView];
|
||||
}]];
|
||||
[self presentViewController:controller animated:YES completion:nil];
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - UITextFieldDelegate
|
||||
|
||||
- (BOOL)textField:(UITextField *)textField
|
||||
|
|
|
@ -383,6 +383,15 @@
|
|||
/* Title for the 'censorship circumvention country' view. */
|
||||
"CENSORSHIP_CIRCUMVENTION_COUNTRY_VIEW_TITLE" = "Select Country";
|
||||
|
||||
/* The label for the 'do not restore backup' button. */
|
||||
"CHECK_FOR_BACKUP_DO_NOT_RESTORE" = "Do Not Restore";
|
||||
|
||||
/* Message for alert shown when the app failed to check for an existing backup. */
|
||||
"CHECK_FOR_BACKUP_FAILED_MESSAGE" = "Could not determine whether there is a backup that can be restored.";
|
||||
|
||||
/* Title for alert shown when the app failed to check for an existing backup. */
|
||||
"CHECK_FOR_BACKUP_FAILED_TITLE" = "Error";
|
||||
|
||||
/* Error indicating that the app could not determine that user's CloudKit account status */
|
||||
"CLOUDKIT_STATUS_COULD_NOT_DETERMINE" = "There was an error communicating with iCloud for backups.";
|
||||
|
||||
|
@ -1511,8 +1520,8 @@
|
|||
/* Label for 'Work FAX' phone numbers. */
|
||||
"PHONE_NUMBER_TYPE_WORK_FAX" = "Work Fax";
|
||||
|
||||
/* navbar title when viewing the default photo album, which includes all photos */
|
||||
"PHOTO_PICKER_DEFAULT_ALBUM" = "All Photos";
|
||||
/* label for system photo collections which have no name. */
|
||||
"PHOTO_PICKER_UNNAMED_COLLECTION" = "PHOTO_PICKER_UNNAMED_COLLECTION";
|
||||
|
||||
/* Accessibility label for button to start media playback */
|
||||
"PLAY_BUTTON_ACCESSABILITY_LABEL" = "Play Media";
|
||||
|
|
Loading…
Reference in New Issue