From 85e39115e72449930b462f5d49f474758a80774b Mon Sep 17 00:00:00 2001 From: CMK Date: Thu, 1 Jul 2021 11:49:30 +0800 Subject: [PATCH] fix: open email wrong path and redirect missing issue --- .../xcschemes/xcschememanagement.plist | 4 ++-- Mastodon/Info.plist | 11 +++++++++++ .../MastodonConfirmEmailViewController.swift | 6 +++--- Mastodon/Supporting Files/AppDelegate.swift | 4 ++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist index 7b70d1af..da1d80e9 100644 --- a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist @@ -12,7 +12,7 @@ CoreDataStack.xcscheme_^#shared#^_ orderHint - 27 + 21 Mastodon - ASDK.xcscheme_^#shared#^_ @@ -37,7 +37,7 @@ NotificationService.xcscheme_^#shared#^_ orderHint - 26 + 20 SuppressBuildableAutocreation diff --git a/Mastodon/Info.plist b/Mastodon/Info.plist index 26dcf5cc..1a9dadce 100644 --- a/Mastodon/Info.plist +++ b/Mastodon/Info.plist @@ -2,6 +2,17 @@ + CFBundleURLTypes + + + CFBundleURLSchemes + + mastodon + + CFBundleURLName + org.joinmastodon.app + + CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleExecutable diff --git a/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift b/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift index 2885fe7e..9e9235ba 100644 --- a/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift +++ b/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift @@ -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 diff --git a/Mastodon/Supporting Files/AppDelegate.swift b/Mastodon/Supporting Files/AppDelegate.swift index 70d259ca..392d2944 100644 --- a/Mastodon/Supporting Files/AppDelegate.swift +++ b/Mastodon/Supporting Files/AppDelegate.swift @@ -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 {