diff --git a/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift b/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift index 54994cb1..97560f6e 100644 --- a/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift +++ b/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift @@ -46,13 +46,7 @@ final class MastodonConfirmEmailViewController: UIViewController, NeedsDependenc let openEmailButton: UIButton = { let button = UIButton(type: .system) - button.titleLabel?.font = .preferredFont(forTextStyle: .headline) - button.setBackgroundImage(UIImage.placeholder(color: Asset.Colors.brandBlue.color), for: .normal) - button.setTitleColor(.white, for: .normal) button.setTitle(L10n.Scene.ConfirmEmail.Button.openEmailApp, for: .normal) - button.layer.masksToBounds = true - button.layer.cornerRadius = 8 - button.layer.cornerCurve = .continuous button.addTarget(self, action: #selector(openEmailButtonPressed(_:)), for: UIControl.Event.touchUpInside) return button }() diff --git a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift index d865c96e..8b238cf0 100644 --- a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift +++ b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift @@ -40,7 +40,7 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency let rulesLabel: UILabel = { let label = UILabel() - label.font = .preferredFont(forTextStyle: .body) + label.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold)) label.textColor = Asset.Colors.Label.primary.color label.text = "Rules" label.numberOfLines = 0 @@ -66,8 +66,6 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency let confirmButton: PrimaryActionButton = { let button = PrimaryActionButton() - button.titleLabel?.font = .preferredFont(forTextStyle: .headline) - button.setTitleColor(.white, for: .normal) button.setTitle(L10n.Scene.ServerRules.Button.confirm, for: .normal) return button }() diff --git a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel.swift b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel.swift index b1d000db..51f28526 100644 --- a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel.swift +++ b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewModel.swift @@ -36,14 +36,19 @@ final class MastodonServerRulesViewModel { var rulesAttributedString: NSAttributedString { let attributedString = NSMutableAttributedString(string: "\n") let configuration = UIImage.SymbolConfiguration(font: .preferredFont(forTextStyle: .title3)) + let separatorString = Array(repeating: " ", count: 4).joined() for (i, rule) in rules.enumerated() { + guard i < 50 else { + return NSAttributedString(string: "\(i)" + separatorString + rule.text + "\n\n") + } let imageName = String(i + 1) + ".circle.fill" let image = UIImage(systemName: imageName, withConfiguration: configuration)! let attachment = NSTextAttachment() attachment.image = image.withTintColor(Asset.Colors.Label.primary.color) - let imageAttribute = NSAttributedString(attachment: attachment) - - let ruleString = NSAttributedString(string: " " + rule.text + "\n\n") + let imageAttribute = NSMutableAttributedString(attachment: attachment) + imageAttribute.addAttributes([NSAttributedString.Key.baselineOffset : -1.5], range: NSRange(location: 0, length: imageAttribute.length)) + + let ruleString = NSAttributedString(string: separatorString + rule.text + "\n\n") attributedString.append(imageAttribute) attributedString.append(ruleString) } diff --git a/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift b/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift index 8fefc06c..82d0319f 100644 --- a/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift +++ b/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift @@ -39,7 +39,8 @@ extension PrimaryActionButton { titleLabel?.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold)) setTitleColor(.white, for: .normal) setBackgroundImage(UIImage.placeholder(color: Asset.Colors.brandBlue.color), for: .normal) - setupButtonBackground() + setBackgroundImage(UIImage.placeholder(color: Asset.Colors.brandBlueDarken20.color), for: .highlighted) + setBackgroundImage(UIImage.placeholder(color: Asset.Colors.disabled.color), for: .disabled) applyCornerRadius(radius: 10) } @@ -68,20 +69,4 @@ extension PrimaryActionButton { self.setTitle(originalButtonTitle, for: .disabled) } - override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { - setupButtonBackground() - } - - func setupButtonBackground() { - if UIScreen.main.traitCollection.userInterfaceStyle == .light { - setTitleColor(.white, for: .disabled) - setBackgroundImage(UIImage.placeholder(color: Asset.Colors.Button.normal.color.withAlphaComponent(0.5)), for: .highlighted) - setBackgroundImage(UIImage.placeholder(color: Asset.Colors.Button.disabled.color), for: .disabled) - - } else { - setTitleColor(UIColor.white.withAlphaComponent(0.5), for: .disabled) - setBackgroundImage(UIImage.placeholder(color: Asset.Colors.brandBlue.color.withAlphaComponent(0.5)), for: .highlighted) - setBackgroundImage(UIImage.placeholder(color: Asset.Colors.brandBlue.color.withAlphaComponent(0.5)), for: .disabled) - } - } }