Show and copy developer email if failed to open the Mail App

This commit is contained in:
Yishi Lin 2017-05-04 21:12:37 +08:00
parent 885319e2e1
commit 22877c8012

View file

@ -98,6 +98,12 @@ class BasicStaticTableViewController: UITableViewController, MFMailComposeViewCo
let subject = urlComponents.queryItems![0].value ?? "" let subject = urlComponents.queryItems![0].value ?? ""
if MFMailComposeViewController.canSendMail() { if MFMailComposeViewController.canSendMail() {
sendEmail(toRecipients: [urlComponents.path], subject: subject) sendEmail(toRecipients: [urlComponents.path], subject: subject)
} else {
let email = urlComponents.path
let alertTitle = "Cannot open Mail App"
let alertMessage = "Email copied: \(email)"
Utils.copyToPasteboard(textToCopy: email)
Utils.alert(title: alertTitle, message: alertMessage, controller: self, completion: nil)
} }
case "http", "https": case "http", "https":
let svc = SFSafariViewController(url: URL(string: link)!, entersReaderIfAvailable: false) let svc = SFSafariViewController(url: URL(string: link)!, entersReaderIfAvailable: false)