diff --git a/Localization/app.json b/Localization/app.json index eda508e48..1f5ccade3 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -146,7 +146,7 @@ "title": "Tell us about you.", "input": { "avatar": { - "delete": "delete" + "delete": "Delete" }, "username": { "placeholder": "username", diff --git a/Mastodon/Diffiable/Section/CategoryPickerSection.swift b/Mastodon/Diffiable/Section/CategoryPickerSection.swift index 456d193f3..938683f99 100644 --- a/Mastodon/Diffiable/Section/CategoryPickerSection.swift +++ b/Mastodon/Diffiable/Section/CategoryPickerSection.swift @@ -34,7 +34,7 @@ extension CategoryPickerSection { cell.categoryView.titleLabel.textColor = .white } } else { - cell.categoryView.bgView.backgroundColor = Asset.Colors.Background.systemBackground.color + cell.categoryView.bgView.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color cell.categoryView.bgView.applyShadow(color: Asset.Colors.brandBlue.color, alpha: 0, x: 0, y: 0, blur: 0.0) if case .all = item { cell.categoryView.titleLabel.textColor = Asset.Colors.brandBlue.color diff --git a/Mastodon/Generated/Assets.swift b/Mastodon/Generated/Assets.swift index 35111dde1..7f37f671b 100644 --- a/Mastodon/Generated/Assets.swift +++ b/Mastodon/Generated/Assets.swift @@ -23,6 +23,7 @@ internal typealias AssetImageTypeAlias = ImageAsset.Image internal enum Asset { internal static let accentColor = ColorAsset(name: "AccentColor") internal enum Asset { + internal static let email = ImageAsset(name: "Asset/email") internal static let mastodonTextLogo = ImageAsset(name: "Asset/mastodon.text.logo") } internal enum Circles { @@ -62,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 { @@ -83,6 +83,7 @@ internal enum Asset { internal static let bar = ColorAsset(name: "Colors/Slider/bar") } internal enum TextField { + internal static let background = ColorAsset(name: "Colors/TextField/background") internal static let highlight = ColorAsset(name: "Colors/TextField/highlight") internal static let invalid = ColorAsset(name: "Colors/TextField/invalid") internal static let valid = ColorAsset(name: "Colors/TextField/valid") diff --git a/Mastodon/Generated/Strings.swift b/Mastodon/Generated/Strings.swift index 776d69d50..6d7af089d 100644 --- a/Mastodon/Generated/Strings.swift +++ b/Mastodon/Generated/Strings.swift @@ -502,7 +502,7 @@ internal enum L10n { } internal enum Input { internal enum Avatar { - /// delete + /// Delete internal static let delete = L10n.tr("Localizable", "Scene.Register.Input.Avatar.Delete") } internal enum DisplayName { diff --git a/Mastodon/Resources/Assets.xcassets/Asset/email.imageset/Contents.json b/Mastodon/Resources/Assets.xcassets/Asset/email.imageset/Contents.json new file mode 100644 index 000000000..3febbcacb --- /dev/null +++ b/Mastodon/Resources/Assets.xcassets/Asset/email.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "filename" : "c1.svg", + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "filename" : "c1-1.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Mastodon/Resources/Assets.xcassets/Asset/email.imageset/c1-1.svg b/Mastodon/Resources/Assets.xcassets/Asset/email.imageset/c1-1.svg new file mode 100644 index 000000000..a316721b0 --- /dev/null +++ b/Mastodon/Resources/Assets.xcassets/Asset/email.imageset/c1-1.svg @@ -0,0 +1,342 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Mastodon/Resources/Assets.xcassets/Asset/email.imageset/c1.svg b/Mastodon/Resources/Assets.xcassets/Asset/email.imageset/c1.svg new file mode 100644 index 000000000..ce59284c0 --- /dev/null +++ b/Mastodon/Resources/Assets.xcassets/Asset/email.imageset/c1.svg @@ -0,0 +1,342 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 d4f558bfd..000000000 --- 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/Resources/Assets.xcassets/Colors/TextField/background.colorset/Contents.json b/Mastodon/Resources/Assets.xcassets/Colors/TextField/background.colorset/Contents.json new file mode 100644 index 000000000..cde0cdf00 --- /dev/null +++ b/Mastodon/Resources/Assets.xcassets/Colors/TextField/background.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "0.600", + "blue" : "213", + "green" : "212", + "red" : "212" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "0.240", + "blue" : "128", + "green" : "118", + "red" : "118" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Mastodon/Resources/en.lproj/Localizable.strings b/Mastodon/Resources/en.lproj/Localizable.strings index 5d27c43b1..ce7a3a2fe 100644 --- a/Mastodon/Resources/en.lproj/Localizable.strings +++ b/Mastodon/Resources/en.lproj/Localizable.strings @@ -162,7 +162,7 @@ tap the link to confirm your account."; "Scene.Register.Error.Special.PasswordTooShort" = "Password is too short (must be at least 8 characters)"; "Scene.Register.Error.Special.UsernameInvalid" = "Username must only contain alphanumeric characters and underscores"; "Scene.Register.Error.Special.UsernameTooLong" = "Username is too long (can't be longer than 30 characters)"; -"Scene.Register.Input.Avatar.Delete" = "delete"; +"Scene.Register.Input.Avatar.Delete" = "Delete"; "Scene.Register.Input.DisplayName.Placeholder" = "display name"; "Scene.Register.Input.Email.Placeholder" = "email"; "Scene.Register.Input.Invite.RegistrationUserInviteRequest" = "Why do you want to join?"; diff --git a/Mastodon/Resources/en.lproj/infoPlist.strings b/Mastodon/Resources/en.lproj/infoPlist.strings new file mode 100644 index 000000000..48566ae36 --- /dev/null +++ b/Mastodon/Resources/en.lproj/infoPlist.strings @@ -0,0 +1,2 @@ +"NSCameraUsageDescription" = "Used to take photo for post status"; +"NSPhotoLibraryAddUsageDescription" = "Used to save photo into the Photo Library"; \ No newline at end of file diff --git a/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift b/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift index 9d15c8476..54994cb1f 100644 --- a/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift +++ b/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift @@ -36,6 +36,13 @@ final class MastodonConfirmEmailViewController: UIViewController, NeedsDependenc label.numberOfLines = 0 return label }() + + let emailImageView: UIImageView = { + let imageView = UIImageView() + imageView.image = Asset.Asset.email.image + imageView.contentMode = .scaleAspectFit + return imageView + }() let openEmailButton: UIButton = { let button = UIButton(type: .system) @@ -66,19 +73,10 @@ final class MastodonConfirmEmailViewController: UIViewController, NeedsDependenc } extension MastodonConfirmEmailViewController { - - override var preferredStatusBarStyle: UIStatusBarStyle { - return .darkContent - } override func viewDidLoad() { setupOnboardingAppearance() - - // resizedView - let resizedView = UIView() - resizedView.translatesAutoresizingMaskIntoConstraints = false - resizedView.setContentHuggingPriority(.defaultLow, for: .vertical) // stackView let stackView = UIStackView() @@ -89,7 +87,9 @@ extension MastodonConfirmEmailViewController { stackView.isLayoutMarginsRelativeArrangement = true stackView.addArrangedSubview(self.largeTitleLabel) stackView.addArrangedSubview(self.subtitleLabel) - stackView.addArrangedSubview(resizedView) + stackView.addArrangedSubview(self.emailImageView) + emailImageView.setContentHuggingPriority(.defaultLow, for: .vertical) + emailImageView.setContentCompressionResistancePriority(.defaultLow, for: .vertical) stackView.addArrangedSubview(self.openEmailButton) stackView.addArrangedSubview(self.dontReceiveButton) @@ -200,3 +200,27 @@ extension MastodonConfirmEmailViewController { // MARK: - OnboardingViewControllerAppearance extension MastodonConfirmEmailViewController: OnboardingViewControllerAppearance { } + +#if canImport(SwiftUI) && DEBUG +import SwiftUI + +struct MastodonConfirmEmailViewController_Previews: PreviewProvider { + + static var controls: some View { + UIViewControllerPreview { + let viewController = MastodonConfirmEmailViewController() + return viewController + } + .previewLayout(.fixed(width: 375, height: 800)) + } + + static var previews: some View { + Group { + controls.colorScheme(.light) + controls.colorScheme(.dark) + } + } + +} + +#endif diff --git a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift index 241a597c1..685709719 100644 --- a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift +++ b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift @@ -22,7 +22,6 @@ final class MastodonPickServerViewController: UIViewController, NeedsDependency private var expandServerDomainSet = Set() private let emptyStateView = PickServerEmptyStateView() - private let emptyStateViewHPadding: CGFloat = 4 // UIView's readableContentGuide is 4pt smaller then UITableViewCell's let tableViewTopPaddingView = UIView() // fix empty state view background display when tableView bounce scrolling var tableViewTopPaddingViewHeightLayoutConstraint: NSLayoutConstraint! @@ -57,9 +56,6 @@ final class MastodonPickServerViewController: UIViewController, NeedsDependency extension MastodonPickServerViewController { - override var preferredStatusBarStyle: UIStatusBarStyle { - return .darkContent - } override func viewDidLoad() { super.viewDidLoad() @@ -85,15 +81,6 @@ extension MastodonPickServerViewController { nextStepButton.heightAnchor.constraint(equalToConstant: MastodonPickServerViewController.actionButtonHeight).priority(.defaultHigh), view.layoutMarginsGuide.bottomAnchor.constraint(equalTo: nextStepButton.bottomAnchor, constant: WelcomeViewController.viewBottomPaddingHeight), ]) - - emptyStateView.translatesAutoresizingMaskIntoConstraints = false - view.addSubview(emptyStateView) - NSLayoutConstraint.activate([ - emptyStateView.topAnchor.constraint(equalTo: view.topAnchor), - emptyStateView.leadingAnchor.constraint(equalTo: view.readableContentGuide.leadingAnchor, constant: emptyStateViewHPadding), - emptyStateView.trailingAnchor.constraint(equalTo: view.readableContentGuide.trailingAnchor, constant: -emptyStateViewHPadding), - nextStepButton.topAnchor.constraint(equalTo: emptyStateView.bottomAnchor, constant: 21), - ]) // fix AutoLayout warning when observe before view appear viewModel.viewWillAppear @@ -126,6 +113,16 @@ extension MastodonPickServerViewController { nextStepButton.topAnchor.constraint(equalTo: tableView.bottomAnchor, constant: 7), ]) + emptyStateView.translatesAutoresizingMaskIntoConstraints = false + view.addSubview(emptyStateView) + NSLayoutConstraint.activate([ + emptyStateView.topAnchor.constraint(equalTo: view.topAnchor), + emptyStateView.leadingAnchor.constraint(equalTo: tableView.readableContentGuide.leadingAnchor), + emptyStateView.trailingAnchor.constraint(equalTo: tableView.readableContentGuide.trailingAnchor), + nextStepButton.topAnchor.constraint(equalTo: emptyStateView.bottomAnchor, constant: 21), + ]) + view.sendSubviewToBack(emptyStateView) + switch viewModel.mode { case .signIn: nextStepButton.setTitle(L10n.Common.Controls.Actions.signIn, for: .normal) diff --git a/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift b/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift index bf2299122..9313aa5cc 100644 --- a/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift +++ b/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift @@ -27,7 +27,7 @@ class PickServerCell: UITableViewCell { let containerView: UIView = { let view = UIView() view.layoutMargins = UIEdgeInsets(top: 16, left: 16, bottom: 10, right: 16) - view.backgroundColor = Asset.Colors.Background.systemBackground.color + view.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color view.translatesAutoresizingMaskIntoConstraints = false return view }() diff --git a/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerSearchCell.swift b/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerSearchCell.swift index b708313ac..fb1be2aad 100644 --- a/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerSearchCell.swift +++ b/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerSearchCell.swift @@ -17,7 +17,7 @@ class PickServerSearchCell: UITableViewCell { private var bgView: UIView = { let view = UIView() - view.backgroundColor = Asset.Colors.Background.systemBackground.color + view.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color view.translatesAutoresizingMaskIntoConstraints = false view.layer.maskedCorners = [ .layerMinXMinYCorner, @@ -30,7 +30,7 @@ class PickServerSearchCell: UITableViewCell { private var textFieldBgView: UIView = { let view = UIView() - view.backgroundColor = Asset.Colors.Background.secondarySystemBackground.color.withAlphaComponent(0.6) + view.backgroundColor = Asset.Colors.TextField.background.color view.translatesAutoresizingMaskIntoConstraints = false view.layer.masksToBounds = true view.layer.cornerRadius = 6 diff --git a/Mastodon/Scene/Onboarding/PickServer/View/PickServerCategoryView.swift b/Mastodon/Scene/Onboarding/PickServer/View/PickServerCategoryView.swift index 16d5a9fcc..fd1a3ea6d 100644 --- a/Mastodon/Scene/Onboarding/PickServer/View/PickServerCategoryView.swift +++ b/Mastodon/Scene/Onboarding/PickServer/View/PickServerCategoryView.swift @@ -48,7 +48,7 @@ extension PickServerCategoryView { addSubview(bgView) addSubview(titleLabel) - bgView.backgroundColor = Asset.Colors.Background.systemBackground.color + bgView.backgroundColor = Asset.Colors.Background.secondaryGroupedSystemBackground.color NSLayoutConstraint.activate([ bgView.leadingAnchor.constraint(equalTo: self.leadingAnchor), diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController+Avatar.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController+Avatar.swift index b6ba6a8af..b1fa1b432 100644 --- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController+Avatar.swift +++ b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController+Avatar.swift @@ -32,7 +32,7 @@ extension MastodonRegisterViewController { } children.append(browseAction) if self.viewModel.avatarImage.value != nil { - let deleteAction = UIAction(title: L10n.Scene.Register.Input.Avatar.delete, image: UIImage(systemName: "delete.left"), identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off) { [weak self] _ in + let deleteAction = UIAction(title: L10n.Scene.Register.Input.Avatar.delete, image: UIImage(systemName: "delete.left"), identifier: nil, discoverabilityTitle: nil, attributes: [.destructive], state: .off) { [weak self] _ in guard let self = self else { return } self.viewModel.avatarImage.value = nil } diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift index 2187ad52b..007012d3c 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, @@ -238,10 +238,6 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O extension MastodonRegisterViewController { - override var preferredStatusBarStyle: UIStatusBarStyle { - return .darkContent - } - override func viewDidLoad() { super.viewDidLoad() @@ -336,8 +332,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 +341,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 @@ -360,6 +356,14 @@ extension MastodonRegisterViewController { // password stackView.setCustomSpacing(6, after: passwordTextField) stackView.setCustomSpacing(32, after: passwordCheckLabel) + + //return + if viewModel.approvalRequired { + passwordTextField.returnKeyType = .continue + } else { + passwordTextField.returnKeyType = .done + } + reasonTextField.returnKeyType = .done // button stackView.addArrangedSubview(buttonContainer) @@ -619,6 +623,28 @@ extension MastodonRegisterViewController: UITextFieldDelegate { } } + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + switch textField { + case usernameTextField: + displayNameTextField.becomeFirstResponder() + case displayNameTextField: + emailTextField.becomeFirstResponder() + case emailTextField: + passwordTextField.becomeFirstResponder() + case passwordTextField: + if viewModel.approvalRequired { + reasonTextField.becomeFirstResponder() + } else { + passwordTextField.resignFirstResponder() + } + case reasonTextField: + reasonTextField.resignFirstResponder() + default: + break + } + return true + } + func showShadowWithColor(color: UIColor, textField: UITextField) { // To apply Shadow textField.layer.shadowOpacity = 1 diff --git a/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewController.swift b/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewController.swift index d97209317..1d3a29cb5 100644 --- a/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewController.swift +++ b/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewController.swift @@ -41,13 +41,9 @@ final class MastodonResendEmailViewController: UIViewController, NeedsDependency extension MastodonResendEmailViewController { - override var preferredStatusBarStyle: UIStatusBarStyle { - return .darkContent - } - override func viewDidLoad() { super.viewDidLoad() - + setupOnboardingAppearance() navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(MastodonResendEmailViewController.cancelBarButtonItemPressed(_:))) webView.translatesAutoresizingMaskIntoConstraints = false @@ -72,3 +68,6 @@ extension MastodonResendEmailViewController { dismiss(animated: true, completion: nil) } } + +// MARK: - OnboardingViewControllerAppearance +extension MastodonResendEmailViewController: OnboardingViewControllerAppearance { } diff --git a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift index b51d66b2b..fb86e81e1 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,8 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency textView.textColor = .label textView.isSelectable = true textView.isEditable = false - textView.backgroundColor = Asset.Colors.Background.onboardingBackground.color + textView.isScrollEnabled = false + textView.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color return textView }() @@ -85,10 +86,6 @@ final class MastodonServerRulesViewController: UIViewController, NeedsDependency extension MastodonServerRulesViewController { - override var preferredStatusBarStyle: UIStatusBarStyle { - return .darkContent - } - override func viewDidLoad() { super.viewDidLoad() @@ -124,7 +121,6 @@ extension MastodonServerRulesViewController { bottomPromptTextView.frameLayoutGuide.topAnchor.constraint(equalTo: bottomContainerView.topAnchor, constant: 20), bottomPromptTextView.frameLayoutGuide.leadingAnchor.constraint(equalTo: bottomContainerView.readableContentGuide.leadingAnchor), bottomPromptTextView.frameLayoutGuide.trailingAnchor.constraint(equalTo: bottomContainerView.readableContentGuide.trailingAnchor), - bottomPromptTextView.frameLayoutGuide.heightAnchor.constraint(equalToConstant: 50), confirmButton.topAnchor.constraint(equalTo: bottomPromptTextView.frameLayoutGuide.bottomAnchor, constant: 20), ]) diff --git a/Mastodon/Scene/Onboarding/Share/OnboardingViewControllerAppearance.swift b/Mastodon/Scene/Onboarding/Share/OnboardingViewControllerAppearance.swift index c4b26321a..0784b51ea 100644 --- a/Mastodon/Scene/Onboarding/Share/OnboardingViewControllerAppearance.swift +++ b/Mastodon/Scene/Onboarding/Share/OnboardingViewControllerAppearance.swift @@ -20,8 +20,7 @@ extension OnboardingViewControllerAppearance { static var viewBottomPaddingHeight: CGFloat { return 11 } func setupOnboardingAppearance() { - overrideUserInterfaceStyle = .light - view.backgroundColor = Asset.Colors.Background.onboardingBackground.color + view.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color setupNavigationBarAppearance() @@ -43,7 +42,7 @@ extension OnboardingViewControllerAppearance { func setupNavigationBarBackgroundView() { let navigationBarBackgroundView: UIView = { let view = UIView() - view.backgroundColor = Asset.Colors.Background.onboardingBackground.color + view.backgroundColor = Asset.Colors.Background.systemGroupedBackground.color return view }() diff --git a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift index de89cd457..3654c9f08 100644 --- a/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift +++ b/Mastodon/Scene/Onboarding/Welcome/WelcomeViewController.swift @@ -64,10 +64,6 @@ final class WelcomeViewController: UIViewController, NeedsDependency { extension WelcomeViewController { - override var preferredStatusBarStyle: UIStatusBarStyle { - return .darkContent - } - override func viewDidLoad() { super.viewDidLoad() diff --git a/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift b/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift index aa36fd237..8fefc06c8 100644 --- a/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift +++ b/Mastodon/Scene/Share/View/Button/PrimaryActionButton.swift @@ -38,9 +38,8 @@ extension PrimaryActionButton { private func _init() { titleLabel?.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold)) setTitleColor(.white, for: .normal) - setBackgroundImage(UIImage.placeholder(color: Asset.Colors.Button.normal.color), for: .normal) - 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) + setBackgroundImage(UIImage.placeholder(color: Asset.Colors.brandBlue.color), for: .normal) + setupButtonBackground() applyCornerRadius(radius: 10) } @@ -68,4 +67,21 @@ extension PrimaryActionButton { isEnabled = true 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) + } + } }