Skip to content

Commit

Permalink
Add FDL to M55 (#3724)
Browse files Browse the repository at this point in the history
* Remove references to UIWebView from DynamicLinks to comply with Apple "ITMS-90809: Deprecated API Usage" (#3723)
* Add FDL to M55
  • Loading branch information
paulb777 authored Aug 29, 2019
1 parent 36e9dc6 commit ad6c48a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 44 deletions.
3 changes: 3 additions & 0 deletions Firebase/DynamicLinks/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v4.0.4
- [changed] Removed iOS 7 WebView code causing App Store complaints. (#3722)

# v4.0.3
- [added] Added support for custom domains for internal Google apps. (#3540)

Expand Down
48 changes: 5 additions & 43 deletions Firebase/DynamicLinks/FIRDLJavaScriptExecutor.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ @implementation FIRDLJavaScriptExecutor {
__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
Expand All @@ -82,17 +81,9 @@ - (void)start {
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 {
Expand All @@ -109,8 +100,6 @@ - (void)handleExecutionError:(nullable NSError *)error {
}

- (void)cleanup {
_uiWebView.delegate = nil;
_uiWebView = nil;
_wkWebView.navigationDelegate = nil;
_wkWebView = nil;
}
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion FirebaseDynamicLinks.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'FirebaseDynamicLinks'
s.version = '4.0.3'
s.version = '4.0.4'
s.summary = 'Firebase DynamicLinks for iOS'

s.description = <<-DESC
Expand Down
1 change: 1 addition & 0 deletions Releases/Manifests/6.8.0.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"FirebaseABTesting":"3.1.1",
"FirebaseCore":"6.2.2",
"FirebaseDynamicLinks":"4.0.4",
"FirebaseFirestore":"1.5.0",
"FirebaseInAppMessaging":"0.15.4",
"FirebaseInstanceID":"4.2.4",
Expand Down

0 comments on commit ad6c48a

Please sign in to comment.