File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,11 @@ - (CDVInAppBrowser*)initWithWebView:(UIWebView*)theWebView
5252 return self;
5353}
5454
55+ - (id )settingForKey : (NSString *)key
56+ {
57+ return [self .commandDelegate.settings objectForKey: [key lowercaseString ]];
58+ }
59+
5560- (void )onReset
5661{
5762 [self close: nil ];
@@ -138,8 +143,16 @@ - (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options
138143 }
139144
140145 if (self.inAppBrowserViewController == nil ) {
141- NSString * originalUA = [CDVUserAgentUtil originalUserAgent ];
142- self.inAppBrowserViewController = [[CDVInAppBrowserViewController alloc ] initWithUserAgent: originalUA prevUserAgent: [self .commandDelegate userAgent ] browserOptions: browserOptions];
146+ NSString * userAgent = [CDVUserAgentUtil originalUserAgent ];
147+ NSString * overrideUserAgent = [self settingForKey: @" OverrideUserAgent" ];
148+ NSString * appendUserAgent = [self settingForKey: @" AppendUserAgent" ];
149+ if (overrideUserAgent){
150+ userAgent = overrideUserAgent;
151+ }
152+ if (appendUserAgent){
153+ userAgent = [userAgent stringByAppendingString: appendUserAgent];
154+ }
155+ self.inAppBrowserViewController = [[CDVInAppBrowserViewController alloc ] initWithUserAgent: userAgent prevUserAgent: [self .commandDelegate userAgent ] browserOptions: browserOptions];
143156 self.inAppBrowserViewController .navigationDelegate = self;
144157
145158 if ([self .viewController conformsToProtocol: @protocol (CDVScreenOrientationDelegate)]) {
You can’t perform that action at this time.
0 commit comments