@ -421,11 +421,15 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
- ( void ) updateProfileCompleted
- ( void ) updateProfileCompleted
{
{
OWSLogVerbose ( @ "") ;
[ self profileCompletedOrSkipped ] ;
[ self profileCompletedOrSkipped ] ;
}
}
- ( void ) profileCompletedOrSkipped
- ( void ) profileCompletedOrSkipped
{
{
OWSLogVerbose ( @ "") ;
/ / Dismiss this view .
/ / Dismiss this view .
switch ( self . profileViewMode ) {
switch ( self . profileViewMode ) {
case ProfileViewMode_AppSettings :
case ProfileViewMode_AppSettings :
@ -446,11 +450,15 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
- ( void ) showHomeView
- ( void ) showHomeView
{
{
OWSLogVerbose ( @ "") ;
[ SignalApp . sharedApp showHomeView ] ;
[ SignalApp . sharedApp showHomeView ] ;
}
}
- ( void ) showBackupRestoreView
- ( void ) showBackupRestoreView
{
{
OWSLogVerbose ( @ "") ;
BackupRestoreViewController * restoreView = [ BackupRestoreViewController new ] ;
BackupRestoreViewController * restoreView = [ BackupRestoreViewController new ] ;
[ self . navigationController setViewControllers : @ [
[ self . navigationController setViewControllers : @ [
restoreView ,
restoreView ,
@ -460,39 +468,48 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
- ( void ) checkCanImportBackup
- ( void ) checkCanImportBackup
{
{
OWSLogVerbose ( @ "") ;
[ OWSBackup . sharedManager
[ OWSBackup . sharedManager
checkCanImportBackup : ^( BOOL value ) {
checkCanImportBackup : ^( BOOL value ) {
OWSLogInfo ( @ "has backup available for import ? %d", value);
OWSLogInfo ( @ "has backup available for import ? %d", value);
if ( value ) {
if ( value ) {
[ OWSBackup . sharedManager setHasPendingRestoreDecision : YES ] ;
[ self showBackupRestoreView ] ;
[ self showBackupRestoreView ] ;
} else {
} else {
[ self showHomeView ] ;
[ self showHomeView ] ;
}
}
}
}
failure : ^( NSError * error ) {
failure : ^( NSError * error ) {
UIAlertController * controller = [ UIAlertController
[ self showBackupCheckFailedAlert ] ;
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 ",
- ( void ) showBackupCheckFailedAlert
@ "Message for alert shown when the app failed to check for an existing "
{
@ "backup . ")
OWSLogVerbose ( @ "") ;
preferredStyle : UIAlertControllerStyleAlert ] ;
[ controller addAction : [ UIAlertAction actionWithTitle : NSLocalizedString ( @ "REGISTER_FAILED_TRY_AGAIN ", nil )
UIAlertController * controller = [ UIAlertController
style : UIAlertActionStyleDefault
alertControllerWithTitle : NSLocalizedString ( @ "CHECK_FOR_BACKUP_FAILED_TITLE ",
handler : ^( UIAlertAction * action ) {
@ "Title for alert shown when the app failed to check for an existing backup . ")
[ self checkCanImportBackup ] ;
message : NSLocalizedString ( @ "CHECK_FOR_BACKUP_FAILED_MESSAGE ",
} ] ] ;
@ "Message for alert shown when the app failed to check for an existing "
[ controller
@ "backup . ")
addAction : [ UIAlertAction actionWithTitle : NSLocalizedString ( @ "CHECK_FOR_BACKUP_DO_NOT_RESTORE ",
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 . ")
@ "The label for the ' do not restore backup' button . ")
style : UIAlertActionStyleDestructive
style : UIAlertActionStyleDestructive
handler : ^( UIAlertAction * action ) {
handler : ^( UIAlertAction * action ) {
[ self showHomeView ] ;
[ self showHomeView ] ;
} ] ] ;
} ] ] ;
[ self presentViewController : controller animated : YES completion : nil ] ;
[ self presentViewController : controller animated : YES completion : nil ] ;
} ] ;
}
}
#pragma mark - UITextFieldDelegate
#pragma mark - UITextFieldDelegate