From 491448e753e6a84f1011a52f85eecbc8c69efea4 Mon Sep 17 00:00:00 2001 From: sunxiaojian Date: Sun, 25 Apr 2021 02:19:47 -0700 Subject: [PATCH] fix: register scene Dark Mode --- Mastodon/Generated/Assets.swift | 1 - .../Colors/Icon/photo.colorset/Contents.json | 20 -------------- .../MastodonRegisterViewController.swift | 26 +++++++++---------- .../MastodonServerRulesViewController.swift | 8 ++---- 4 files changed, 15 insertions(+), 40 deletions(-) delete mode 100644 Mastodon/Resources/Assets.xcassets/Colors/Icon/photo.colorset/Contents.json diff --git a/Mastodon/Generated/Assets.swift b/Mastodon/Generated/Assets.swift index a4b5692b..7f37f671 100644 --- a/Mastodon/Generated/Assets.swift +++ b/Mastodon/Generated/Assets.swift @@ -63,7 +63,6 @@ internal enum Asset { internal static let normal = ColorAsset(name: "Colors/Button/normal") } internal enum Icon { - internal static let photo = ColorAsset(name: "Colors/Icon/photo") internal static let plus = ColorAsset(name: "Colors/Icon/plus") } internal enum Label { diff --git a/Mastodon/Resources/Assets.xcassets/Colors/Icon/photo.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Colors/Icon/photo.colorset/Contents.json deleted file mode 100644 index d4f558bf..00000000 --- a/Mastodon/Resources/Assets.xcassets/Colors/Icon/photo.colorset/Contents.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "colors" : [ - { - "color" : { - "color-space" : "srgb", - "components" : { - "alpha" : "0.300", - "blue" : "67", - "green" : "60", - "red" : "60" - } - }, - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift index 009e2653..3c20ed73 100644 --- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift +++ b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift @@ -79,9 +79,9 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O let image = UIImage(systemName: "person.fill.viewfinder", withConfiguration: configuration) button.setImage(image?.withRenderingMode(UIImage.RenderingMode.alwaysTemplate), for: UIControl.State.normal) - button.imageView?.tintColor = Asset.Colors.Icon.photo.color - button.backgroundColor = .white - button.layer.cornerRadius = 45 + button.imageView?.tintColor = Asset.Colors.Label.secondary.color + button.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color + button.layer.cornerRadius = 10 button.clipsToBounds = true return button @@ -93,7 +93,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O let image = Asset.Circles.plusCircleFill.image.withRenderingMode(.alwaysTemplate) icon.image = image icon.tintColor = Asset.Colors.Icon.plus.color - icon.backgroundColor = .white + icon.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color return icon }() @@ -109,7 +109,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O textField.autocapitalizationType = .none textField.autocorrectionType = .no - textField.backgroundColor = .white + textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color textField.textColor = Asset.Colors.Label.primary.color textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Username.placeholder, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, @@ -132,7 +132,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O let textField = UITextField() textField.autocapitalizationType = .none textField.autocorrectionType = .no - textField.backgroundColor = .white + textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color textField.textColor = Asset.Colors.Label.primary.color textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.DisplayName.placeholder, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, @@ -149,7 +149,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O textField.autocapitalizationType = .none textField.autocorrectionType = .no textField.keyboardType = .emailAddress - textField.backgroundColor = .white + textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color textField.textColor = Asset.Colors.Label.primary.color textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Email.placeholder, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, @@ -174,7 +174,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O textField.autocorrectionType = .no textField.keyboardType = .asciiCapable textField.isSecureTextEntry = true - textField.backgroundColor = .white + textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color textField.textColor = Asset.Colors.Label.primary.color textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Password.placeholder, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, @@ -204,7 +204,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O let textField = UITextField() textField.autocapitalizationType = .none textField.autocorrectionType = .no - textField.backgroundColor = .white + textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color textField.textColor = Asset.Colors.Label.primary.color textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Invite.registrationUserInviteRequest, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, @@ -336,8 +336,8 @@ extension MastodonRegisterViewController { ]) avatarButton.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ - avatarButton.heightAnchor.constraint(equalToConstant: 90).priority(.defaultHigh), - avatarButton.widthAnchor.constraint(equalToConstant: 90).priority(.defaultHigh), + avatarButton.heightAnchor.constraint(equalToConstant: 92).priority(.defaultHigh), + avatarButton.widthAnchor.constraint(equalToConstant: 92).priority(.defaultHigh), avatarButton.centerXAnchor.constraint(equalTo: avatarView.centerXAnchor), avatarButton.centerYAnchor.constraint(equalTo: avatarView.centerYAnchor), ]) @@ -345,8 +345,8 @@ extension MastodonRegisterViewController { plusIconImageView.translatesAutoresizingMaskIntoConstraints = false avatarView.addSubview(plusIconImageView) NSLayoutConstraint.activate([ - plusIconImageView.trailingAnchor.constraint(equalTo: avatarButton.trailingAnchor), - plusIconImageView.bottomAnchor.constraint(equalTo: avatarButton.bottomAnchor), + plusIconImageView.centerXAnchor.constraint(equalTo: avatarButton.trailingAnchor), + plusIconImageView.centerYAnchor.constraint(equalTo: avatarButton.bottomAnchor), ]) // textfield diff --git a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift index b51d66b2..610d87f3 100644 --- a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift +++ b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift @@ -48,7 +48,7 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency let bottomContainerView: UIView = { let view = UIView() - view.backgroundColor = Asset.Colors.Background.onboardingBackground.color + view.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color return view }() @@ -58,7 +58,7 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency textView.textColor = .label textView.isSelectable = true textView.isEditable = false - textView.backgroundColor = Asset.Colors.Background.onboardingBackground.color + textView.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color return textView }() @@ -85,10 +85,6 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency extension MastodonServerRulesViewController { - override var preferredStatusBarStyle: UIStatusBarStyle { - return .darkContent - } - override func viewDidLoad() { super.viewDidLoad()