fix: register scene Dark Mode

This commit is contained in:
sunxiaojian 2021-04-25 02:19:47 -07:00
parent 00794a259a
commit 491448e753
4 changed files with 15 additions and 40 deletions

View File

@ -63,7 +63,6 @@ internal enum Asset {
internal static let normal = ColorAsset(name: "Colors/Button/normal") internal static let normal = ColorAsset(name: "Colors/Button/normal")
} }
internal enum Icon { internal enum Icon {
internal static let photo = ColorAsset(name: "Colors/Icon/photo")
internal static let plus = ColorAsset(name: "Colors/Icon/plus") internal static let plus = ColorAsset(name: "Colors/Icon/plus")
} }
internal enum Label { internal enum Label {

View File

@ -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
}
}

View File

@ -79,9 +79,9 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
let image = UIImage(systemName: "person.fill.viewfinder", withConfiguration: configuration) let image = UIImage(systemName: "person.fill.viewfinder", withConfiguration: configuration)
button.setImage(image?.withRenderingMode(UIImage.RenderingMode.alwaysTemplate), for: UIControl.State.normal) button.setImage(image?.withRenderingMode(UIImage.RenderingMode.alwaysTemplate), for: UIControl.State.normal)
button.imageView?.tintColor = Asset.Colors.Icon.photo.color button.imageView?.tintColor = Asset.Colors.Label.secondary.color
button.backgroundColor = .white button.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
button.layer.cornerRadius = 45 button.layer.cornerRadius = 10
button.clipsToBounds = true button.clipsToBounds = true
return button return button
@ -93,7 +93,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
let image = Asset.Circles.plusCircleFill.image.withRenderingMode(.alwaysTemplate) let image = Asset.Circles.plusCircleFill.image.withRenderingMode(.alwaysTemplate)
icon.image = image icon.image = image
icon.tintColor = Asset.Colors.Icon.plus.color icon.tintColor = Asset.Colors.Icon.plus.color
icon.backgroundColor = .white icon.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color
return icon return icon
}() }()
@ -109,7 +109,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
textField.autocapitalizationType = .none textField.autocapitalizationType = .none
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.backgroundColor = .white textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
textField.textColor = Asset.Colors.Label.primary.color textField.textColor = Asset.Colors.Label.primary.color
textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Username.placeholder, textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Username.placeholder,
attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color,
@ -132,7 +132,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
let textField = UITextField() let textField = UITextField()
textField.autocapitalizationType = .none textField.autocapitalizationType = .none
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.backgroundColor = .white textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
textField.textColor = Asset.Colors.Label.primary.color textField.textColor = Asset.Colors.Label.primary.color
textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.DisplayName.placeholder, textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.DisplayName.placeholder,
attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color,
@ -149,7 +149,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
textField.autocapitalizationType = .none textField.autocapitalizationType = .none
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.keyboardType = .emailAddress textField.keyboardType = .emailAddress
textField.backgroundColor = .white textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
textField.textColor = Asset.Colors.Label.primary.color textField.textColor = Asset.Colors.Label.primary.color
textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Email.placeholder, textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Email.placeholder,
attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color,
@ -174,7 +174,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.keyboardType = .asciiCapable textField.keyboardType = .asciiCapable
textField.isSecureTextEntry = true textField.isSecureTextEntry = true
textField.backgroundColor = .white textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
textField.textColor = Asset.Colors.Label.primary.color textField.textColor = Asset.Colors.Label.primary.color
textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Password.placeholder, textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Password.placeholder,
attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color,
@ -204,7 +204,7 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
let textField = UITextField() let textField = UITextField()
textField.autocapitalizationType = .none textField.autocapitalizationType = .none
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.backgroundColor = .white textField.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color
textField.textColor = Asset.Colors.Label.primary.color textField.textColor = Asset.Colors.Label.primary.color
textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Invite.registrationUserInviteRequest, textField.attributedPlaceholder = NSAttributedString(string: L10n.Scene.Register.Input.Invite.registrationUserInviteRequest,
attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color, attributes: [NSAttributedString.Key.foregroundColor: Asset.Colors.Label.secondary.color,
@ -336,8 +336,8 @@ extension MastodonRegisterViewController {
]) ])
avatarButton.translatesAutoresizingMaskIntoConstraints = false avatarButton.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
avatarButton.heightAnchor.constraint(equalToConstant: 90).priority(.defaultHigh), avatarButton.heightAnchor.constraint(equalToConstant: 92).priority(.defaultHigh),
avatarButton.widthAnchor.constraint(equalToConstant: 90).priority(.defaultHigh), avatarButton.widthAnchor.constraint(equalToConstant: 92).priority(.defaultHigh),
avatarButton.centerXAnchor.constraint(equalTo: avatarView.centerXAnchor), avatarButton.centerXAnchor.constraint(equalTo: avatarView.centerXAnchor),
avatarButton.centerYAnchor.constraint(equalTo: avatarView.centerYAnchor), avatarButton.centerYAnchor.constraint(equalTo: avatarView.centerYAnchor),
]) ])
@ -345,8 +345,8 @@ extension MastodonRegisterViewController {
plusIconImageView.translatesAutoresizingMaskIntoConstraints = false plusIconImageView.translatesAutoresizingMaskIntoConstraints = false
avatarView.addSubview(plusIconImageView) avatarView.addSubview(plusIconImageView)
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
plusIconImageView.trailingAnchor.constraint(equalTo: avatarButton.trailingAnchor), plusIconImageView.centerXAnchor.constraint(equalTo: avatarButton.trailingAnchor),
plusIconImageView.bottomAnchor.constraint(equalTo: avatarButton.bottomAnchor), plusIconImageView.centerYAnchor.constraint(equalTo: avatarButton.bottomAnchor),
]) ])
// textfield // textfield

View File

@ -48,7 +48,7 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency
let bottomContainerView: UIView = { let bottomContainerView: UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = Asset.Colors.Background.onboardingBackground.color view.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color
return view return view
}() }()
@ -58,7 +58,7 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency
textView.textColor = .label textView.textColor = .label
textView.isSelectable = true textView.isSelectable = true
textView.isEditable = false textView.isEditable = false
textView.backgroundColor = Asset.Colors.Background.onboardingBackground.color textView.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color
return textView return textView
}() }()
@ -85,10 +85,6 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency
extension MastodonServerRulesViewController { extension MastodonServerRulesViewController {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .darkContent
}
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()