CB-3360: Set custom inappbrowser user agent for ios
This closes #94 Signed-off-by: Shazron Abdullah <shazron@gmail.com>
This commit is contained in:
parent
768f886c6a
commit
4ef6106259
@ -47,6 +47,11 @@
|
|||||||
_callbackIdPattern = nil;
|
_callbackIdPattern = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id)settingForKey:(NSString*)key
|
||||||
|
{
|
||||||
|
return [self.commandDelegate.settings objectForKey:[key lowercaseString]];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)onReset
|
- (void)onReset
|
||||||
{
|
{
|
||||||
[self close:nil];
|
[self close:nil];
|
||||||
@ -137,8 +142,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (self.inAppBrowserViewController == nil) {
|
if (self.inAppBrowserViewController == nil) {
|
||||||
NSString* originalUA = [CDVUserAgentUtil originalUserAgent];
|
NSString* userAgent = [CDVUserAgentUtil originalUserAgent];
|
||||||
self.inAppBrowserViewController = [[CDVInAppBrowserViewController alloc] initWithUserAgent:originalUA prevUserAgent:[self.commandDelegate userAgent] browserOptions: browserOptions];
|
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;
|
self.inAppBrowserViewController.navigationDelegate = self;
|
||||||
|
|
||||||
if ([self.viewController conformsToProtocol:@protocol(CDVScreenOrientationDelegate)]) {
|
if ([self.viewController conformsToProtocol:@protocol(CDVScreenOrientationDelegate)]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user