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.",
|
||||
"button": {
|
||||
"open_email_app": "Open Email App",
|
||||
"dont_receive_email": "I never got an email"
|
||||
"resend": "Resend"
|
||||
},
|
||||
"dont_receive_email": {
|
||||
"title": "Check your email",
|
||||
|
|
|
@ -46,21 +46,11 @@ final class MastodonConfirmEmailViewController: UIViewController, NeedsDependenc
|
|||
imageView.contentMode = .scaleAspectFit
|
||||
return imageView
|
||||
}()
|
||||
|
||||
let openEmailButton: UIButton = {
|
||||
let button = PrimaryActionButton()
|
||||
button.setTitle(L10n.Scene.ConfirmEmail.Button.openEmailApp, for: .normal)
|
||||
button.addTarget(self, action: #selector(openEmailButtonPressed(_:)), for: UIControl.Event.touchUpInside)
|
||||
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
|
||||
|
||||
let navigationActionView: NavigationActionView = {
|
||||
let navigationActionView = NavigationActionView()
|
||||
navigationActionView.backgroundColor = Asset.Scene.Onboarding.onboardingBackground.color
|
||||
return navigationActionView
|
||||
}()
|
||||
|
||||
deinit {
|
||||
|
@ -73,6 +63,8 @@ extension MastodonConfirmEmailViewController {
|
|||
|
||||
override func viewDidLoad() {
|
||||
|
||||
navigationItem.leftBarButtonItem = UIBarButtonItem()
|
||||
|
||||
setupOnboardingAppearance()
|
||||
configureTitleLabel()
|
||||
configureMargin()
|
||||
|
@ -83,13 +75,12 @@ extension MastodonConfirmEmailViewController {
|
|||
stackView.spacing = 10
|
||||
stackView.layoutMargins = UIEdgeInsets(top: 10, left: 0, bottom: 23, right: 0)
|
||||
stackView.isLayoutMarginsRelativeArrangement = true
|
||||
stackView.addArrangedSubview(self.largeTitleLabel)
|
||||
stackView.addArrangedSubview(self.subtitleLabel)
|
||||
stackView.addArrangedSubview(self.emailImageView)
|
||||
stackView.addArrangedSubview(largeTitleLabel)
|
||||
stackView.addArrangedSubview(subtitleLabel)
|
||||
stackView.addArrangedSubview(emailImageView)
|
||||
emailImageView.setContentHuggingPriority(.defaultLow, for: .vertical)
|
||||
emailImageView.setContentCompressionResistancePriority(.defaultLow, for: .vertical)
|
||||
stackView.addArrangedSubview(self.openEmailButton)
|
||||
stackView.addArrangedSubview(self.dontReceiveButton)
|
||||
stackView.addArrangedSubview(navigationActionView)
|
||||
|
||||
view.addSubview(stackView)
|
||||
stackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
@ -99,10 +90,7 @@ extension MastodonConfirmEmailViewController {
|
|||
stackView.trailingAnchor.constraint(equalTo: view.layoutMarginsGuide.trailingAnchor),
|
||||
stackView.bottomAnchor.constraint(equalTo: view.readableContentGuide.bottomAnchor),
|
||||
])
|
||||
NSLayoutConstraint.activate([
|
||||
self.openEmailButton.heightAnchor.constraint(equalToConstant: 46),
|
||||
])
|
||||
|
||||
|
||||
self.viewModel.timestampUpdatePublisher
|
||||
.sink { [weak self] _ in
|
||||
guard let self = self else { return }
|
||||
|
@ -140,6 +128,13 @@ extension MastodonConfirmEmailViewController {
|
|||
.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?) {
|
||||
|
@ -190,7 +185,7 @@ extension MastodonConfirmEmailViewController {
|
|||
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 resendAction = UIAlertAction(title: L10n.Scene.ConfirmEmail.DontReceiveEmail.resendEmail, style: .default) { _ in
|
||||
let url = Mastodon.API.resendEmailURL(domain: self.viewModel.authenticateInfo.domain)
|
||||
|
|
|
@ -30,6 +30,34 @@ final class MastodonRegisterAvatarTableViewCell: UITableViewCell {
|
|||
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() {
|
||||
super.prepareForReuse()
|
||||
|
||||
|
@ -72,6 +100,15 @@ extension MastodonRegisterAvatarTableViewCell {
|
|||
avatarButton.trailingAnchor.constraint(equalTo: containerView.trailingAnchor),
|
||||
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()
|
||||
label.font = .preferredFont(forTextStyle: .footnote)
|
||||
label.textColor = Asset.Colors.Label.secondary.color
|
||||
label.text = "Your password needs at least:"
|
||||
label.text = L10n.Scene.Register.Input.Password.hint
|
||||
return label
|
||||
}()
|
||||
|
||||
|
|
|
@ -82,6 +82,8 @@ extension MastodonRegisterViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
navigationItem.leftBarButtonItem = UIBarButtonItem()
|
||||
|
||||
setupOnboardingAppearance()
|
||||
defer {
|
||||
setupNavigationBarBackgroundView()
|
||||
|
@ -128,12 +130,12 @@ extension MastodonRegisterViewController {
|
|||
|
||||
viewModel.setupDiffableDataSource(tableView: tableView)
|
||||
|
||||
KeyboardResponderService
|
||||
.configure(
|
||||
scrollView: tableView,
|
||||
layoutNeedsUpdate: viewModel.viewDidAppear.eraseToAnyPublisher()
|
||||
)
|
||||
.store(in: &disposeBag)
|
||||
// KeyboardResponderService
|
||||
// .configure(
|
||||
// scrollView: tableView,
|
||||
// layoutNeedsUpdate: viewModel.viewDidAppear.eraseToAnyPublisher()
|
||||
// )
|
||||
// .store(in: &disposeBag)
|
||||
|
||||
// gesture
|
||||
view.addGestureRecognizer(tapGestureRecognizer)
|
||||
|
|
Loading…
Reference in New Issue