Skip to content

Commit

Permalink
fix(ios): release userAgentLock for IAB compat (#558)
Browse files Browse the repository at this point in the history
fix #551
  • Loading branch information
jcesarmobile committed Apr 28, 2020
1 parent 9e8d35f commit 4c027f3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ios/CDVWKWebViewEngine.m
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,10 @@ - (void)webView:(WKWebView*)webView didStartProvisionalNavigation:(WKNavigation*

- (void)webView:(WKWebView*)webView didFinishNavigation:(WKNavigation*)navigation
{
#ifndef __CORDOVA_6_0_0
CDVViewController* vc = (CDVViewController*)self.viewController;
[CDVUserAgentUtil releaseLock:vc.userAgentLockToken];
#endif
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPageDidLoadNotification object:webView]];
}

Expand All @@ -681,6 +685,9 @@ - (void)webView:(WKWebView*)theWebView didFailProvisionalNavigation:(WKNavigatio
- (void)webView:(WKWebView*)theWebView didFailNavigation:(WKNavigation*)navigation withError:(NSError*)error
{
CDVViewController* vc = (CDVViewController*)self.viewController;
#ifndef __CORDOVA_6_0_0
[CDVUserAgentUtil releaseLock:vc.userAgentLockToken];
#endif

NSString* message = [NSString stringWithFormat:@"Failed to load webpage with error: %@", [error localizedDescription]];
NSLog(@"%@", message);
Expand Down

0 comments on commit 4c027f3

Please sign in to comment.