From 60a1cc5682887b2decd3cb891886ef7607089420 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 5 Mar 2018 11:27:56 -0500 Subject: [PATCH] Make 2FA registration screen look like the rest of registration // FREEBIE --- .../ViewControllers/OWS2FARegistrationViewController.m | 10 +++++++++- Signal/translations/en.lproj/Localizable.strings | 3 +++ SignalServiceKit/src/Account/TSAccountManager.m | 7 ++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Signal/src/ViewControllers/OWS2FARegistrationViewController.m b/Signal/src/ViewControllers/OWS2FARegistrationViewController.m index 7466741d3..5f1c756bb 100644 --- a/Signal/src/ViewControllers/OWS2FARegistrationViewController.m +++ b/Signal/src/ViewControllers/OWS2FARegistrationViewController.m @@ -54,6 +54,15 @@ NS_ASSUME_NONNULL_BEGIN { [super viewDidLoad]; + // The navigation bar is hidden in the registration workflow. + if (self.navigationController.navigationBarHidden) { + [self.navigationController setNavigationBarHidden:NO animated:YES]; + } + self.navigationItem.hidesBackButton = YES; + + self.title = NSLocalizedString(@"REGISTRATION_ENTER_LOCK_PIN_NAV_TITLE", + @"Navigation title shown when user is re-registering after having enabled registration lock"); + self.view.backgroundColor = UIColor.whiteColor; PinEntryView *entryView = [PinEntryView new]; @@ -65,7 +74,6 @@ NS_ASSUME_NONNULL_BEGIN @"REGISTER_2FA_INSTRUCTIONS", @"Instructions to enter the 'two-factor auth pin' in the 2FA registration view."); // Layout - [entryView autoPinEdgesToSuperviewMargins]; } diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index cea88ccb5..3c3f3d8d3 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -1420,6 +1420,9 @@ /* Label for the country code field */ "REGISTRATION_DEFAULT_COUNTRY_NAME" = "Country Code"; +/* Navigation title shown when user is re-registering after having enabled registration lock */ +"REGISTRATION_ENTER_LOCK_PIN_NAV_TITLE" = "Registration Lock"; + /* Placeholder text for the phone number textfield */ "REGISTRATION_ENTERNUMBER_DEFAULT_TEXT" = "Enter Number"; diff --git a/SignalServiceKit/src/Account/TSAccountManager.m b/SignalServiceKit/src/Account/TSAccountManager.m index 17d2018a0..60c2b5e98 100644 --- a/SignalServiceKit/src/Account/TSAccountManager.m +++ b/SignalServiceKit/src/Account/TSAccountManager.m @@ -408,10 +408,11 @@ NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignaling break; } case 423: { + NSString *localizedMessage = NSLocalizedString(@"REGISTRATION_VERIFICATION_FAILED_WRONG_PIN", + "Error message indicating that registration failed due to a missing or incorrect 2FA PIN."); DDLogError(@"%@ 2FA PIN required: %ld", self.logTag, error.code); - NSError *error = OWSErrorWithCodeDescription(OWSErrorCodeRegistrationMissing2FAPIN, - NSLocalizedString(@"REGISTRATION_VERIFICATION_FAILED_WRONG_PIN", - "Error message indicating that registration failed due to a missing or incorrect 2FA PIN.")); + NSError *error + = OWSErrorWithCodeDescription(OWSErrorCodeRegistrationMissing2FAPIN, localizedMessage); failureBlock(error); break; }