chore: add cancel action to alert

This commit is contained in:
sunxiaojian 2021-02-24 10:49:50 +08:00
parent f5621991d8
commit 36e5fa3950
3 changed files with 16 additions and 11 deletions

View File

@ -83,15 +83,17 @@ internal enum L10n {
}
internal enum DontReceiveEmail {
/// Give our servers another n seconds before sending another email.\n\nCheck if your email address is correct as well as your junk folder if you havent.
internal static let alertDescription = L10n.tr("Localizable", "Scene.ConfirmEmail.DontReceiveEmail.alertDescription")
internal static let alertDescription = L10n.tr("Localizable", "Scene.ConfirmEmail.DontReceiveEmail.AlertDescription")
/// Its too soon to tell.
internal static let alertTitle = L10n.tr("Localizable", "Scene.ConfirmEmail.DontReceiveEmail.alertTitle")
internal static let alertTitle = L10n.tr("Localizable", "Scene.ConfirmEmail.DontReceiveEmail.AlertTitle")
}
internal enum OpenEmailApp {
/// We just sent you another email. Check your junk folder if you havent.
internal static let alertDescription = L10n.tr("Localizable", "Scene.ConfirmEmail.OpenEmailApp.alertDescription")
internal static let alertDescription = L10n.tr("Localizable", "Scene.ConfirmEmail.OpenEmailApp.AlertDescription")
/// Check your inbox.
internal static let alertTitle = L10n.tr("Localizable", "Scene.ConfirmEmail.OpenEmailApp.alertTitle")
internal static let alertTitle = L10n.tr("Localizable", "Scene.ConfirmEmail.OpenEmailApp.AlertTitle")
/// Mail
internal static let mail = L10n.tr("Localizable", "Scene.ConfirmEmail.OpenEmailApp.Mail")
}
}
internal enum HomeTimeline {

View File

@ -48,11 +48,12 @@ tap the link to confirm your account.";
"Scene.ConfirmEmail.Button.DontReceiveEmail" = "I never got an email";
"Scene.ConfirmEmail.DontReceiveEmail.alertTitle" = "Its too soon to tell.";
"Scene.ConfirmEmail.DontReceiveEmail.alertDescription" = "Give our servers another n seconds before sending another email.
"Scene.ConfirmEmail.DontReceiveEmail.AlertTitle" = "Its too soon to tell.";
"Scene.ConfirmEmail.DontReceiveEmail.AlertDescription" = "Give our servers another n seconds before sending another email.
Check if your email address is correct as well as your junk folder if you havent.";
"Scene.ConfirmEmail.OpenEmailApp.alertTitle" = "Check your inbox.";
"Scene.ConfirmEmail.OpenEmailApp.alertDescription" = "We just sent you another email. Check your junk folder if you havent.";
"Scene.ConfirmEmail.OpenEmailApp.AlertTitle" = "Check your inbox.";
"Scene.ConfirmEmail.OpenEmailApp.AlertDescription" = "We just sent you another email. Check your junk folder if you havent.";
"Scene.ConfirmEmail.OpenEmailApp.Mail" = "Mail";

View File

@ -108,7 +108,7 @@ extension MastodonConfirmEmailViewController {
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))
}
@ -125,8 +125,9 @@ extension MastodonConfirmEmailViewController {
let avaliableClients = clients.filter { client -> Bool in
ThirdPartyMailer.application(application, isMailClientAvailable: client)
}
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
let alertAction = UIAlertAction(title: "Mail", style: .default) { _ in
let alertController = UIAlertController(title: nil, 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)
@ -140,5 +141,6 @@ extension MastodonConfirmEmailViewController {
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))
}
}