You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/01/17 20:03:52 UTC

[GitHub] infil00p closed pull request #226: Added implementation for iOS clearSharedUrlCache()

infil00p closed pull request #226: Added implementation for iOS clearSharedUrlCache()
URL: https://github.com/apache/cordova-plugin-inappbrowser/pull/226
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/ios/CDVInAppBrowser.h b/src/ios/CDVInAppBrowser.h
index d258eb09..7875abd9 100644
--- a/src/ios/CDVInAppBrowser.h
+++ b/src/ios/CDVInAppBrowser.h
@@ -41,6 +41,7 @@
 - (void)injectScriptCode:(CDVInvokedUrlCommand*)command;
 - (void)show:(CDVInvokedUrlCommand*)command;
 - (void)hide:(CDVInvokedUrlCommand*)command;
+- (void)clearSharedUrlCache:(UIWebView*)theWebView;
 
 @end
 
@@ -52,6 +53,7 @@
 @property (nonatomic, copy) NSString* toolbarposition;
 @property (nonatomic, assign) BOOL clearcache;
 @property (nonatomic, assign) BOOL clearsessioncache;
+@property (nonatomic, assign) BOOL clearurlcache;
 
 @property (nonatomic, copy) NSString* presentationstyle;
 @property (nonatomic, copy) NSString* transitionstyle;
diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m
index c9ebad24..e5a9128b 100644
--- a/src/ios/CDVInAppBrowser.m
+++ b/src/ios/CDVInAppBrowser.m
@@ -142,6 +142,10 @@ - (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options
         }
     }
 
+    if (browserOptions.clearurlcache) {
+        [self clearurlcache:self.webview];
+    }
+
     if (self.inAppBrowserViewController == nil) {
         NSString* userAgent = [CDVUserAgentUtil originalUserAgent];
         NSString* overrideUserAgent = [self settingForKey:@"OverrideUserAgent"];
@@ -452,6 +456,11 @@ - (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*
     return YES;
 }
 
+- (void)clearSharedUrlCache:(UIWebView*)theWebView
+{
+    [[NSURLCache sharedURLCache] removeAllCachedResponses];
+}
+
 - (void)webViewDidStartLoad:(UIWebView*)theWebView
 {
 }
@@ -987,6 +996,7 @@ - (id)init
         self.toolbarposition = kInAppBrowserToolbarBarPositionBottom;
         self.clearcache = NO;
         self.clearsessioncache = NO;
+        self.clearurlcache = YES;
 
         self.enableviewportscale = NO;
         self.mediaplaybackrequiresuseraction = NO;


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org