CB-6389 CB-3617: Add clearcache and clearsessioncache options to iOS (like Android)
This commit is contained in:
parent
9399ed3955
commit
22c7a0e51e
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user