cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject [07/17] git commit: CB-6389 CB-3617: Add clearcache and clearsessioncache options to iOS (like Android)
Date Wed, 23 Apr 2014 18:57:27 GMT
CB-6389 CB-3617: Add clearcache and clearsessioncache options to iOS (like Android)


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/22c7a0e5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/22c7a0e5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/22c7a0e5

Branch: refs/heads/master
Commit: 22c7a0e51e560b35e46e94dea667a5fb0ef5a270
Parents: 9399ed3
Author: mbradshawabs <mbradshaw@americanbible.org>
Authored: Wed Apr 2 09:19:05 2014 -0500
Committer: Ian Clelland <iclelland@chromium.org>
Committed: Wed Apr 2 15:04:48 2014 -0400

----------------------------------------------------------------------
 src/ios/CDVInAppBrowser.h |  2 ++
 src/ios/CDVInAppBrowser.m | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/22c7a0e5/src/ios/CDVInAppBrowser.h
----------------------------------------------------------------------
diff --git a/src/ios/CDVInAppBrowser.h b/src/ios/CDVInAppBrowser.h
index 8e2ab12..e643962 100644
--- a/src/ios/CDVInAppBrowser.h
+++ b/src/ios/CDVInAppBrowser.h
@@ -45,6 +45,8 @@
 @property (nonatomic, assign) BOOL toolbar;
 @property (nonatomic, copy) NSString* closebuttoncaption;
 @property (nonatomic, copy) NSString* toolbarposition;
+@property (nonatomic, assign) BOOL clearcache;
+@property (nonatomic, assign) BOOL clearsessioncache;
 
 @property (nonatomic, copy) NSString* presentationstyle;
 @property (nonatomic, copy) NSString* transitionstyle;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/22c7a0e5/src/ios/CDVInAppBrowser.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m
index 2b0dc41..6625545 100644
--- a/src/ios/CDVInAppBrowser.m
+++ b/src/ios/CDVInAppBrowser.m
@@ -115,6 +115,29 @@
 - (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options
 {
     CDVInAppBrowserOptions* browserOptions = [CDVInAppBrowserOptions parseOptions:options];
+
+    if (browserOptions.clearcache) {
+        NSHTTPCookie *cookie;
+        NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
+        for (cookie in [storage cookies])
+        {
+            if (![cookie.domain isEqual: @".^filecookies^"]) {
+                [storage deleteCookie:cookie];
+            }
+        }
+    }
+
+    if (browserOptions.clearsessioncache) {
+        NSHTTPCookie *cookie;
+        NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
+        for (cookie in [storage cookies])
+        {
+            if (![cookie.domain isEqual: @".^filecookies^"] && cookie.isSessionOnly)
{
+                [storage deleteCookie:cookie];
+            }
+        }
+    }
+
     if (self.inAppBrowserViewController == nil) {
         NSString* originalUA = [CDVUserAgentUtil originalUserAgent];
         self.inAppBrowserViewController = [[CDVInAppBrowserViewController alloc] initWithUserAgent:originalUA
prevUserAgent:[self.commandDelegate userAgent] browserOptions: browserOptions];
@@ -885,6 +908,8 @@
         self.toolbar = YES;
         self.closebuttoncaption = nil;
         self.toolbarposition = kInAppBrowserToolbarBarPositionBottom;
+        self.clearcache = NO;
+        self.clearsessioncache = NO;
 
         self.enableviewportscale = NO;
         self.mediaplaybackrequiresuseraction = NO;


Mime
View raw message