Merge pull request #190 from tootsuite/fix/open-email

Fix open email wrong path and redirect missing issue
This commit is contained in:
CMK 2021-07-01 11:50:40 +08:00 committed by GitHub
commit 205cc39af3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 5 deletions

View File

@ -12,7 +12,7 @@
<key>CoreDataStack.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>27</integer>
<integer>21</integer>
</dict>
<key>Mastodon - ASDK.xcscheme_^#shared#^_</key>
<dict>
@ -37,7 +37,7 @@
<key>NotificationService.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>26</integer>
<integer>20</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>

View File

@ -2,6 +2,17 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>mastodon</string>
</array>
<key>CFBundleURLName</key>
<string>org.joinmastodon.app</string>
</dict>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>

View File

@ -171,7 +171,7 @@ extension MastodonConfirmEmailViewController {
func showEmailAppAlert() {
let clients = ThirdPartyMailClient.clients()
let application = UIApplication.shared
let avaliableClients = clients.filter { client -> Bool in
let availableClients = clients.filter { client -> Bool in
ThirdPartyMailer.application(application, isMailClientAvailable: client)
}
let alertController = UIAlertController(title: L10n.Scene.ConfirmEmail.OpenEmailApp.openEmailClient, message: nil, preferredStyle: .alert)
@ -180,9 +180,9 @@ extension MastodonConfirmEmailViewController {
UIApplication.shared.open(URL(string: "message://")!, options: [:], completionHandler: nil)
}
alertController.addAction(alertAction)
_ = avaliableClients.compactMap { client -> UIAlertAction in
_ = availableClients.compactMap { client -> UIAlertAction in
let alertAction = UIAlertAction(title: client.name, style: .default) { _ in
_ = ThirdPartyMailer.application(application, openMailClient: client, recipient: nil, subject: nil, body: nil)
_ = ThirdPartyMailer.application(application, openMailClient: client)
}
alertController.addAction(alertAction)
return alertAction

View File

@ -56,6 +56,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return true
}
}
extension AppDelegate {