From 38806148b6cffa0e7d00ba64cd5ad5983bac98a1 Mon Sep 17 00:00:00 2001 From: Joe Gasiorek Date: Sat, 22 Jun 2019 13:26:03 -0700 Subject: [PATCH] Display the translated string for text view in onboarding (#1057) --- lockbox-ios/Common/Resources/Constants.swift | 1 + .../View/OnboardingConfirmationView.swift | 30 +++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/lockbox-ios/Common/Resources/Constants.swift b/lockbox-ios/Common/Resources/Constants.swift index f6de0c65f..90e26d615 100644 --- a/lockbox-ios/Common/Resources/Constants.swift +++ b/lockbox-ios/Common/Resources/Constants.swift @@ -105,4 +105,5 @@ extension Constant.string { static let disclaimerLabel = NSLocalizedString("settings.unlinkDisclaimer", value: "This removes synced logins from %@, but will not delete your logins from Firefox.", comment: "Label on account setting explaining unlink. %@ will be replaced with the application name") static let onboardingTitle = NSLocalizedString("onboarding.title", value: "Welcome to %@", comment: "Title on onboarding screen. %@ will be replaced with the application name") static let getStarted = NSLocalizedString("get.started", value: "Get Started", comment: "Title for the FxA login screen.") + static let syncBetweenDevicesEncryption = NSLocalizedString("securityTheather.syncBetweenDevices", value: "Sync between devices with secure 256-bit encryption", comment: "Text shown on security screen during onboarding.") } diff --git a/lockbox-ios/View/OnboardingConfirmationView.swift b/lockbox-ios/View/OnboardingConfirmationView.swift index fd6236844..1ae83492a 100644 --- a/lockbox-ios/View/OnboardingConfirmationView.swift +++ b/lockbox-ios/View/OnboardingConfirmationView.swift @@ -57,24 +57,22 @@ extension OnboardingConfirmationView { self.finishButton.layer.cornerRadius = 5 self.finishButton.clipsToBounds = true - if let encryptionText = self.encryptionTextView.text { - self.encryptionTextView.delegate = self - let text = NSMutableAttributedString(string: encryptionText) - let range = text.mutableString.range(of: Constant.string.onboardingSecurityPostfix) - text.addAttributes([ - NSAttributedString.Key.font: UIFont.systemFont(ofSize: 15.0) - ], range: NSMakeRange(0, text.length)) // swiftlint:disable:this legacy_constructor + self.encryptionTextView.delegate = self + let text = NSMutableAttributedString(string: Constant.string.syncBetweenDevicesEncryption) + let range = text.mutableString.range(of: Constant.string.onboardingSecurityPostfix) + text.addAttributes([ + NSAttributedString.Key.font: UIFont.systemFont(ofSize: 15.0) + ], range: NSMakeRange(0, text.length)) // swiftlint:disable:this legacy_constructor - text.addAttributes( - [ - NSAttributedString.Key.link: NSString(string: Constant.app.securityFAQ), - NSAttributedString.Key.foregroundColor: Constant.color.lockBoxViolet - ], - range: range - ) + text.addAttributes( + [ + NSAttributedString.Key.link: NSString(string: Constant.app.securityFAQ), + NSAttributedString.Key.foregroundColor: Constant.color.lockBoxViolet + ], + range: range + ) - self.encryptionTextView.attributedText = text - } + self.encryptionTextView.attributedText = text } private func setupStrings() {