Sketch out the backup restore view.

This commit is contained in:
Matthew Chen 2018-11-21 11:53:45 -08:00
parent 332f202a52
commit 03f598a130
2 changed files with 25 additions and 26 deletions

View file

@ -383,35 +383,30 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
}
// Show an activity indicator to block the UI during the profile upload.
UIAlertController *alertController = [UIAlertController
alertControllerWithTitle:NSLocalizedString(@"PROFILE_VIEW_SAVING",
@"Alert title that indicates the user's profile view is being saved.")
message:nil
preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:alertController
animated:YES
completion:^{
[OWSProfileManager.sharedManager updateLocalProfileName:normalizedProfileName
avatarImage:self.avatar
success:^{
[alertController dismissViewControllerAnimated:NO
completion:^{
[weakSelf updateProfileCompleted];
}];
}
failure:^{
[alertController
dismissViewControllerAnimated:NO
completion:^{
[OWSAlerts showErrorAlertWithMessage:
NSLocalizedString(
[ModalActivityIndicatorViewController
presentFromViewController:self
canCancel:NO
backgroundBlock:^(ModalActivityIndicatorViewController *modalActivityIndicator) {
[OWSProfileManager.sharedManager updateLocalProfileName:normalizedProfileName
avatarImage:self.avatar
success:^{
dispatch_async(dispatch_get_main_queue(), ^{
[modalActivityIndicator dismissWithCompletion:^{
[weakSelf updateProfileCompleted];
}];
});
}
failure:^{
dispatch_async(dispatch_get_main_queue(), ^{
[modalActivityIndicator dismissWithCompletion:^{
[OWSAlerts showErrorAlertWithMessage:NSLocalizedString(
@"PROFILE_VIEW_ERROR_UPDATE_FAILED",
@"Error message shown when a "
@"profile update fails.")];
}];
}];
}];
}];
});
}];
}];
}
- (NSString *)normalizedProfileName
@ -450,6 +445,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
- (void)showHomeView
{
OWSAssertIsOnMainThread();
OWSLogVerbose(@"");
[SignalApp.sharedApp showHomeView];
@ -457,6 +453,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
- (void)showBackupRestoreView
{
OWSAssertIsOnMainThread();
OWSLogVerbose(@"");
BackupRestoreViewController *restoreView = [BackupRestoreViewController new];

View file

@ -14,6 +14,8 @@ public class BackupRestoreViewController: OWSTableViewController {
}
override public func loadView() {
super.loadView()
navigationItem.title = NSLocalizedString("SETTINGS_BACKUP", comment: "Label for the backup view in app settings.")
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(didPressCancelButton))