mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-11 22:55:59 +05:45
Remove references to UIWebView from DynamicLinks to comply with Apple "ITMS-90809: Deprecated API Usage" (#3723)
This commit is contained in:
1 parent
1e889cf43c
commit
7095c0b390
1 file changed
+5
-43
@@ -57,9 +57,8 @@ NSString *GINFingerprintJSMethodString() {
|
||||
__weak id<FIRDLJavaScriptExecutorDelegate> _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<FIRDLJavaScriptExecutorDelegate>)delegate
|
||||
@@ -82,17 +81,9 @@ NSString *GINFingerprintJSMethodString() {
|
||||
NSString *htmlContent =
|
||||
[NSString stringWithFormat:@"<html><head><script>%@</script></head></html>", _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 @@ NSString *GINFingerprintJSMethodString() {
|
||||
}
|
||||
|
||||
- (void)cleanup {
|
||||
_uiWebView.delegate = nil;
|
||||
_uiWebView = nil;
|
||||
_wkWebView.navigationDelegate = nil;
|
||||
_wkWebView = nil;
|
||||
}
|
||||
@@ -150,33 +139,6 @@ NSString *GINFingerprintJSMethodString() {
|
||||
[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
|
||||
Reference in new issue
Block a user