From 2be1cabca7fd521542ec71348e1c51f9db5820ca Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Wed, 28 Dec 2022 15:53:06 +0100 Subject: [PATCH] Remove navigation-view on email-confirmation (#690) --- Localization/app.json | 1 - .../MastodonConfirmEmailViewController.swift | 51 ------------------- .../Resources/Base.lproj/Localizable.strings | 1 - 3 files changed, 53 deletions(-) diff --git a/Localization/app.json b/Localization/app.json index 8d4f1b592..5ebc02a8e 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -396,7 +396,6 @@ "title": "Check Your Inbox", "tap_the_link_we_emailed_to_you_to_verify_your_account": "Tap the link we sent you to verify %@. We’ll wait right here.", "button": { - "open_email_app": "Open Email App", "resend": "Resend" }, "dont_receive_email": { diff --git a/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift b/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift index 561d98310..40d8bd04e 100644 --- a/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift +++ b/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift @@ -41,13 +41,6 @@ final class MastodonConfirmEmailViewController: UIViewController, NeedsDependenc imageView.contentMode = .scaleAspectFit return imageView }() - - let navigationActionView: NavigationActionView = { - let navigationActionView = NavigationActionView() - navigationActionView.backgroundColor = Asset.Scene.Onboarding.background.color - return navigationActionView - }() - } extension MastodonConfirmEmailViewController { @@ -69,7 +62,6 @@ extension MastodonConfirmEmailViewController { stackView.addArrangedSubview(emailImageView) emailImageView.setContentHuggingPriority(.defaultLow, for: .vertical) emailImageView.setContentCompressionResistancePriority(.defaultLow, for: .vertical) - stackView.addArrangedSubview(navigationActionView) view.addSubview(stackView) stackView.translatesAutoresizingMaskIntoConstraints = false @@ -121,13 +113,6 @@ extension MastodonConfirmEmailViewController { } .store(in: &self.disposeBag) - - navigationActionView.backButton.setTitle(L10n.Scene.ConfirmEmail.Button.resend, for: .normal) - 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) - title = L10n.Scene.ConfirmEmail.title } @@ -152,19 +137,6 @@ extension MastodonConfirmEmailViewController { } extension MastodonConfirmEmailViewController { - @objc private func openEmailButtonPressed(_ sender: UIButton) { - let alertController = UIAlertController(title: L10n.Scene.ConfirmEmail.OpenEmailApp.title, message: L10n.Scene.ConfirmEmail.OpenEmailApp.description, preferredStyle: .alert) - let openEmailAction = UIAlertAction(title: L10n.Scene.ConfirmEmail.Button.openEmailApp, style: .default) { [weak self] _ in - guard let self = self else { return } - self.showEmailAppAlert() - } - let cancelAction = UIAlertAction(title: L10n.Common.Controls.Actions.cancel, style: .cancel, handler: nil) - alertController.addAction(openEmailAction) - alertController.addAction(cancelAction) - alertController.preferredAction = openEmailAction - _ = self.coordinator.present(scene: .alertController(alertController: alertController), from: self, transition: .alertController(animated: true, completion: nil)) - } - @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 @@ -178,29 +150,6 @@ extension MastodonConfirmEmailViewController { alertController.addAction(okAction) _ = self.coordinator.present(scene: .alertController(alertController: alertController), from: self, transition: .alertController(animated: true, completion: nil)) } - - func showEmailAppAlert() { - let clients = ThirdPartyMailClient.clients - let availableClients = clients.filter { client -> Bool in - ThirdPartyMailer.isMailClientAvailable(client) - } - let alertController = UIAlertController(title: L10n.Scene.ConfirmEmail.OpenEmailApp.openEmailClient, message: nil, preferredStyle: .alert) - - let alertAction = UIAlertAction(title: L10n.Scene.ConfirmEmail.OpenEmailApp.mail, style: .default) { _ in - UIApplication.shared.open(URL(string: "message://")!, options: [:], completionHandler: nil) - } - alertController.addAction(alertAction) - _ = availableClients.compactMap { client -> UIAlertAction in - let alertAction = UIAlertAction(title: client.name, style: .default) { _ in - ThirdPartyMailer.open(client, completionHandler: nil) - } - alertController.addAction(alertAction) - return alertAction - } - let cancelAction = UIAlertAction(title: L10n.Common.Controls.Actions.cancel, style: .cancel, handler: nil) - alertController.addAction(cancelAction) - _ = self.coordinator.present(scene: .alertController(alertController: alertController), from: self, transition: .alertController(animated: true, completion: nil)) - } } // MARK: - PanPopableViewController diff --git a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings index 220de5807..a858ac7d4 100644 --- a/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings +++ b/MastodonSDK/Sources/MastodonLocalization/Resources/Base.lproj/Localizable.strings @@ -224,7 +224,6 @@ uploaded to Mastodon."; "Scene.Compose.Visibility.Private" = "Followers only"; "Scene.Compose.Visibility.Public" = "Public"; "Scene.Compose.Visibility.Unlisted" = "Unlisted"; -"Scene.ConfirmEmail.Button.OpenEmailApp" = "Open Email App"; "Scene.ConfirmEmail.Button.Resend" = "Resend"; "Scene.ConfirmEmail.DontReceiveEmail.Description" = "Check if your email address is correct as well as your junk folder if you haven’t."; "Scene.ConfirmEmail.DontReceiveEmail.ResendEmail" = "Resend Email";