forked from zelo72/mastodon-ios
feat: update email confirm scene UI
This commit is contained in:
parent
7bf14c0450
commit
548e4cc28f
|
@ -303,7 +303,7 @@
|
||||||
"subtitle": "Tap the link we emailed to you to verify your account.",
|
"subtitle": "Tap the link we emailed to you to verify your account.",
|
||||||
"button": {
|
"button": {
|
||||||
"open_email_app": "Open Email App",
|
"open_email_app": "Open Email App",
|
||||||
"dont_receive_email": "I never got an email"
|
"resend": "Resend"
|
||||||
},
|
},
|
||||||
"dont_receive_email": {
|
"dont_receive_email": {
|
||||||
"title": "Check your email",
|
"title": "Check your email",
|
||||||
|
|
|
@ -46,21 +46,11 @@ final class MastodonConfirmEmailViewController: UIViewController, NeedsDependenc
|
||||||
imageView.contentMode = .scaleAspectFit
|
imageView.contentMode = .scaleAspectFit
|
||||||
return imageView
|
return imageView
|
||||||
}()
|
}()
|
||||||
|
|
||||||
let openEmailButton: UIButton = {
|
let navigationActionView: NavigationActionView = {
|
||||||
let button = PrimaryActionButton()
|
let navigationActionView = NavigationActionView()
|
||||||
button.setTitle(L10n.Scene.ConfirmEmail.Button.openEmailApp, for: .normal)
|
navigationActionView.backgroundColor = Asset.Scene.Onboarding.onboardingBackground.color
|
||||||
button.addTarget(self, action: #selector(openEmailButtonPressed(_:)), for: UIControl.Event.touchUpInside)
|
return navigationActionView
|
||||||
return button
|
|
||||||
}()
|
|
||||||
|
|
||||||
let dontReceiveButton: UIButton = {
|
|
||||||
let button = UIButton(type: .system)
|
|
||||||
button.titleLabel?.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: UIFont.boldSystemFont(ofSize: 15))
|
|
||||||
button.setTitleColor(Asset.Colors.brandBlue.color, for: .normal)
|
|
||||||
button.setTitle(L10n.Scene.ConfirmEmail.Button.dontReceiveEmail, for: .normal)
|
|
||||||
button.addTarget(self, action: #selector(dontReceiveButtonPressed(_:)), for: UIControl.Event.touchUpInside)
|
|
||||||
return button
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
|
@ -73,6 +63,8 @@ extension MastodonConfirmEmailViewController {
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
|
|
||||||
|
navigationItem.leftBarButtonItem = UIBarButtonItem()
|
||||||
|
|
||||||
setupOnboardingAppearance()
|
setupOnboardingAppearance()
|
||||||
configureTitleLabel()
|
configureTitleLabel()
|
||||||
configureMargin()
|
configureMargin()
|
||||||
|
@ -83,13 +75,12 @@ extension MastodonConfirmEmailViewController {
|
||||||
stackView.spacing = 10
|
stackView.spacing = 10
|
||||||
stackView.layoutMargins = UIEdgeInsets(top: 10, left: 0, bottom: 23, right: 0)
|
stackView.layoutMargins = UIEdgeInsets(top: 10, left: 0, bottom: 23, right: 0)
|
||||||
stackView.isLayoutMarginsRelativeArrangement = true
|
stackView.isLayoutMarginsRelativeArrangement = true
|
||||||
stackView.addArrangedSubview(self.largeTitleLabel)
|
stackView.addArrangedSubview(largeTitleLabel)
|
||||||
stackView.addArrangedSubview(self.subtitleLabel)
|
stackView.addArrangedSubview(subtitleLabel)
|
||||||
stackView.addArrangedSubview(self.emailImageView)
|
stackView.addArrangedSubview(emailImageView)
|
||||||
emailImageView.setContentHuggingPriority(.defaultLow, for: .vertical)
|
emailImageView.setContentHuggingPriority(.defaultLow, for: .vertical)
|
||||||
emailImageView.setContentCompressionResistancePriority(.defaultLow, for: .vertical)
|
emailImageView.setContentCompressionResistancePriority(.defaultLow, for: .vertical)
|
||||||
stackView.addArrangedSubview(self.openEmailButton)
|
stackView.addArrangedSubview(navigationActionView)
|
||||||
stackView.addArrangedSubview(self.dontReceiveButton)
|
|
||||||
|
|
||||||
view.addSubview(stackView)
|
view.addSubview(stackView)
|
||||||
stackView.translatesAutoresizingMaskIntoConstraints = false
|
stackView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
@ -99,10 +90,7 @@ extension MastodonConfirmEmailViewController {
|
||||||
stackView.trailingAnchor.constraint(equalTo: view.layoutMarginsGuide.trailingAnchor),
|
stackView.trailingAnchor.constraint(equalTo: view.layoutMarginsGuide.trailingAnchor),
|
||||||
stackView.bottomAnchor.constraint(equalTo: view.readableContentGuide.bottomAnchor),
|
stackView.bottomAnchor.constraint(equalTo: view.readableContentGuide.bottomAnchor),
|
||||||
])
|
])
|
||||||
NSLayoutConstraint.activate([
|
|
||||||
self.openEmailButton.heightAnchor.constraint(equalToConstant: 46),
|
|
||||||
])
|
|
||||||
|
|
||||||
self.viewModel.timestampUpdatePublisher
|
self.viewModel.timestampUpdatePublisher
|
||||||
.sink { [weak self] _ in
|
.sink { [weak self] _ in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
|
@ -140,6 +128,13 @@ extension MastodonConfirmEmailViewController {
|
||||||
.store(in: &self.disposeBag)
|
.store(in: &self.disposeBag)
|
||||||
}
|
}
|
||||||
.store(in: &self.disposeBag)
|
.store(in: &self.disposeBag)
|
||||||
|
|
||||||
|
|
||||||
|
navigationActionView.backButton.setTitle("Resend", for: .normal) // TODO: i18n
|
||||||
|
navigationActionView.backButton.addTarget(self, action: #selector(MastodonConfirmEmailViewController.resendButtonPressed(_:)), for: .touchUpInside)
|
||||||
|
|
||||||
|
navigationActionView.nextButton.setTitle(L10n.Scene.ConfirmEmail.Button.openEmailApp, for: .normal)
|
||||||
|
navigationActionView.nextButton.addTarget(self, action: #selector(MastodonConfirmEmailViewController.openEmailButtonPressed(_:)), for: .touchUpInside)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
|
||||||
|
@ -190,7 +185,7 @@ extension MastodonConfirmEmailViewController {
|
||||||
self.coordinator.present(scene: .alertController(alertController: alertController), from: self, transition: .alertController(animated: true, completion: nil))
|
self.coordinator.present(scene: .alertController(alertController: alertController), from: self, transition: .alertController(animated: true, completion: nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func dontReceiveButtonPressed(_ sender: UIButton) {
|
@objc private func resendButtonPressed(_ sender: UIButton) {
|
||||||
let alertController = UIAlertController(title: L10n.Scene.ConfirmEmail.DontReceiveEmail.title, message: L10n.Scene.ConfirmEmail.DontReceiveEmail.description, preferredStyle: .alert)
|
let alertController = UIAlertController(title: L10n.Scene.ConfirmEmail.DontReceiveEmail.title, message: L10n.Scene.ConfirmEmail.DontReceiveEmail.description, preferredStyle: .alert)
|
||||||
let resendAction = UIAlertAction(title: L10n.Scene.ConfirmEmail.DontReceiveEmail.resendEmail, style: .default) { _ in
|
let resendAction = UIAlertAction(title: L10n.Scene.ConfirmEmail.DontReceiveEmail.resendEmail, style: .default) { _ in
|
||||||
let url = Mastodon.API.resendEmailURL(domain: self.viewModel.authenticateInfo.domain)
|
let url = Mastodon.API.resendEmailURL(domain: self.viewModel.authenticateInfo.domain)
|
||||||
|
|
|
@ -30,6 +30,34 @@ final class MastodonRegisterAvatarTableViewCell: UITableViewCell {
|
||||||
return button
|
return button
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
let editBannerView: UIView = {
|
||||||
|
let bannerView = UIView()
|
||||||
|
bannerView.backgroundColor = UIColor.black.withAlphaComponent(0.5)
|
||||||
|
bannerView.isUserInteractionEnabled = false
|
||||||
|
|
||||||
|
let label: UILabel = {
|
||||||
|
let label = UILabel()
|
||||||
|
label.textColor = .white
|
||||||
|
label.text = L10n.Common.Controls.Actions.edit
|
||||||
|
label.font = .systemFont(ofSize: 13, weight: .semibold)
|
||||||
|
label.textAlignment = .center
|
||||||
|
label.minimumScaleFactor = 0.5
|
||||||
|
label.adjustsFontSizeToFitWidth = true
|
||||||
|
return label
|
||||||
|
}()
|
||||||
|
|
||||||
|
label.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
bannerView.addSubview(label)
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
label.topAnchor.constraint(equalTo: bannerView.topAnchor),
|
||||||
|
label.leadingAnchor.constraint(equalTo: bannerView.leadingAnchor),
|
||||||
|
label.trailingAnchor.constraint(equalTo: bannerView.trailingAnchor),
|
||||||
|
label.bottomAnchor.constraint(equalTo: bannerView.bottomAnchor),
|
||||||
|
])
|
||||||
|
|
||||||
|
return bannerView
|
||||||
|
}()
|
||||||
|
|
||||||
override func prepareForReuse() {
|
override func prepareForReuse() {
|
||||||
super.prepareForReuse()
|
super.prepareForReuse()
|
||||||
|
|
||||||
|
@ -72,6 +100,15 @@ extension MastodonRegisterAvatarTableViewCell {
|
||||||
avatarButton.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
|
avatarButton.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
|
||||||
avatarButton.bottomAnchor.constraint(equalTo: containerView.bottomAnchor),
|
avatarButton.bottomAnchor.constraint(equalTo: containerView.bottomAnchor),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
editBannerView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
containerView.addSubview(editBannerView)
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
editBannerView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor),
|
||||||
|
editBannerView.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
|
||||||
|
editBannerView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor),
|
||||||
|
editBannerView.heightAnchor.constraint(equalToConstant: 22),
|
||||||
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ final class MastodonRegisterPasswordHintTableViewCell: UITableViewCell {
|
||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
label.font = .preferredFont(forTextStyle: .footnote)
|
label.font = .preferredFont(forTextStyle: .footnote)
|
||||||
label.textColor = Asset.Colors.Label.secondary.color
|
label.textColor = Asset.Colors.Label.secondary.color
|
||||||
label.text = "Your password needs at least:"
|
label.text = L10n.Scene.Register.Input.Password.hint
|
||||||
return label
|
return label
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,8 @@ extension MastodonRegisterViewController {
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
|
navigationItem.leftBarButtonItem = UIBarButtonItem()
|
||||||
|
|
||||||
setupOnboardingAppearance()
|
setupOnboardingAppearance()
|
||||||
defer {
|
defer {
|
||||||
setupNavigationBarBackgroundView()
|
setupNavigationBarBackgroundView()
|
||||||
|
@ -128,12 +130,12 @@ extension MastodonRegisterViewController {
|
||||||
|
|
||||||
viewModel.setupDiffableDataSource(tableView: tableView)
|
viewModel.setupDiffableDataSource(tableView: tableView)
|
||||||
|
|
||||||
KeyboardResponderService
|
// KeyboardResponderService
|
||||||
.configure(
|
// .configure(
|
||||||
scrollView: tableView,
|
// scrollView: tableView,
|
||||||
layoutNeedsUpdate: viewModel.viewDidAppear.eraseToAnyPublisher()
|
// layoutNeedsUpdate: viewModel.viewDidAppear.eraseToAnyPublisher()
|
||||||
)
|
// )
|
||||||
.store(in: &disposeBag)
|
// .store(in: &disposeBag)
|
||||||
|
|
||||||
// gesture
|
// gesture
|
||||||
view.addGestureRecognizer(tapGestureRecognizer)
|
view.addGestureRecognizer(tapGestureRecognizer)
|
||||||
|
|
Loading…
Reference in New Issue