Merge pull request #2257 from stuartbreckenridge/ios-release

#2256
This commit is contained in:
Maurice Parker 2020-07-13 16:54:48 -05:00 committed by GitHub
commit 4625805fba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -15,4 +15,13 @@ extension URL {
scheme == "mailto" ? URLComponents(url: self, resolvingAgainstBaseURL: false)?.path : nil
}
func valueFor(_ parameter: String) -> String? {
guard let components = URLComponents(url: self, resolvingAgainstBaseURL: false),
let queryItems = components.queryItems,
let value = queryItems.first(where: { $0.name == parameter })?.value else {
return nil
}
return value
}
}

View File

@ -338,6 +338,7 @@ extension WebViewController: WKNavigationDelegate {
if MFMailComposeViewController.canSendMail() {
let mailComposeViewController = MFMailComposeViewController()
mailComposeViewController.setToRecipients([emailAddress])
mailComposeViewController.setSubject(url.valueFor("subject") ?? "")
mailComposeViewController.mailComposeDelegate = self
self.present(mailComposeViewController, animated: true, completion: {})
} else {