cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject ios commit: CB-3420: add hidden option to InAppBrowser
Date Wed, 05 Jun 2013 15:30:45 GMT
Updated Branches:
  refs/heads/master f81d5b240 -> fde980a49


CB-3420: add hidden option to InAppBrowser


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/fde980a4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/fde980a4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/fde980a4

Branch: refs/heads/master
Commit: fde980a492ae96ff11ccb77ad8b9aae3bed55322
Parents: f81d5b2
Author: David Kemp <drkemp@dhcp-172-23-180-121.wat.corp.google.com>
Authored: Tue Jun 4 13:54:43 2013 -0400
Committer: David Kemp <drkemp@dhcp-172-23-180-121.wat.corp.google.com>
Committed: Tue Jun 4 13:54:43 2013 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVInAppBrowser.h |    2 ++
 CordovaLib/Classes/CDVInAppBrowser.m |   15 ++++++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/fde980a4/CordovaLib/Classes/CDVInAppBrowser.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVInAppBrowser.h b/CordovaLib/Classes/CDVInAppBrowser.h
index f87baff..248274a 100644
--- a/CordovaLib/Classes/CDVInAppBrowser.h
+++ b/CordovaLib/Classes/CDVInAppBrowser.h
@@ -34,6 +34,7 @@
 - (void)open:(CDVInvokedUrlCommand*)command;
 - (void)close:(CDVInvokedUrlCommand*)command;
 - (void)injectScriptCode:(CDVInvokedUrlCommand*)command;
+- (void)show:(CDVInvokedUrlCommand*)command;
 
 @end
 
@@ -81,6 +82,7 @@
 @property (nonatomic, assign) BOOL allowinlinemediaplayback;
 @property (nonatomic, assign) BOOL keyboarddisplayrequiresuseraction;
 @property (nonatomic, assign) BOOL suppressesincrementalrendering;
+@property (nonatomic, assign) BOOL hidden;
 
 + (CDVInAppBrowserOptions*)parseOptions:(NSString*)options;
 

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/fde980a4/CordovaLib/Classes/CDVInAppBrowser.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVInAppBrowser.m b/CordovaLib/Classes/CDVInAppBrowser.m
index d5f06ec..b832e23 100644
--- a/CordovaLib/Classes/CDVInAppBrowser.m
+++ b/CordovaLib/Classes/CDVInAppBrowser.m
@@ -101,13 +101,13 @@
         }
     }
 
+
     CDVInAppBrowserOptions* browserOptions = [CDVInAppBrowserOptions parseOptions:options];
     [self.inAppBrowserViewController showLocationBar:browserOptions.location];
     [self.inAppBrowserViewController showToolBar:browserOptions.toolbar];
     if (browserOptions.closebuttoncaption != nil) {
         [self.inAppBrowserViewController setCloseButtonTitle:browserOptions.closebuttoncaption];
     }
-
     // Set Presentation Style
     UIModalPresentationStyle presentationStyle = UIModalPresentationFullScreen; // default
     if (browserOptions.presentationstyle != nil) {
@@ -130,6 +130,7 @@
     }
     self.inAppBrowserViewController.modalTransitionStyle = transitionStyle;
 
+  
     // UIWebView options
     self.inAppBrowserViewController.webView.scalesPageToFit = browserOptions.enableviewportscale;
     self.inAppBrowserViewController.webView.mediaPlaybackRequiresUserAction = browserOptions.mediaplaybackrequiresuseraction;
@@ -138,13 +139,20 @@
         self.inAppBrowserViewController.webView.keyboardDisplayRequiresUserAction = browserOptions.keyboarddisplayrequiresuseraction;
         self.inAppBrowserViewController.webView.suppressesIncrementalRendering = browserOptions.suppressesincrementalrendering;
     }
-
-    if (self.viewController.modalViewController != self.inAppBrowserViewController) {
+  
+    if (! browserOptions.hidden) {
+      if (self.viewController.modalViewController != self.inAppBrowserViewController) {
         [self.viewController presentModalViewController:self.inAppBrowserViewController animated:YES];
+      }
     }
     [self.inAppBrowserViewController navigateTo:url];
 }
 
+- (void)show:(CDVInvokedUrlCommand*)command
+{
+  [self.viewController presentModalViewController:self.inAppBrowserViewController animated:YES];
+}
+
 - (void)openInCordovaWebView:(NSURL*)url withOptions:(NSString*)options
 {
     if ([self.commandDelegate URLIsWhitelisted:url]) {
@@ -764,6 +772,7 @@
         self.allowinlinemediaplayback = NO;
         self.keyboarddisplayrequiresuseraction = YES;
         self.suppressesincrementalrendering = NO;
+        self.hidden = NO;
     }
 
     return self;


Mime
View raw message