mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
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];
|
[self.navigationController popViewControllerAnimated:YES];
|
||||||
break;
|
break;
|
||||||
case ProfileViewMode_Registration:
|
case ProfileViewMode_Registration:
|
||||||
|
if (![TSAccountManager sharedInstance].isReregistering) {
|
||||||
|
[self checkCanImportBackup];
|
||||||
|
return;
|
||||||
|
}
|
||||||
[self showHomeView];
|
[self showHomeView];
|
||||||
break;
|
break;
|
||||||
case ProfileViewMode_UpgradeOrNag:
|
case ProfileViewMode_UpgradeOrNag:
|
||||||
|
@ -450,6 +454,53 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
|
||||||
OWSAssertDebug([navigationController.topViewController isKindOfClass:[HomeViewController class]]);
|
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
|
#pragma mark - UITextFieldDelegate
|
||||||
|
|
||||||
- (BOOL)textField:(UITextField *)textField
|
- (BOOL)textField:(UITextField *)textField
|
||||||
|
|
|
@ -383,6 +383,15 @@
|
||||||
/* Title for the 'censorship circumvention country' view. */
|
/* Title for the 'censorship circumvention country' view. */
|
||||||
"CENSORSHIP_CIRCUMVENTION_COUNTRY_VIEW_TITLE" = "Select Country";
|
"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 */
|
/* 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.";
|
"CLOUDKIT_STATUS_COULD_NOT_DETERMINE" = "There was an error communicating with iCloud for backups.";
|
||||||
|
|
||||||
|
@ -1511,8 +1520,8 @@
|
||||||
/* Label for 'Work FAX' phone numbers. */
|
/* Label for 'Work FAX' phone numbers. */
|
||||||
"PHONE_NUMBER_TYPE_WORK_FAX" = "Work Fax";
|
"PHONE_NUMBER_TYPE_WORK_FAX" = "Work Fax";
|
||||||
|
|
||||||
/* navbar title when viewing the default photo album, which includes all photos */
|
/* label for system photo collections which have no name. */
|
||||||
"PHOTO_PICKER_DEFAULT_ALBUM" = "All Photos";
|
"PHOTO_PICKER_UNNAMED_COLLECTION" = "PHOTO_PICKER_UNNAMED_COLLECTION";
|
||||||
|
|
||||||
/* Accessibility label for button to start media playback */
|
/* Accessibility label for button to start media playback */
|
||||||
"PLAY_BUTTON_ACCESSABILITY_LABEL" = "Play Media";
|
"PLAY_BUTTON_ACCESSABILITY_LABEL" = "Play Media";
|
||||||
|
|
Loading…
Reference in a new issue