Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: apache/cordova-plugin-inappbrowser
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: caremonkey/cordova-plugin-inappbrowser
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 6 commits
  • 17 files changed
  • 1 contributor

Commits on Dec 5, 2019

  1. Copy the full SHA
    87857d5 View commit details
  2. Copy the full SHA
    e503da5 View commit details

Commits on Mar 12, 2020

  1. Copy the full SHA
    4db0b9c View commit details
  2. Copy the full SHA
    35ccfc5 View commit details

Commits on Mar 13, 2020

  1. Revert "add statusbar hack back in"

    This reverts commit 35ccfc5.
    Andythurlow committed Mar 13, 2020
    Copy the full SHA
    ea4b38f View commit details
  2. Revert "merge upstream master(original repo) into this"

    This reverts commit 4db0b9c, reversing
    changes made to e503da5.
    Andythurlow committed Mar 13, 2020
    Copy the full SHA
    63e5c73 View commit details
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -131,23 +131,26 @@ instance, or the system browser.

iOS supports these additional options:

- __usewkwebview__: set to `yes` to use WKWebView engine for the InappBrowser. Omit or set to `no` (default) to use UIWebView. Note: Using `usewkwebview=yes` requires that a WKWebView engine plugin be installed in the Cordova project (e.g. [cordova-plugin-wkwebview-engine](https://github.com/apache/cordova-plugin-wkwebview-engine) or [cordova-plugin-ionic-webview](https://github.com/ionic-team/cordova-plugin-ionic-webview)).
- __hidden__: set to `yes` to create the browser and load the page, but not show it. The loadstop event fires when loading is complete. Omit or set to `no` (default) to have the browser open and load normally.
- __beforeload__: set to enable the `beforeload` event to modify which pages are actually loaded in the browser. Accepted values are `get` to intercept only GET requests, `post` to intercept on POST requests or `yes` to intercept both GET & POST requests. Note that POST requests are not currently supported and will be ignored (if you set `beforeload=post` it will raise an error).
- __clearcache__: set to `yes` to have the browser's cookie cache cleared before the new window is opened
- __clearsessioncache__: set to `yes` to have the session cookie cache cleared before the new window is opened. For WKWebView, requires iOS 11+ on target device.
- __cleardata__: set to `yes` to have the browser's entire local storage cleared (cookies, HTML5 local storage, IndexedDB, etc.) before the new window is opened
- __closebuttoncolor__: set as a valid hex color string, for example: `#00ff00`, to change from the default __Done__ button's color. Only applicable if toolbar is not disabled.
- __closebuttoncaption__: set to a string to use as the __Done__ button's caption. Note that you need to localize this value yourself.
- __disallowoverscroll__: Set to `yes` or `no` (default is `no`). Turns on/off the the bounce of the WKWebView's UIScrollView.
- __disallowoverscroll__: Set to `yes` or `no` (default is `no`). Turns on/off the UIWebViewBounce property.
- __hidenavigationbuttons__: set to `yes` or `no` to turn the toolbar navigation buttons on or off (defaults to `no`). Only applicable if toolbar is not disabled.
- __navigationbuttoncolor__: set as a valid hex color string, for example: `#00ff00`, to change from the default color. Only applicable if navigation buttons are visible.
- __toolbar__: set to `yes` or `no` to turn the toolbar on or off for the InAppBrowser (defaults to `yes`)
- __toolbarcolor__: set as a valid hex color string, for example: `#00ff00`, to change from the default color of the toolbar. Only applicable if toolbar is not disabled.
- __toolbartranslucent__: set to `yes` or `no` to make the toolbar translucent(semi-transparent) (defaults to `yes`). Only applicable if toolbar is not disabled.
- __lefttoright__: Set to `yes` to swap positions of the navigation buttons and the close button. Specifically, close button goes to the right and navigation buttons to the left.
- __enableViewportScale__: Set to `yes` or `no` to prevent viewport scaling through a meta tag (defaults to `no`).
- __mediaPlaybackRequiresUserAction__: Set to `yes` to prevent HTML5 audio or video from autoplaying (defaults to `no`).
- __allowInlineMediaPlayback__: Set to `yes` or `no` to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface. The HTML's `video` element must also include the `webkit-playsinline` attribute (defaults to `no`).
- __enableViewportScale__: Set to `yes` or `no` to prevent viewport scaling through a meta tag (defaults to `no`). Only applicable to UIWebView (`usewkwebview=no`) and WKWebView (`usewkwebview=yes`) on iOS 10+.
- __mediaPlaybackRequiresUserAction__: Set to `yes` to prevent HTML5 audio or video from autoplaying (defaults to `no`). Applicable to UIWebView (`usewkwebview=no`) and WKWebView (`usewkwebview=yes`).
- __allowInlineMediaPlayback__: Set to `yes` or `no` to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface. The HTML's `video` element must also include the `webkit-playsinline` attribute (defaults to `no`). Applicable to UIWebView (`usewkwebview=no`) and WKWebView (`usewkwebview=yes`).
- __keyboardDisplayRequiresUserAction__: Set to `yes` or `no` to open the keyboard when form elements receive focus via JavaScript's `focus()` call (defaults to `yes`). Only applicable to UIWebView (`usewkwebview=no`).
- __suppressesIncrementalRendering__: Set to `yes` or `no` to wait until all new view content is received before being rendered (defaults to `no`). Only applicable to UIWebView (`usewkwebview=no`).
- __presentationstyle__: Set to `pagesheet`, `formsheet` or `fullscreen` to set the [presentation style](http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalPresentationStyle) (defaults to `fullscreen`).
- __transitionstyle__: Set to `fliphorizontal`, `crossdissolve` or `coververtical` to set the [transition style](http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle) (defaults to `coververtical`).
- __toolbarposition__: Set to `top` or `bottom` (default is `bottom`). Causes the toolbar to be at the top or bottom of the window.
9 changes: 0 additions & 9 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -20,15 +20,6 @@
-->
# Release Notes

### 3.2.0 (Jan 04, 2020)
* [GH-503](https://github.com/apache/cordova-plugin-inappbrowser/pull/503) Defensive code to prevent NULL reference exceptions for async
* [GH-584](https://github.com/apache/cordova-plugin-inappbrowser/pull/584) Add compile-time decision for disabling UIWebView
* [GH-524](https://github.com/apache/cordova-plugin-inappbrowser/pull/524) Replace "beforeload" with BEFORELOAD
* [GH-568](https://github.com/apache/cordova-plugin-inappbrowser/pull/568) Update missing closed brace to the insert.CSS
* [GH-401](https://github.com/apache/cordova-plugin-inappbrowser/pull/401) Move createIframeBridge to injectDeferredObject
* [GH-534](https://github.com/apache/cordova-plugin-inappbrowser/pull/534) Fix `InAppBrowser` not opening on **iOS** 13
* ci(travis) Upgrade to node8

### 3.1.0 (Jun 27, 2019)

- chore: fix repo and issue urls and license in package.json and plugin.xml ([`8edfb9e`](https://github.com/apache/cordova-plugin-inappbrowser/commit/8edfb9e))
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-inappbrowser",
"version": "3.2.1-dev",
"version": "3.1.1-dev",
"description": "Cordova InAppBrowser Plugin",
"types": "./types/index.d.ts",
"cordova": {
15 changes: 14 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@

<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-inappbrowser"
version="3.2.1-dev">
version="3.1.1-dev">

<name>InAppBrowser</name>
<description>Cordova InAppBrowser Plugin</description>
@@ -75,14 +75,27 @@
</js-module>
<config-file target="config.xml" parent="/*">
<feature name="InAppBrowser">
<param name="ios-package" value="CDVInAppBrowser" />
<param name="onload" value="true" />
</feature>
<feature name="UIInAppBrowser">
<param name="ios-package" value="CDVUIInAppBrowser" />
<param name="onload" value="true" />
</feature>
<feature name="WKInAppBrowser">
<param name="ios-package" value="CDVWKInAppBrowser" />
<param name="onload" value="true" />
</feature>
</config-file>

<header-file src="src/ios/CDVInAppBrowser.h" />
<source-file src="src/ios/CDVInAppBrowser.m" />
<header-file src="src/ios/CDVInAppBrowserOptions.h" />
<source-file src="src/ios/CDVInAppBrowserOptions.m" />
<header-file src="src/ios/CDVInAppBrowserNavigationController.h" />
<source-file src="src/ios/CDVInAppBrowserNavigationController.m" />
<header-file src="src/ios/CDVUIInAppBrowser.h" />
<source-file src="src/ios/CDVUIInAppBrowser.m" />
<header-file src="src/ios/CDVWKInAppBrowser.h" />
<source-file src="src/ios/CDVWKInAppBrowser.m" />
<header-file src="src/ios/CDVWKInAppBrowserUIDelegate.h" />
52 changes: 24 additions & 28 deletions src/android/InAppBrowser.java
Original file line number Diff line number Diff line change
@@ -313,9 +313,7 @@ else if (action.equals("show")) {
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (dialog != null) {
dialog.show();
}
dialog.show();
}
});
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK);
@@ -326,9 +324,7 @@ else if (action.equals("hide")) {
this.cordova.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (dialog != null) {
dialog.hide();
}
dialog.hide();
}
});
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK);
@@ -441,7 +437,7 @@ private HashMap<String, String> parseFeature(String optString) {
if (option.hasMoreElements()) {
String key = option.nextToken();
String value = option.nextToken();
if (!customizableOptions.contains(key)) {
if (!customizableOptions.contains(key)){
value = value.equals("yes") || value.equals("no") ? value : "yes";
}
map.put(key, value);
@@ -620,7 +616,7 @@ private boolean getShowLocationBar() {
return this.showLocationBar;
}

private InAppBrowser getInAppBrowser() {
private InAppBrowser getInAppBrowser(){
return this;
}

@@ -734,7 +730,7 @@ private int dpToPixels(int dipValue) {
return value;
}

private View createCloseButton(int id) {
private View createCloseButton(int id){
View _close;
Resources activityRes = cordova.getActivity().getResources();

@@ -910,9 +906,9 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
// Footer
RelativeLayout footer = new RelativeLayout(cordova.getActivity());
int _footerColor;
if(footerColor != "") {
if(footerColor != ""){
_footerColor = Color.parseColor(footerColor);
} else {
}else{
_footerColor = android.graphics.Color.LTGRAY;
}
footer.setBackgroundColor(_footerColor);
@@ -1069,14 +1065,12 @@ public void postMessage(String data) {
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.MATCH_PARENT;

if (dialog != null) {
dialog.setContentView(main);
dialog.show();
dialog.getWindow().setAttributes(lp);
}
dialog.setContentView(main);
dialog.show();
dialog.getWindow().setAttributes(lp);
// the goal of openhidden is to load the url and not display it
// Show() needs to be called to cause the URL to be loaded
if (openWindowHidden && dialog != null) {
if(openWindowHidden) {
dialog.hide();
}
}
@@ -1214,26 +1208,26 @@ public boolean shouldOverrideUrlLoading(String url, String method) {

if (beforeload.equals("yes") && method == null) {
useBeforeload = true;
} else if(beforeload.equals("yes")
}else if(beforeload.equals("yes")
//TODO handle POST requests then this condition can be removed:
&& !method.equals("POST"))
{
useBeforeload = true;
} else if(beforeload.equals("get") && (method == null || method.equals("GET"))) {
}else if(beforeload.equals("get") && (method == null || method.equals("GET"))){
useBeforeload = true;
} else if(beforeload.equals("post") && (method == null || method.equals("POST"))) {
}else if(beforeload.equals("post") && (method == null || method.equals("POST"))){
//TODO handle POST requests
errorMessage = "beforeload doesn't yet support POST requests";
}

// On first URL change, initiate JS callback. Only after the beforeload event, continue.
if (useBeforeload && this.waitForBeforeload) {
if(sendBeforeLoad(url, method)) {
if(sendBeforeLoad(url, method)){
return true;
}
}

if(errorMessage != null) {
if(errorMessage != null){
try {
LOG.e(LOG_TAG, errorMessage);
JSONObject obj = new JSONObject();
@@ -1242,7 +1236,7 @@ public boolean shouldOverrideUrlLoading(String url, String method) {
obj.put("code", -1);
obj.put("message", errorMessage);
sendUpdate(obj, true, PluginResult.Status.ERROR);
} catch(Exception e) {
}catch(Exception e){
LOG.e(LOG_TAG, "Error sending loaderror for " + url + ": " + e.toString());
}
}
@@ -1328,12 +1322,12 @@ else if (!url.startsWith("http:") && !url.startsWith("https:") && url.matches("^
return override;
}

private boolean sendBeforeLoad(String url, String method) {
private boolean sendBeforeLoad(String url, String method){
try {
JSONObject obj = new JSONObject();
obj.put("type", BEFORELOAD);
obj.put("type", "beforeload");
obj.put("url", url);
if(method != null) {
if(method != null){
obj.put("method", method);
}
sendUpdate(obj, true);
@@ -1371,7 +1365,7 @@ public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceReque
return shouldInterceptRequest(request.getUrl().toString(), super.shouldInterceptRequest(view, request), request.getMethod());
}

public WebResourceResponse shouldInterceptRequest(String url, WebResourceResponse response, String method) {
public WebResourceResponse shouldInterceptRequest(String url, WebResourceResponse response, String method){
return response;
}

@@ -1412,11 +1406,13 @@ public void onPageStarted(WebView view, String url, Bitmap favicon) {
}
}



public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);

// Set the namespace for postMessage()
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1){
injectDeferredObject("window.webkit={messageHandlers:{cordova_iab:cordova_iab}}", null);
}

36 changes: 36 additions & 0 deletions src/ios/CDVInAppBrowser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/

#import <Cordova/CDVPlugin.h>
#import <Cordova/CDVInvokedUrlCommand.h>

@interface CDVInAppBrowser : CDVPlugin {}

@property (nonatomic, assign) BOOL wkwebviewavailable;
@property (nonatomic, assign) BOOL usewkwebview;

- (void)open:(CDVInvokedUrlCommand*)command;
- (void)close:(CDVInvokedUrlCommand*)command;
- (void)injectScriptCode:(CDVInvokedUrlCommand*)command;
- (void)show:(CDVInvokedUrlCommand*)command;
- (void)hide:(CDVInvokedUrlCommand*)command;
- (void)loadAfterBeforeload:(CDVInvokedUrlCommand*)command;

@end

Loading