Add copy mnemonic button
This commit is contained in:
parent
19dd766713
commit
a551500e37
|
@ -5,7 +5,7 @@
|
|||
<key>BuildDetails</key>
|
||||
<dict>
|
||||
<key>CarthageVersion</key>
|
||||
<string>0.33.0</string>
|
||||
<string>0.32.0</string>
|
||||
<key>OSXVersion</key>
|
||||
<string>10.14.4</string>
|
||||
<key>WebRTCCommit</key>
|
||||
|
|
|
@ -60,12 +60,12 @@ public class Onboarding2FAViewController: OnboardingBaseViewController {
|
|||
validationWarningLabel.ows_autoPinToSuperviewEdges()
|
||||
validationWarningRow.autoSetDimension(.height, toSize: validationWarningLabel.font.lineHeight)
|
||||
|
||||
let forgotPinLink = self.linkButton(title: NSLocalizedString("ONBOARDING_2FA_FORGOT_PIN_LINK",
|
||||
let forgotPinLink = self.createLinkButton(title: NSLocalizedString("ONBOARDING_2FA_FORGOT_PIN_LINK",
|
||||
comment: "Label for the 'forgot 2FA PIN' link in the 'onboarding 2FA' view."),
|
||||
selector: #selector(forgotPinLinkTapped))
|
||||
forgotPinLink.accessibilityIdentifier = "onboarding.2fa." + "forgotPinLink"
|
||||
|
||||
let nextButton = self.button(title: NSLocalizedString("BUTTON_NEXT",
|
||||
let nextButton = self.createButton(title: NSLocalizedString("BUTTON_NEXT",
|
||||
comment: "Label for the 'next' button."),
|
||||
selector: #selector(nextPressed))
|
||||
nextButton.accessibilityIdentifier = "onboarding.2fa." + "nextButton"
|
||||
|
|
|
@ -36,7 +36,7 @@ final class OnboardingAccountDetailsViewController : OnboardingBaseViewControlle
|
|||
let passwordLabel = createExplanationLabel(text: NSLocalizedString("Type an optional password for added security", comment: ""))
|
||||
passwordLabel.accessibilityIdentifier = "onboarding.accountDetailsStep.passwordLabel"
|
||||
let bottomSpacer = UIView.vStretchingSpacer()
|
||||
let nextButton = button(title: NSLocalizedString("Next", comment: ""), selector: #selector(goToSeedStep))
|
||||
let nextButton = createButton(title: NSLocalizedString("Next", comment: ""), selector: #selector(goToSeedStep))
|
||||
nextButton.accessibilityIdentifier = "onboarding.accountDetailsStep.nextButton"
|
||||
let stackView = UIStackView(arrangedSubviews: [
|
||||
titleLabel,
|
||||
|
|
|
@ -49,11 +49,11 @@ public class OnboardingBaseViewController: OWSViewController {
|
|||
return explanationLabel
|
||||
}
|
||||
|
||||
func button(title: String, selector: Selector) -> OWSFlatButton {
|
||||
func createButton(title: String, selector: Selector) -> OWSFlatButton {
|
||||
return button(title: title, selector: selector, titleColor: .white, backgroundColor: .ows_materialBlue)
|
||||
}
|
||||
|
||||
func linkButton(title: String, selector: Selector) -> OWSFlatButton {
|
||||
func createLinkButton(title: String, selector: Selector) -> OWSFlatButton {
|
||||
return button(title: title, selector: selector, titleColor: .ows_materialBlue, backgroundColor: .white)
|
||||
}
|
||||
|
||||
|
|
|
@ -26,12 +26,12 @@ public class OnboardingPermissionsViewController: OnboardingBaseViewController {
|
|||
comment: "Explanation in the 'onboarding permissions' view."))
|
||||
explanationLabel.accessibilityIdentifier = "onboarding.permissions." + "explanationLabel"
|
||||
|
||||
let giveAccessButton = self.button(title: NSLocalizedString("ONBOARDING_PERMISSIONS_ENABLE_PERMISSIONS_BUTTON",
|
||||
let giveAccessButton = self.createButton(title: NSLocalizedString("ONBOARDING_PERMISSIONS_ENABLE_PERMISSIONS_BUTTON",
|
||||
comment: "Label for the 'give access' button in the 'onboarding permissions' view."),
|
||||
selector: #selector(giveAccessPressed))
|
||||
giveAccessButton.accessibilityIdentifier = "onboarding.permissions." + "giveAccessButton"
|
||||
|
||||
let notNowButton = self.linkButton(title: NSLocalizedString("ONBOARDING_PERMISSIONS_NOT_NOW_BUTTON",
|
||||
let notNowButton = self.createLinkButton(title: NSLocalizedString("ONBOARDING_PERMISSIONS_NOT_NOW_BUTTON",
|
||||
comment: "Label for the 'not now' button in the 'onboarding permissions' view."),
|
||||
selector: #selector(notNowPressed))
|
||||
notNowButton.accessibilityIdentifier = "onboarding.permissions." + "notNowButton"
|
||||
|
|
|
@ -37,7 +37,7 @@ public class OnboardingProfileViewController: OnboardingBaseViewController {
|
|||
comment: "Explanation in the 'onboarding profile' view."))
|
||||
explanationLabel.accessibilityIdentifier = "onboarding.profile." + "explanationLabel"
|
||||
|
||||
let nextButton = self.button(title: NSLocalizedString("BUTTON_NEXT",
|
||||
let nextButton = self.createButton(title: NSLocalizedString("BUTTON_NEXT",
|
||||
comment: "Label for the 'next' button."),
|
||||
selector: #selector(nextPressed))
|
||||
nextButton.accessibilityIdentifier = "onboarding.profile." + "nextButton"
|
||||
|
|
|
@ -30,8 +30,10 @@ final class OnboardingPublicKeyViewController : OnboardingBaseViewController {
|
|||
let topSpacer = UIView.vStretchingSpacer()
|
||||
let explanationLabel = createExplanationLabel(text: NSLocalizedString("Please save the seed below in a safe location. It can be used to restore your account if you lose access, or to migrate to a new device.", comment: ""))
|
||||
explanationLabel.accessibilityIdentifier = "onboarding.publicKeyStep.explanationLabel"
|
||||
let copyButton = createLinkButton(title: NSLocalizedString("Copy", comment: ""), selector: #selector(copyMnemonic))
|
||||
copyButton.accessibilityIdentifier = "onboarding.publicKeyStep.copyButton"
|
||||
let bottomSpacer = UIView.vStretchingSpacer()
|
||||
let registerButton = button(title: NSLocalizedString("Register", comment: ""), selector: #selector(register))
|
||||
let registerButton = createButton(title: NSLocalizedString("Register", comment: ""), selector: #selector(register))
|
||||
registerButton.accessibilityIdentifier = "onboarding.publicKeyStep.registerButton"
|
||||
let stackView = UIStackView(arrangedSubviews: [
|
||||
titleLabel,
|
||||
|
@ -39,6 +41,8 @@ final class OnboardingPublicKeyViewController : OnboardingBaseViewController {
|
|||
explanationLabel,
|
||||
UIView.spacer(withHeight: 32),
|
||||
mnemonicLabel,
|
||||
UIView.spacer(withHeight: 24),
|
||||
copyButton,
|
||||
bottomSpacer,
|
||||
registerButton
|
||||
])
|
||||
|
@ -63,7 +67,11 @@ final class OnboardingPublicKeyViewController : OnboardingBaseViewController {
|
|||
hexEncodedPublicKey = keyPair.publicKey.map { String(format: "%02hhx", $0) }.joined()
|
||||
mnemonic = Mnemonic.encode(hexEncodedString: hexEncodedPublicKey)
|
||||
}
|
||||
|
||||
|
||||
@objc private func copyMnemonic() {
|
||||
UIPasteboard.general.string = mnemonic
|
||||
}
|
||||
|
||||
@objc private func register() {
|
||||
let accountManager = TSAccountManager.sharedInstance()
|
||||
accountManager.phoneNumberAwaitingVerification = hexEncodedPublicKey
|
||||
|
|
|
@ -40,7 +40,7 @@ public class OnboardingSplashViewController: OnboardingBaseViewController {
|
|||
explanationLabel.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(explanationLabelTapped)))
|
||||
explanationLabel.accessibilityIdentifier = "onboarding.splash." + "explanationLabel"
|
||||
|
||||
let continueButton = self.button(title: NSLocalizedString("BUTTON_CONTINUE",
|
||||
let continueButton = self.createButton(title: NSLocalizedString("BUTTON_CONTINUE",
|
||||
comment: "Label for 'continue' button."),
|
||||
selector: #selector(continuePressed))
|
||||
view.addSubview(continueButton)
|
||||
|
|
|
@ -279,7 +279,7 @@ public class OnboardingVerificationViewController: OnboardingBaseViewController
|
|||
self.titleLabel = titleLabel
|
||||
titleLabel.accessibilityIdentifier = "onboarding.verification." + "titleLabel"
|
||||
|
||||
let backLink = self.linkButton(title: NSLocalizedString("ONBOARDING_VERIFICATION_BACK_LINK",
|
||||
let backLink = self.createLinkButton(title: NSLocalizedString("ONBOARDING_VERIFICATION_BACK_LINK",
|
||||
comment: "Label for the link that lets users change their phone number in the onboarding views."),
|
||||
selector: #selector(backLinkTapped))
|
||||
self.backLink = backLink
|
||||
|
@ -300,7 +300,7 @@ public class OnboardingVerificationViewController: OnboardingBaseViewController
|
|||
errorRow.addSubview(errorLabel)
|
||||
errorLabel.autoPinEdgesToSuperviewEdges()
|
||||
|
||||
let codeStateLink = self.linkButton(title: "",
|
||||
let codeStateLink = self.createLinkButton(title: "",
|
||||
selector: #selector(resendCodeLinkTapped))
|
||||
codeStateLink.enableMultilineLabel()
|
||||
self.codeStateLink = codeStateLink
|
||||
|
|
|
@ -2552,4 +2552,5 @@
|
|||
"Type an optional password for added security" = "Type an optional password for added security";
|
||||
"Password (Optional)" = "Password (Optional)";
|
||||
"Please save the seed below in a safe location. It can be used to restore your account if you lose access, or to migrate to a new device." = "Please save the seed below in a safe location. It can be used to restore your account if you lose access, or to migrate to a new device.";
|
||||
"Copy" = "Copy";
|
||||
"Register" = "Register";
|
||||
|
|
Loading…
Reference in New Issue