Fix email-confirmation-screen-title (#690)

what a word.
This commit is contained in:
Nathan Mattes 2022-12-28 15:25:54 +01:00
parent 18e25aea30
commit 9e1dbe1dff
6 changed files with 19 additions and 47 deletions

View File

@ -383,8 +383,7 @@
}, },
"confirm_email": { "confirm_email": {
"title": "One last thing.", "title": "One last thing.",
"subtitle": "Tap the link we emailed to you to verify your account.", "tap_the_link_we_emailed_to_you_to_verify_your_account": "Tap the link we sent you to verify %@. Well wait right here.",
"tap_the_link_we_emailed_to_you_to_verify_your_account": "Tap the link we emailed to you to verify your account",
"button": { "button": {
"open_email_app": "Open Email App", "open_email_app": "Open Email App",
"resend": "Resend" "resend": "Resend"

View File

@ -393,9 +393,8 @@
} }
}, },
"confirm_email": { "confirm_email": {
"title": "One last thing.", "title": "Check Your Inbox",
"subtitle": "Tap the link we emailed to you to verify your account.", "tap_the_link_we_emailed_to_you_to_verify_your_account": "Tap the link we sent you to verify %@. Well wait right here.",
"tap_the_link_we_emailed_to_you_to_verify_your_account": "Tap the link we emailed to you to verify your account",
"button": { "button": {
"open_email_app": "Open Email App", "open_email_app": "Open Email App",
"resend": "Resend" "resend": "Resend"

View File

@ -26,19 +26,10 @@ final class MastodonConfirmEmailViewController: UIViewController, NeedsDependenc
let stackView = UIStackView() let stackView = UIStackView()
let largeTitleLabel: UILabel = {
let label = UILabel()
label.font = UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: UIFont.systemFont(ofSize: 34, weight: .bold))
label.textColor = .label
label.text = L10n.Scene.ConfirmEmail.title
return label
}()
private(set) lazy var subtitleLabel: UILabel = { private(set) lazy var subtitleLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.font = UIFontMetrics(forTextStyle: .title1).scaledFont(for: UIFont.systemFont(ofSize: 20)) label.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: UIFont.systemFont(ofSize: 17))
label.textColor = .secondaryLabel label.textColor = .label
label.text = L10n.Scene.ConfirmEmail.tapTheLinkWeEmailedToYouToVerifyYourAccount
label.numberOfLines = 0 label.numberOfLines = 0
return label return label
}() }()
@ -57,10 +48,6 @@ final class MastodonConfirmEmailViewController: UIViewController, NeedsDependenc
return navigationActionView return navigationActionView
}() }()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
} }
extension MastodonConfirmEmailViewController { extension MastodonConfirmEmailViewController {
@ -68,16 +55,16 @@ extension MastodonConfirmEmailViewController {
override func viewDidLoad() { override func viewDidLoad() {
setupOnboardingAppearance() setupOnboardingAppearance()
configureTitleLabel()
configureMargin() configureMargin()
subtitleLabel.text = L10n.Scene.ConfirmEmail.tapTheLinkWeEmailedToYouToVerifyYourAccount(viewModel.email)
// stackView // stackView
stackView.axis = .vertical stackView.axis = .vertical
stackView.distribution = .fill stackView.distribution = .fill
stackView.spacing = 10 stackView.spacing = 10
stackView.layoutMargins = UIEdgeInsets(top: 10, left: 0, bottom: 23, right: 0) stackView.layoutMargins = UIEdgeInsets(top: 10, left: 0, bottom: 23, right: 0)
stackView.isLayoutMarginsRelativeArrangement = true stackView.isLayoutMarginsRelativeArrangement = true
stackView.addArrangedSubview(largeTitleLabel)
stackView.addArrangedSubview(subtitleLabel) stackView.addArrangedSubview(subtitleLabel)
stackView.addArrangedSubview(emailImageView) stackView.addArrangedSubview(emailImageView)
emailImageView.setContentHuggingPriority(.defaultLow, for: .vertical) emailImageView.setContentHuggingPriority(.defaultLow, for: .vertical)
@ -140,31 +127,19 @@ extension MastodonConfirmEmailViewController {
navigationActionView.nextButton.setTitle(L10n.Scene.ConfirmEmail.Button.openEmailApp, for: .normal) navigationActionView.nextButton.setTitle(L10n.Scene.ConfirmEmail.Button.openEmailApp, for: .normal)
navigationActionView.nextButton.addTarget(self, action: #selector(MastodonConfirmEmailViewController.openEmailButtonPressed(_:)), for: .touchUpInside) navigationActionView.nextButton.addTarget(self, action: #selector(MastodonConfirmEmailViewController.openEmailButtonPressed(_:)), for: .touchUpInside)
title = L10n.Scene.ConfirmEmail.title
} }
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection) super.traitCollectionDidChange(previousTraitCollection)
configureTitleLabel()
configureMargin() configureMargin()
} }
} }
extension MastodonConfirmEmailViewController { extension MastodonConfirmEmailViewController {
private func configureTitleLabel() {
switch traitCollection.horizontalSizeClass {
case .regular:
navigationItem.largeTitleDisplayMode = .always
navigationItem.title = L10n.Scene.ConfirmEmail.title.replacingOccurrences(of: "\n", with: " ")
largeTitleLabel.isHidden = true
default:
navigationItem.largeTitleDisplayMode = .never
navigationItem.title = nil
largeTitleLabel.isHidden = false
}
}
private func configureMargin() { private func configureMargin() {
switch traitCollection.horizontalSizeClass { switch traitCollection.horizontalSizeClass {
case .regular: case .regular:

View File

@ -620,12 +620,12 @@ public enum L10n {
} }
} }
public enum ConfirmEmail { public enum ConfirmEmail {
/// Tap the link we emailed to you to verify your account. /// Tap the link we sent you to verify %@. We'll wait right here.
public static let subtitle = L10n.tr("Localizable", "Scene.ConfirmEmail.Subtitle", fallback: "Tap the link we emailed to you to verify your account.") public static func tapTheLinkWeEmailedToYouToVerifyYourAccount(_ p1: Any) -> String {
/// Tap the link we emailed to you to verify your account return L10n.tr("Localizable", "Scene.ConfirmEmail.TapTheLinkWeEmailedToYouToVerifyYourAccount", String(describing: p1), fallback: "Tap the link we sent you to verify %@. We'll wait right here.")
public static let tapTheLinkWeEmailedToYouToVerifyYourAccount = L10n.tr("Localizable", "Scene.ConfirmEmail.TapTheLinkWeEmailedToYouToVerifyYourAccount", fallback: "Tap the link we emailed to you to verify your account") }
/// One last thing. /// Check Your Inbox
public static let title = L10n.tr("Localizable", "Scene.ConfirmEmail.Title", fallback: "One last thing.") public static let title = L10n.tr("Localizable", "Scene.ConfirmEmail.Title", fallback: "Check Your Inbox")
public enum Button { public enum Button {
/// Open Email App /// Open Email App
public static let openEmailApp = L10n.tr("Localizable", "Scene.ConfirmEmail.Button.OpenEmailApp", fallback: "Open Email App") public static let openEmailApp = L10n.tr("Localizable", "Scene.ConfirmEmail.Button.OpenEmailApp", fallback: "Open Email App")

View File

@ -233,9 +233,8 @@ uploaded to Mastodon.";
"Scene.ConfirmEmail.OpenEmailApp.Mail" = "Mail"; "Scene.ConfirmEmail.OpenEmailApp.Mail" = "Mail";
"Scene.ConfirmEmail.OpenEmailApp.OpenEmailClient" = "Open Email Client"; "Scene.ConfirmEmail.OpenEmailApp.OpenEmailClient" = "Open Email Client";
"Scene.ConfirmEmail.OpenEmailApp.Title" = "Check your inbox."; "Scene.ConfirmEmail.OpenEmailApp.Title" = "Check your inbox.";
"Scene.ConfirmEmail.Subtitle" = "Tap the link we emailed to you to verify your account."; "Scene.ConfirmEmail.TapTheLinkWeEmailedToYouToVerifyYourAccount" = "Tap the link we sent you to verify %@. We'll wait right here.";
"Scene.ConfirmEmail.TapTheLinkWeEmailedToYouToVerifyYourAccount" = "Tap the link we emailed to you to verify your account"; "Scene.ConfirmEmail.Title" = "Check Your Inbox";
"Scene.ConfirmEmail.Title" = "One last thing.";
"Scene.Discovery.Intro" = "These are the posts gaining traction in your corner of Mastodon."; "Scene.Discovery.Intro" = "These are the posts gaining traction in your corner of Mastodon.";
"Scene.Discovery.Tabs.Community" = "Community"; "Scene.Discovery.Tabs.Community" = "Community";
"Scene.Discovery.Tabs.ForYou" = "For You"; "Scene.Discovery.Tabs.ForYou" = "For You";

View File

@ -228,8 +228,8 @@ uploaded to Mastodon.";
"Scene.ConfirmEmail.OpenEmailApp.OpenEmailClient" = "Open Email Client"; "Scene.ConfirmEmail.OpenEmailApp.OpenEmailClient" = "Open Email Client";
"Scene.ConfirmEmail.OpenEmailApp.Title" = "Check your inbox."; "Scene.ConfirmEmail.OpenEmailApp.Title" = "Check your inbox.";
"Scene.ConfirmEmail.Subtitle" = "Tap the link we emailed to you to verify your account."; "Scene.ConfirmEmail.Subtitle" = "Tap the link we emailed to you to verify your account.";
"Scene.ConfirmEmail.TapTheLinkWeEmailedToYouToVerifyYourAccount" = "Tap the link we emailed to you to verify your account"; "Scene.ConfirmEmail.TapTheLinkWeEmailedToYouToVerifyYourAccount" = "Tap the link we sent you to verify %@. We'll wait right here.";
"Scene.ConfirmEmail.Title" = "One last thing."; "Scene.ConfirmEmail.Title" = "Check Your Inbox";
"Scene.Discovery.Intro" = "These are the posts gaining traction in your corner of Mastodon."; "Scene.Discovery.Intro" = "These are the posts gaining traction in your corner of Mastodon.";
"Scene.Discovery.Tabs.Community" = "Community"; "Scene.Discovery.Tabs.Community" = "Community";
"Scene.Discovery.Tabs.ForYou" = "For You"; "Scene.Discovery.Tabs.ForYou" = "For You";