chore: fill email in MastodonResendEmailViewModelNavigationDelegateShim

This commit is contained in:
sunxiaojian 2021-02-25 16:20:42 +08:00
parent fa4b349e06
commit 74c19c9746
2 changed files with 5 additions and 8 deletions

View File

@ -59,13 +59,6 @@ extension MastodonResendEmailViewController {
} }
} }
extension MastodonResendEmailViewController {
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
let scriptString = "document.getElementById('user_email').value = '\(self.viewModel.email)';"
webView.evaluateJavaScript(scriptString)
}
}
extension MastodonResendEmailViewController { extension MastodonResendEmailViewController {
@objc private func cancelBarButtonItemPressed(_ sender: UIBarButtonItem) { @objc private func cancelBarButtonItemPressed(_ sender: UIBarButtonItem) {
dismiss(animated: true, completion: nil) dismiss(animated: true, completion: nil)

View File

@ -27,7 +27,11 @@ final class MastodonResendEmailViewModelNavigationDelegateShim: NSObject {
extension MastodonResendEmailViewModelNavigationDelegateShim: WKNavigationDelegate { extension MastodonResendEmailViewModelNavigationDelegateShim: WKNavigationDelegate {
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
guard let email = self.viewModel?.email else {
return
}
let scriptString = "document.getElementById('user_email').value = '\(email)';"
webView.evaluateJavaScript(scriptString)
} }
} }