From 1b358ac179413085f3c1389fdc4ec025e65672cc Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Mon, 27 Mar 2023 12:37:40 -0500 Subject: [PATCH] New registration: show correct charset switcher text on PIN screen We shouldn't say things like "Create alphanumeric PIN" if you're entering an existing PIN. --- .../RegistrationPinViewController.swift | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/Signal/src/ViewControllers/Registration/RegistrationPinViewController.swift b/Signal/src/ViewControllers/Registration/RegistrationPinViewController.swift index 27dd91196b..41b31c66bb 100644 --- a/Signal/src/ViewControllers/Registration/RegistrationPinViewController.swift +++ b/Signal/src/ViewControllers/Registration/RegistrationPinViewController.swift @@ -370,16 +370,8 @@ class RegistrationPinViewController: OWSViewController { switch pinCharacterSet { case .digitsOnly: pinTextField.keyboardType = .numberPad - togglePinCharacterSetButton.setTitle(title: OWSLocalizedString( - "PIN_CREATION_CREATE_ALPHANUMERIC", - comment: "Button asking if the user would like to create an alphanumeric PIN" - )) case .alphanumeric: pinTextField.keyboardType = .default - togglePinCharacterSetButton.setTitle(title: OWSLocalizedString( - "PIN_CREATION_CREATE_NUMERIC", - comment: "Button asking if the user would like to create an numeric PIN" - )) } if previousKeyboardType != pinTextField.keyboardType { pinTextField.reloadInputViews() @@ -435,11 +427,19 @@ class RegistrationPinViewController: OWSViewController { "PIN_CREATION_NUMERIC_HINT", comment: "Label indicating the user must use at least 4 digits" ) + togglePinCharacterSetButton.setTitle(title: OWSLocalizedString( + "PIN_CREATION_CREATE_ALPHANUMERIC", + comment: "Button asking if the user would like to create an alphanumeric PIN" + )) case .alphanumeric: pinValidationLabel.text = OWSLocalizedString( "PIN_CREATION_ALPHANUMERIC_HINT", comment: "Label indicating the user must use at least 4 characters" ) + togglePinCharacterSetButton.setTitle(title: OWSLocalizedString( + "PIN_CREATION_CREATE_NUMERIC", + comment: "Button asking if the user would like to create an numeric PIN" + )) } pinValidationLabel.textColor = .colorForRegistrationExplanationLabel @@ -498,6 +498,19 @@ class RegistrationPinViewController: OWSViewController { needHelpWithExistingPinButton.setTitleColor(Theme.accentBlueColor) + switch pinCharacterSet { + case .digitsOnly: + togglePinCharacterSetButton.setTitle(title: OWSLocalizedString( + "ONBOARDING_2FA_ENTER_ALPHANUMERIC", + comment: "Button asking if the user would like to enter an alphanumeric PIN" + )) + case .alphanumeric: + togglePinCharacterSetButton.setTitle(title: OWSLocalizedString( + "ONBOARDING_2FA_ENTER_NUMERIC", + comment: "Button asking if the user would like to enter an numeric PIN" + )) + } + replaceViewsAfterTextField(with: [ pinValidationLabel, needHelpWithExistingPinButton,