Fixes #2256
This commit is contained in:
Stuart Breckenridge 2020-07-13 14:24:57 +08:00
parent 88e409d2be
commit 7183b853bd
No known key found for this signature in database
GPG Key ID: 79BD673276AE83CE
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 {