Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/ios/CDVInAppBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ - (void)pluginInitialize
_callbackIdPattern = nil;
}

- (id)settingForKey:(NSString*)key
{
return [self.commandDelegate.settings objectForKey:[key lowercaseString]];
}

- (void)onReset
{
[self close:nil];
Expand Down Expand Up @@ -137,8 +142,16 @@ - (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options
}

if (self.inAppBrowserViewController == nil) {
NSString* originalUA = [CDVUserAgentUtil originalUserAgent];
self.inAppBrowserViewController = [[CDVInAppBrowserViewController alloc] initWithUserAgent:originalUA prevUserAgent:[self.commandDelegate userAgent] browserOptions: browserOptions];
NSString* userAgent = [CDVUserAgentUtil originalUserAgent];
NSString* overrideUserAgent = [self settingForKey:@"OverrideUserAgent"];
NSString* appendUserAgent = [self settingForKey:@"AppendUserAgent"];
if(overrideUserAgent){
userAgent = overrideUserAgent;
}
if(appendUserAgent){
userAgent = [userAgent stringByAppendingString: appendUserAgent];
}
self.inAppBrowserViewController = [[CDVInAppBrowserViewController alloc] initWithUserAgent:userAgent prevUserAgent:[self.commandDelegate userAgent] browserOptions: browserOptions];
self.inAppBrowserViewController.navigationDelegate = self;

if ([self.viewController conformsToProtocol:@protocol(CDVScreenOrientationDelegate)]) {
Expand Down