From ef5eddac9add2200e91a846cdea9e54d66b66074 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Wed, 9 Oct 2013 21:25:24 -0400 Subject: [PATCH 01/11] CB-5021 Make it safe to call close() multiple times --- www/InAppBrowser.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/www/InAppBrowser.js b/www/InAppBrowser.js index 5da53fd..83f5a22 100644 --- a/www/InAppBrowser.js +++ b/www/InAppBrowser.js @@ -30,6 +30,7 @@ function InAppBrowser() { 'loaderror' : channel.create('loaderror'), 'exit' : channel.create('exit') }; + this._alive = true; } InAppBrowser.prototype = { @@ -39,7 +40,10 @@ InAppBrowser.prototype = { } }, close: function (eventname) { - exec(null, null, "InAppBrowser", "close", []); + if (this._alive) { + this._alive = false; + exec(null, null, "InAppBrowser", "close", []); + } }, show: function (eventname) { exec(null, null, "InAppBrowser", "show", []); From 8cd786b6035d1da9b58ecafd6752df690058ca6b Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 10 Oct 2013 08:07:46 -0400 Subject: [PATCH 02/11] CB-5021 Expose closeDialog() as a public function and make it safe to call multiple times. --- src/android/InAppBrowser.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 3be0316..dfe1a50 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -157,7 +157,7 @@ public class InAppBrowser extends CordovaPlugin { } else if (action.equals("close")) { closeDialog(); - this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK)); + this.callbackContext.success(); } else if (action.equals("injectScriptCode")) { String jsWrapper = null; @@ -311,11 +311,15 @@ public class InAppBrowser extends CordovaPlugin { /** * Closes the dialog */ - private void closeDialog() { + public void closeDialog() { + final WebView childView = this.inAppWebView; + // The JS protects against multiple calls, so this should happen only when + // closeDialog() is called by other native code. + if (childView == null) { + return; + } try { - final WebView childView = this.inAppWebView; Runnable runnable = new Runnable() { - @Override public void run() { childView.loadUrl("about:blank"); From 8df4b7d03b3766cce03e26f996dfa3b54e417f04 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 10 Oct 2013 11:49:00 -0400 Subject: [PATCH 03/11] CB-3747 Fix back button having different dismiss logic from the close button. Also made the IAB close when the owner page is navigated (implemented onReset). --- src/android/InAppBrowser.java | 71 ++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 31 deletions(-) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index dfe1a50..940a409 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -18,20 +18,6 @@ */ package org.apache.cordova.inappbrowser; -import java.util.HashMap; -import java.util.StringTokenizer; - - -import org.apache.cordova.Config; -import org.apache.cordova.CordovaWebView; -import org.apache.cordova.CallbackContext; -import org.apache.cordova.CordovaPlugin; -import org.apache.cordova.LOG; -import org.apache.cordova.PluginResult; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - import android.annotation.SuppressLint; import android.app.Dialog; import android.content.Context; @@ -52,11 +38,7 @@ import android.view.WindowManager.LayoutParams; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.webkit.CookieManager; -import android.webkit.WebChromeClient; -import android.webkit.GeolocationPermissions.Callback; -import android.webkit.JsPromptResult; import android.webkit.WebSettings; -import android.webkit.WebStorage; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; @@ -64,6 +46,19 @@ import android.widget.EditText; import android.widget.LinearLayout; import android.widget.RelativeLayout; +import org.apache.cordova.CallbackContext; +import org.apache.cordova.Config; +import org.apache.cordova.CordovaPlugin; +import org.apache.cordova.CordovaWebView; +import org.apache.cordova.LOG; +import org.apache.cordova.PluginResult; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.util.HashMap; +import java.util.StringTokenizer; + @SuppressLint("SetJavaScriptEnabled") public class InAppBrowser extends CordovaPlugin { @@ -157,7 +152,6 @@ public class InAppBrowser extends CordovaPlugin { } else if (action.equals("close")) { closeDialog(); - this.callbackContext.success(); } else if (action.equals("injectScriptCode")) { String jsWrapper = null; @@ -214,6 +208,22 @@ public class InAppBrowser extends CordovaPlugin { return true; } + /** + * Called when the view navigates. + */ + @Override + public void onReset() { + closeDialog(); + } + + /** + * Called by AccelBroker when listener is to be shut down. + * Stop listener. + */ + public void onDestroy() { + closeDialog(); + } + /** * Inject an object (script or style) into the InAppBrowser WebView. * @@ -442,14 +452,7 @@ public class InAppBrowser extends CordovaPlugin { dialog.setCancelable(true); dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { public void onDismiss(DialogInterface dialog) { - try { - JSONObject obj = new JSONObject(); - obj.put("type", EXIT_EVENT); - - sendUpdate(obj, false); - } catch (JSONException e) { - Log.d(LOG_TAG, "Should never happen"); - } + closeDialog(); } }); @@ -624,10 +627,16 @@ public class InAppBrowser extends CordovaPlugin { * * @param obj a JSONObject contain event payload information * @param status the status code to return to the JavaScript environment - */ private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Status status) { - PluginResult result = new PluginResult(status, obj); - result.setKeepCallback(keepCallback); - this.callbackContext.sendPluginResult(result); + */ + private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Status status) { + if (callbackContext != null) { + PluginResult result = new PluginResult(status, obj); + result.setKeepCallback(keepCallback); + callbackContext.sendPluginResult(result); + if (!keepCallback) { + callbackContext = null; + } + } } From 8a6bc01814b6d7eb3f605ad47a45d33163153a66 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 10 Oct 2013 12:21:35 -0400 Subject: [PATCH 04/11] CB-4858 Convert relative URLs to absolute URLs in JS --- plugin.xml | 3 +++ www/InAppBrowser.js | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/plugin.xml b/plugin.xml index 9a53bd2..341b4be 100644 --- a/plugin.xml +++ b/plugin.xml @@ -8,6 +8,9 @@ Apache 2.0 cordova,in,app,browser,inappbrowser + + + diff --git a/www/InAppBrowser.js b/www/InAppBrowser.js index 83f5a22..3fe9261 100644 --- a/www/InAppBrowser.js +++ b/www/InAppBrowser.js @@ -22,6 +22,7 @@ var exec = require('cordova/exec'); var channel = require('cordova/channel'); var modulemapper = require('cordova/modulemapper'); +var urlutil = require('cordova/urlutil'); function InAppBrowser() { this.channels = { @@ -81,17 +82,18 @@ InAppBrowser.prototype = { }; module.exports = function(strUrl, strWindowName, strWindowFeatures) { - var iab = new InAppBrowser(); - var cb = function(eventname) { - iab._eventHandler(eventname); - }; - // Don't catch calls that write to existing frames (e.g. named iframes). if (window.frames && window.frames[strWindowName]) { var origOpenFunc = modulemapper.getOriginalSymbol(window, 'open'); return origOpenFunc.apply(window, arguments); } + strUrl = urlutil.makeAbsolute(strUrl); + var iab = new InAppBrowser(); + var cb = function(eventname) { + iab._eventHandler(eventname); + }; + exec(cb, cb, "InAppBrowser", "open", [strUrl, strWindowName, strWindowFeatures]); return iab; }; From 5ef5171003e5e550e85cfa5c021fb1c7c77e83e3 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 10 Oct 2013 12:40:27 -0400 Subject: [PATCH 05/11] CB-4858 - Run IAB methods on the UI thread. --- src/android/InAppBrowser.java | 251 ++++++++++++++++------------------ 1 file changed, 119 insertions(+), 132 deletions(-) diff --git a/src/android/InAppBrowser.java b/src/android/InAppBrowser.java index 940a409..da6b241 100644 --- a/src/android/InAppBrowser.java +++ b/src/android/InAppBrowser.java @@ -48,11 +48,11 @@ import android.widget.RelativeLayout; import org.apache.cordova.CallbackContext; import org.apache.cordova.Config; +import org.apache.cordova.CordovaArgs; import org.apache.cordova.CordovaPlugin; import org.apache.cordova.CordovaWebView; import org.apache.cordova.LOG; import org.apache.cordova.PluginResult; -import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -95,115 +95,114 @@ public class InAppBrowser extends CordovaPlugin { * @param callbackId The callback id used when calling back into JavaScript. * @return A PluginResult object with a status and message. */ - public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { - try { - if (action.equals("open")) { - this.callbackContext = callbackContext; - String url = args.getString(0); - String target = args.optString(1); - if (target == null || target.equals("") || target.equals(NULL)) { - target = SELF; - } - HashMap features = parseFeature(args.optString(2)); - - Log.d(LOG_TAG, "target = " + target); - - url = updateUrl(url); - String result = ""; - - // SELF - if (SELF.equals(target)) { - Log.d(LOG_TAG, "in self"); - // load in webview - if (url.startsWith("file://") || url.startsWith("javascript:") - || Config.isUrlWhiteListed(url)) { - this.webView.loadUrl(url); - } - //Load the dialer - else if (url.startsWith(WebView.SCHEME_TEL)) - { - try { - Intent intent = new Intent(Intent.ACTION_DIAL); - intent.setData(Uri.parse(url)); - this.cordova.getActivity().startActivity(intent); - } catch (android.content.ActivityNotFoundException e) { - LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString()); + public boolean execute(String action, CordovaArgs args, final CallbackContext callbackContext) throws JSONException { + if (action.equals("open")) { + this.callbackContext = callbackContext; + final String url = args.getString(0); + String t = args.optString(1); + if (t == null || t.equals("") || t.equals(NULL)) { + t = SELF; + } + final String target = t; + final HashMap features = parseFeature(args.optString(2)); + + Log.d(LOG_TAG, "target = " + target); + + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + String result = ""; + // SELF + if (SELF.equals(target)) { + Log.d(LOG_TAG, "in self"); + // load in webview + if (url.startsWith("file://") || url.startsWith("javascript:") + || Config.isUrlWhiteListed(url)) { + webView.loadUrl(url); + } + //Load the dialer + else if (url.startsWith(WebView.SCHEME_TEL)) + { + try { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse(url)); + cordova.getActivity().startActivity(intent); + } catch (android.content.ActivityNotFoundException e) { + LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString()); + } + } + // load in InAppBrowser + else { + result = showWebPage(url, features); } } - // load in InAppBrowser + // SYSTEM + else if (SYSTEM.equals(target)) { + Log.d(LOG_TAG, "in system"); + result = openExternal(url); + } + // BLANK - or anything else else { - result = this.showWebPage(url, features); + Log.d(LOG_TAG, "in blank"); + result = showWebPage(url, features); } + + PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, result); + pluginResult.setKeepCallback(true); + callbackContext.sendPluginResult(pluginResult); } - // SYSTEM - else if (SYSTEM.equals(target)) { - Log.d(LOG_TAG, "in system"); - result = this.openExternal(url); + }); + } + else if (action.equals("close")) { + closeDialog(); + } + else if (action.equals("injectScriptCode")) { + String jsWrapper = null; + if (args.getBoolean(1)) { + jsWrapper = String.format("prompt(JSON.stringify([eval(%%s)]), 'gap-iab://%s')", callbackContext.getCallbackId()); + } + injectDeferredObject(args.getString(0), jsWrapper); + } + else if (action.equals("injectScriptFile")) { + String jsWrapper; + if (args.getBoolean(1)) { + jsWrapper = String.format("(function(d) { var c = d.createElement('script'); c.src = %%s; c.onload = function() { prompt('', 'gap-iab://%s'); }; d.body.appendChild(c); })(document)", callbackContext.getCallbackId()); + } else { + jsWrapper = "(function(d) { var c = d.createElement('script'); c.src = %s; d.body.appendChild(c); })(document)"; + } + injectDeferredObject(args.getString(0), jsWrapper); + } + else if (action.equals("injectStyleCode")) { + String jsWrapper; + if (args.getBoolean(1)) { + jsWrapper = String.format("(function(d) { var c = d.createElement('style'); c.innerHTML = %%s; d.body.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); + } else { + jsWrapper = "(function(d) { var c = d.createElement('style'); c.innerHTML = %s; d.body.appendChild(c); })(document)"; + } + injectDeferredObject(args.getString(0), jsWrapper); + } + else if (action.equals("injectStyleFile")) { + String jsWrapper; + if (args.getBoolean(1)) { + jsWrapper = String.format("(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %%s; d.head.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); + } else { + jsWrapper = "(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %s; d.head.appendChild(c); })(document)"; + } + injectDeferredObject(args.getString(0), jsWrapper); + } + else if (action.equals("show")) { + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + dialog.show(); } - // BLANK - or anything else - else { - Log.d(LOG_TAG, "in blank"); - result = this.showWebPage(url, features); - } - - PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, result); - pluginResult.setKeepCallback(true); - this.callbackContext.sendPluginResult(pluginResult); - } - else if (action.equals("close")) { - closeDialog(); - } - else if (action.equals("injectScriptCode")) { - String jsWrapper = null; - if (args.getBoolean(1)) { - jsWrapper = String.format("prompt(JSON.stringify([eval(%%s)]), 'gap-iab://%s')", callbackContext.getCallbackId()); - } - injectDeferredObject(args.getString(0), jsWrapper); - } - else if (action.equals("injectScriptFile")) { - String jsWrapper; - if (args.getBoolean(1)) { - jsWrapper = String.format("(function(d) { var c = d.createElement('script'); c.src = %%s; c.onload = function() { prompt('', 'gap-iab://%s'); }; d.body.appendChild(c); })(document)", callbackContext.getCallbackId()); - } else { - jsWrapper = "(function(d) { var c = d.createElement('script'); c.src = %s; d.body.appendChild(c); })(document)"; - } - injectDeferredObject(args.getString(0), jsWrapper); - } - else if (action.equals("injectStyleCode")) { - String jsWrapper; - if (args.getBoolean(1)) { - jsWrapper = String.format("(function(d) { var c = d.createElement('style'); c.innerHTML = %%s; d.body.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); - } else { - jsWrapper = "(function(d) { var c = d.createElement('style'); c.innerHTML = %s; d.body.appendChild(c); })(document)"; - } - injectDeferredObject(args.getString(0), jsWrapper); - } - else if (action.equals("injectStyleFile")) { - String jsWrapper; - if (args.getBoolean(1)) { - jsWrapper = String.format("(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %%s; d.head.appendChild(c); prompt('', 'gap-iab://%s');})(document)", callbackContext.getCallbackId()); - } else { - jsWrapper = "(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %s; d.head.appendChild(c); })(document)"; - } - injectDeferredObject(args.getString(0), jsWrapper); - } - else if (action.equals("show")) { - Runnable runnable = new Runnable() { - @Override - public void run() { - dialog.show(); - } - }; - this.cordova.getActivity().runOnUiThread(runnable); - PluginResult pluginResult = new PluginResult(PluginResult.Status.OK); - pluginResult.setKeepCallback(true); - this.callbackContext.sendPluginResult(pluginResult); - } - else { - return false; - } - } catch (JSONException e) { - this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.JSON_EXCEPTION)); + }); + PluginResult pluginResult = new PluginResult(PluginResult.Status.OK); + pluginResult.setKeepCallback(true); + this.callbackContext.sendPluginResult(pluginResult); + } + else { + return false; } return true; } @@ -251,8 +250,14 @@ public class InAppBrowser extends CordovaPlugin { } else { scriptToInject = source; } + final String finalScriptToInject = scriptToInject; // This action will have the side-effect of blurring the currently focused element - this.inAppWebView.loadUrl("javascript:" + scriptToInject); + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + inAppWebView.loadUrl("javascript:" + finalScriptToInject); + } + }); } /** @@ -284,20 +289,6 @@ public class InAppBrowser extends CordovaPlugin { } } - /** - * Convert relative URL to full path - * - * @param url - * @return - */ - private String updateUrl(String url) { - Uri newUrl = Uri.parse(url); - if (newUrl.isRelative()) { - url = this.webView.getUrl().substring(0, this.webView.getUrl().lastIndexOf("/")+1) + url; - } - return url; - } - /** * Display a new browser with the specified URL. * @@ -328,27 +319,23 @@ public class InAppBrowser extends CordovaPlugin { if (childView == null) { return; } - try { - Runnable runnable = new Runnable() { - @Override - public void run() { - childView.loadUrl("about:blank"); + this.cordova.getActivity().runOnUiThread(new Runnable() { + @Override + public void run() { + childView.loadUrl("about:blank"); + if (dialog != null) { + dialog.dismiss(); } - - }; - - this.cordova.getActivity().runOnUiThread(runnable); + } + }); + try { JSONObject obj = new JSONObject(); obj.put("type", EXIT_EVENT); - sendUpdate(obj, false); } catch (JSONException ex) { Log.d(LOG_TAG, "Should never happen"); } - if (dialog != null) { - dialog.dismiss(); - } } /** From a76a0a3920e81c56db7c070e002eb24e4a1a478a Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Wed, 9 Oct 2013 15:27:18 -0700 Subject: [PATCH 06/11] [CB-5010] Updated version and RELEASENOTES.md for release 0.2.3 --- RELEASENOTES.md | 4 ++++ plugin.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 0dbdbc5..548a6a2 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -32,3 +32,7 @@ * Rename CHANGELOG.md -> RELEASENOTES.md * [CB-4792] Added keepCallback to the show function. * [CB-4752] Incremented plugin version on dev branch. + +### 0.2.3 (Oct 9, 2013) +* [CB-4915] Incremented plugin version on dev branch. +* [CB-4926] Fixes inappbrowser plugin loading for windows8 \ No newline at end of file diff --git a/plugin.xml b/plugin.xml index 341b4be..9f75db2 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.2.3"> InAppBrowser Cordova InAppBrowser Plugin Apache 2.0 From ce7a796cb0c5421db0490ae97d9ca99b96dd23e7 Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Wed, 9 Oct 2013 16:06:19 -0700 Subject: [PATCH 07/11] [CB-5010] Incremented plugin version on dev branch. --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 9f75db2..5ad40e2 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.2.4-dev"> InAppBrowser Cordova InAppBrowser Plugin Apache 2.0 From c7972b6cffcedae7a9bbbeb66875a5d2fb37ce29 Mon Sep 17 00:00:00 2001 From: Shazron Abdullah Date: Tue, 15 Oct 2013 15:00:09 -0700 Subject: [PATCH 08/11] CB-4930 - iOS - InAppBrowser should take into account the status bar --- src/ios/CDVInAppBrowser.m | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 4170dd2..5711e76 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -32,6 +32,11 @@ #pragma mark CDVInAppBrowser +@interface CDVInAppBrowser () { + UIStatusBarStyle _previousStatusBarStyle; +} +@end + @implementation CDVInAppBrowser - (CDVInAppBrowser*)initWithWebView:(UIWebView*)theWebView @@ -115,6 +120,7 @@ } } + _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; CDVInAppBrowserOptions* browserOptions = [CDVInAppBrowserOptions parseOptions:options]; [self.inAppBrowserViewController showLocationBar:browserOptions.location]; @@ -155,8 +161,13 @@ } if (! browserOptions.hidden) { + + UINavigationController* nav = [[UINavigationController alloc] + initWithRootViewController:self.inAppBrowserViewController]; + nav.navigationBarHidden = YES; + if (self.viewController.modalViewController != self.inAppBrowserViewController) { - [self.viewController presentModalViewController:self.inAppBrowserViewController animated:YES]; + [self.viewController presentModalViewController:nav animated:YES]; } } [self.inAppBrowserViewController navigateTo:url]; @@ -166,7 +177,13 @@ { if ([self.inAppBrowserViewController isViewLoaded] && self.inAppBrowserViewController.view.window) return; - [self.viewController presentModalViewController:self.inAppBrowserViewController animated:YES]; + + _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle; + + UINavigationController* nav = [[UINavigationController alloc] + initWithRootViewController:self.inAppBrowserViewController]; + nav.navigationBarHidden = YES; + [self.viewController presentModalViewController:nav animated:YES]; } - (void)openInCordovaWebView:(NSURL*)url withOptions:(NSString*)options @@ -362,6 +379,10 @@ // Don't recycle the ViewController since it may be consuming a lot of memory. // Also - this is required for the PDF/User-Agent bug work-around. self.inAppBrowserViewController = nil; + + if (IsAtLeastiOSVersion(@"7.0")) { + [[UIApplication sharedApplication] setStatusBarStyle:_previousStatusBarStyle]; + } } @end @@ -632,6 +653,11 @@ [CDVUserAgentUtil releaseLock:&_userAgentLockToken]; [super viewDidUnload]; } + +- (UIStatusBarStyle)preferredStatusBarStyle +{ + return UIStatusBarStyleDefault; +} - (void)close { @@ -674,6 +700,15 @@ { [self.webView goForward]; } + +- (void)viewWillAppear:(BOOL)animated +{ + if (IsAtLeastiOSVersion(@"7.0")) { + [[UIApplication sharedApplication] setStatusBarStyle:[self preferredStatusBarStyle]]; + } + + [super viewWillAppear:animated]; +} #pragma mark UIWebViewDelegate From aa81c3267a5b1c337b09933ff5ceb06a93f9dbb7 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Mon, 21 Oct 2013 13:16:54 -0400 Subject: [PATCH 09/11] CB-4995 Fix crash when WebView is quickly opened then closed. Also fixes a leak where callback was never being cleared. --- src/ios/CDVInAppBrowser.m | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 5711e76..4ef051f 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -56,12 +56,8 @@ - (void)close:(CDVInvokedUrlCommand*)command { - if (self.inAppBrowserViewController != nil) { - [self.inAppBrowserViewController close]; - self.inAppBrowserViewController = nil; - } - - self.callbackId = nil; + // Things are cleaned up in browserExit. + [self.inAppBrowserViewController close]; } - (BOOL) isSystemUrl:(NSURL*)url @@ -372,14 +368,15 @@ if (self.callbackId != nil) { CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:@{@"type":@"exit"}]; - [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]]; - [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId]; + self.callbackId = nil; } + // Set navigationDelegate to nil to ensure no callbacks are received from it. + self.inAppBrowserViewController.navigationDelegate = nil; // Don't recycle the ViewController since it may be consuming a lot of memory. // Also - this is required for the PDF/User-Agent bug work-around. self.inAppBrowserViewController = nil; - + if (IsAtLeastiOSVersion(@"7.0")) { [[UIApplication sharedApplication] setStatusBarStyle:_previousStatusBarStyle]; } From b3348cff6c3f0e66a2bad573dbc1a47c986ada37 Mon Sep 17 00:00:00 2001 From: hermwong Date: Tue, 22 Oct 2013 13:40:00 -0700 Subject: [PATCH 10/11] CB-5128: added repo + issue tag to plugin.xml for inappbrowser plugin --- plugin.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin.xml b/plugin.xml index 5ad40e2..e844766 100644 --- a/plugin.xml +++ b/plugin.xml @@ -7,6 +7,8 @@ Cordova InAppBrowser Plugin Apache 2.0 cordova,in,app,browser,inappbrowser + https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git + https://issues.apache.org/jira/browse/CB/component/12320641 From e5868f8ecb0bd1f1a7a4fd868a437efab7dd020a Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Mon, 28 Oct 2013 12:03:26 -0700 Subject: [PATCH 11/11] [CB-5188] Updated version and RELEASENOTES.md for release 0.2.4 --- RELEASENOTES.md | 14 +++++++++++++- plugin.xml | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 548a6a2..a85c6d6 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -35,4 +35,16 @@ ### 0.2.3 (Oct 9, 2013) * [CB-4915] Incremented plugin version on dev branch. -* [CB-4926] Fixes inappbrowser plugin loading for windows8 \ No newline at end of file +* [CB-4926] Fixes inappbrowser plugin loading for windows8 + +### 0.2.4 (Oct 28, 2013) +* CB-5128: added repo + issue tag to plugin.xml for inappbrowser plugin +* CB-4995 Fix crash when WebView is quickly opened then closed. +* CB-4930 - iOS - InAppBrowser should take into account the status bar +* [CB-5010] Incremented plugin version on dev branch. +* [CB-5010] Updated version and RELEASENOTES.md for release 0.2.3 +* CB-4858 - Run IAB methods on the UI thread. +* CB-4858 Convert relative URLs to absolute URLs in JS +* CB-3747 Fix back button having different dismiss logic from the close button. +* CB-5021 Expose closeDialog() as a public function and make it safe to call multiple times. +* CB-5021 Make it safe to call close() multiple times diff --git a/plugin.xml b/plugin.xml index e844766..d0f2bf4 100644 --- a/plugin.xml +++ b/plugin.xml @@ -2,7 +2,7 @@ + version="0.2.4"> InAppBrowser Cordova InAppBrowser Plugin Apache 2.0