diff --git a/Firebase/DynamicLinks/FIRDLJavaScriptExecutor.m b/Firebase/DynamicLinks/FIRDLJavaScriptExecutor.m index 9912d256c08..8908f911899 100644 --- a/Firebase/DynamicLinks/FIRDLJavaScriptExecutor.m +++ b/Firebase/DynamicLinks/FIRDLJavaScriptExecutor.m @@ -57,9 +57,8 @@ @implementation FIRDLJavaScriptExecutor { __weak id _delegate; NSString *_script; - // Web views with which to run JavaScript. - UIWebView *_uiWebView; // Used in iOS 7 only. - WKWebView *_wkWebView; // Used in iOS 8+ only. + // Web view with which to run JavaScript. + WKWebView *_wkWebView; } - (instancetype)initWithDelegate:(id)delegate @@ -82,17 +81,9 @@ - (void)start { NSString *htmlContent = [NSString stringWithFormat:@"", _script]; - // Use WKWebView if available as it executes JavaScript more quickly, otherwise, fall back - // on UIWebView. - if ([WKWebView class]) { - _wkWebView = [[WKWebView alloc] init]; - _wkWebView.navigationDelegate = self; - [_wkWebView loadHTMLString:htmlContent baseURL:nil]; - } else { - _uiWebView = [[UIWebView alloc] init]; - _uiWebView.delegate = self; - [_uiWebView loadHTMLString:htmlContent baseURL:nil]; - } + _wkWebView = [[WKWebView alloc] init]; + _wkWebView.navigationDelegate = self; + [_wkWebView loadHTMLString:htmlContent baseURL:nil]; } - (void)handleExecutionResult:(NSString *)result { @@ -109,8 +100,6 @@ - (void)handleExecutionError:(nullable NSError *)error { } - (void)cleanup { - _uiWebView.delegate = nil; - _uiWebView = nil; _wkWebView.navigationDelegate = nil; _wkWebView = nil; } @@ -150,33 +139,6 @@ - (void)webView:(WKWebView *)webView [self handleExecutionError:error]; } -#pragma mark - UIWebViewDelegate - -- (void)webViewDidFinishLoad:(UIWebView *)webView { - // Make sure that the javascript was loaded successfully before calling the method. - NSString *methodType = - [webView stringByEvaluatingJavaScriptFromString:FIRDLTypeofFingerprintJSMethodNameString()]; - if (![methodType isEqualToString:@"function"]) { - // Javascript was not loaded successfully. - [self handleExecutionError:nil]; - return; - } - - // Get the result from javascript. - NSString *result = - [webView stringByEvaluatingJavaScriptFromString:GINFingerprintJSMethodString()]; - if ([result isKindOfClass:[NSString class]]) { - [self handleExecutionResult:result]; - } else { - [self handleExecutionError:nil]; - } -} - -- (void)webView:(UIWebView *)webView - didFailLoadWithError:(FIRDL_NULLABLE_IOS9_NONNULLABLE_IOS10 NSError *)error { - [self handleExecutionError:error]; -} - @end NS_ASSUME_NONNULL_END