From 485ecc8e570b37e968e04bbe004d22e54965c49a Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Sun, 8 Jan 2023 14:53:15 +0100 Subject: [PATCH] Fix title for login-screen (#690) Was a norma label, is the _real_ title now --- .../Onboarding/Login/MastodonLoginView.swift | 37 ++++++------------- .../Login/MastodonLoginViewController.swift | 4 ++ 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/Mastodon/Scene/Onboarding/Login/MastodonLoginView.swift b/Mastodon/Scene/Onboarding/Login/MastodonLoginView.swift index d5f8b51d4..4b96679f2 100644 --- a/Mastodon/Scene/Onboarding/Login/MastodonLoginView.swift +++ b/Mastodon/Scene/Onboarding/Login/MastodonLoginView.swift @@ -13,9 +13,7 @@ class MastodonLoginView: UIView { // List with (filtered) domains - let titleLabel: UILabel - let subtitleLabel: UILabel - private let headerStackView: UIStackView + let explanationTextLabel: UILabel let searchTextField: UITextField private let searchTextFieldLeftView: UIView @@ -28,22 +26,12 @@ class MastodonLoginView: UIView { override init(frame: CGRect) { - titleLabel = UILabel() - titleLabel.font = MastodonLoginViewController.largeTitleFont - titleLabel.textColor = MastodonLoginViewController.largeTitleTextColor - titleLabel.text = L10n.Scene.Login.title - titleLabel.numberOfLines = 0 - - subtitleLabel = UILabel() - subtitleLabel.font = MastodonLoginViewController.subTitleFont - subtitleLabel.textColor = MastodonLoginViewController.subTitleTextColor - subtitleLabel.text = L10n.Scene.Login.subtitle - subtitleLabel.numberOfLines = 0 - - headerStackView = UIStackView(arrangedSubviews: [titleLabel, subtitleLabel]) - headerStackView.axis = .vertical - headerStackView.spacing = 16 - headerStackView.translatesAutoresizingMaskIntoConstraints = false + explanationTextLabel = UILabel() + explanationTextLabel.translatesAutoresizingMaskIntoConstraints = false + explanationTextLabel.font = MastodonLoginViewController.subTitleFont + explanationTextLabel.textColor = MastodonLoginViewController.subTitleTextColor + explanationTextLabel.text = L10n.Scene.Login.subtitle + explanationTextLabel.numberOfLines = 0 searchTextFieldMagnifyingGlass = UIImageView(image: UIImage( systemName: "magnifyingglass", @@ -81,7 +69,7 @@ class MastodonLoginView: UIView { super.init(frame: frame) - addSubview(headerStackView) + addSubview(explanationTextLabel) addSubview(searchTextField) addSubview(tableView) addSubview(navigationActionView) @@ -99,12 +87,11 @@ class MastodonLoginView: UIView { let bottomConstraint = safeAreaLayoutGuide.bottomAnchor.constraint(equalTo: navigationActionView.bottomAnchor) let constraints = [ + explanationTextLabel.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor), + explanationTextLabel.leadingAnchor.constraint(equalTo: readableContentGuide.leadingAnchor), + explanationTextLabel.trailingAnchor.constraint(equalTo: readableContentGuide.trailingAnchor), - headerStackView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor), - headerStackView.leadingAnchor.constraint(equalTo: readableContentGuide.leadingAnchor), - headerStackView.trailingAnchor.constraint(equalTo: readableContentGuide.trailingAnchor), - - searchTextField.topAnchor.constraint(equalTo: headerStackView.bottomAnchor, constant: 32), + searchTextField.topAnchor.constraint(equalTo: explanationTextLabel.bottomAnchor, constant: 32), searchTextField.leadingAnchor.constraint(equalTo: leadingAnchor, constant: 16), searchTextField.heightAnchor.constraint(equalToConstant: 55), trailingAnchor.constraint(equalTo: searchTextField.trailingAnchor, constant: 16), diff --git a/Mastodon/Scene/Onboarding/Login/MastodonLoginViewController.swift b/Mastodon/Scene/Onboarding/Login/MastodonLoginViewController.swift index 9f9ce5d75..c9609ebc3 100644 --- a/Mastodon/Scene/Onboarding/Login/MastodonLoginViewController.swift +++ b/Mastodon/Scene/Onboarding/Login/MastodonLoginViewController.swift @@ -11,6 +11,7 @@ import MastodonCore import MastodonAsset import Combine import AuthenticationServices +import MastodonLocalization protocol MastodonLoginViewControllerDelegate: AnyObject { func backButtonPressed(_ viewController: MastodonLoginViewController) @@ -97,6 +98,9 @@ class MastodonLoginViewController: UIViewController, NeedsDependency { defer { setupNavigationBarBackgroundView() } setupOnboardingAppearance() + + title = L10n.Scene.Login.title + navigationItem.hidesBackButton = true } override func viewWillAppear(_ animated: Bool) {