diff --git a/Mastodon/Scene/Authentication/ResendEmail/MastodonResendEmailViewController.swift b/Mastodon/Scene/Authentication/ResendEmail/MastodonResendEmailViewController.swift index 1a16067cf..a10755fe3 100644 --- a/Mastodon/Scene/Authentication/ResendEmail/MastodonResendEmailViewController.swift +++ b/Mastodon/Scene/Authentication/ResendEmail/MastodonResendEmailViewController.swift @@ -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 { @objc private func cancelBarButtonItemPressed(_ sender: UIBarButtonItem) { dismiss(animated: true, completion: nil) diff --git a/Mastodon/Scene/Authentication/ResendEmail/MastodonResendEmailViewModelNavigationDelegateShim.swift b/Mastodon/Scene/Authentication/ResendEmail/MastodonResendEmailViewModelNavigationDelegateShim.swift index ae7047f45..4a27de96d 100644 --- a/Mastodon/Scene/Authentication/ResendEmail/MastodonResendEmailViewModelNavigationDelegateShim.swift +++ b/Mastodon/Scene/Authentication/ResendEmail/MastodonResendEmailViewModelNavigationDelegateShim.swift @@ -27,7 +27,11 @@ final class MastodonResendEmailViewModelNavigationDelegateShim: NSObject { extension MastodonResendEmailViewModelNavigationDelegateShim: WKNavigationDelegate { 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) } }