Compare commits

..

1 Commits

Author SHA1 Message Date
Jan Piotrowski 7449688117 Revert "remove failing platform"
This reverts commit bdb4656aa3535fb566764ee62c8dd880f7faba3e.
2019-06-28 23:15:00 +02:00
13 changed files with 94 additions and 164 deletions
+4 -2
View File
@@ -12,12 +12,12 @@ addons:
env:
global:
- SAUCE_USERNAME=snay
- TRAVIS_NODE_VERSION=8
- TRAVIS_NODE_VERSION=6
- ANDROID_API_LEVEL=28
- ANDROID_BUILD_TOOLS_VERSION=28.0.3
language: node_js
node_js: 8
node_js: 6
# yaml anchor/alias: https://medium.com/@tommyvn/travis-yml-dry-with-anchors-8b6a3ac1b027
@@ -57,6 +57,8 @@ matrix:
<<: *_ios
- env: PLATFORM=ios-12.0
<<: *_ios
- env: PLATFORM=ios-12.2
<<: *_ios
- env: PLATFORM=android-5.1
<<: *_android
+2 -2
View File
@@ -256,7 +256,7 @@ function loadStopCallBack() {
if (inAppBrowserRef != undefined) {
inAppBrowserRef.insertCSS({ code: "body{font-size: 25px;}" });
inAppBrowserRef.insertCSS({ code: "body{font-size: 25px;" });
inAppBrowserRef.executeScript({ code: "\
var message = 'this is the message';\
@@ -621,7 +621,7 @@ function loadStopCallBack() {
if (inAppBrowserRef != undefined) {
inAppBrowserRef.insertCSS({ code: "body{font-size: 25px;}" });
inAppBrowserRef.insertCSS({ code: "body{font-size: 25px;" });
$('#status-message').text("");
-9
View File
@@ -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))
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-inappbrowser",
"version": "3.2.0",
"version": "3.1.1-dev",
"description": "Cordova InAppBrowser Plugin",
"types": "./types/index.d.ts",
"cordova": {
+1 -1
View File
@@ -20,7 +20,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-inappbrowser"
version="3.2.0">
version="3.1.1-dev">
<name>InAppBrowser</name>
<description>Cordova InAppBrowser Plugin</description>
+24 -28
View File
@@ -313,9 +313,7 @@ public class InAppBrowser extends CordovaPlugin {
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 @@ public class InAppBrowser extends CordovaPlugin {
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 @@ public class InAppBrowser extends CordovaPlugin {
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 @@ public class InAppBrowser extends CordovaPlugin {
return this.showLocationBar;
}
private InAppBrowser getInAppBrowser() {
private InAppBrowser getInAppBrowser(){
return this;
}
@@ -734,7 +730,7 @@ public class InAppBrowser extends CordovaPlugin {
return value;
}
private View createCloseButton(int id) {
private View createCloseButton(int id){
View _close;
Resources activityRes = cordova.getActivity().getResources();
@@ -910,9 +906,9 @@ public class InAppBrowser extends CordovaPlugin {
// 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 class InAppBrowser extends CordovaPlugin {
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 class InAppBrowser extends CordovaPlugin {
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 class InAppBrowser extends CordovaPlugin {
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 @@ public class InAppBrowser extends CordovaPlugin {
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 class InAppBrowser extends CordovaPlugin {
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 class InAppBrowser extends CordovaPlugin {
}
}
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);
}
+46 -84
View File
@@ -19,9 +19,7 @@
#import "CDVInAppBrowser.h"
#import "CDVInAppBrowserOptions.h"
#if !WK_WEB_VIEW_ONLY
#import "CDVUIInAppBrowser.h"
#endif
#import "CDVWKInAppBrowser.h"
#import <Cordova/CDVPluginResult.h>
@@ -51,122 +49,86 @@
return;
}
self.usewkwebview = browserOptions.usewkwebview;
#if WK_WEB_VIEW_ONLY
[[CDVWKInAppBrowser getInstance] open:command];
#else
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] open:command];
}else{
[[CDVUIInAppBrowser getInstance] open:command];
}
#endif
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] open:command];
}else{
[[CDVUIInAppBrowser getInstance] open:command];
}
}
- (void)close:(CDVInvokedUrlCommand*)command
{
#if WK_WEB_VIEW_ONLY
[[CDVWKInAppBrowser getInstance] close:command];
#else
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] close:command];
}else{
[[CDVUIInAppBrowser getInstance] close:command];
}
#endif
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] close:command];
}else{
[[CDVUIInAppBrowser getInstance] close:command];
}
}
- (void)show:(CDVInvokedUrlCommand*)command
{
#if WK_WEB_VIEW_ONLY
[[CDVWKInAppBrowser getInstance] show:command];
#else
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] show:command];
}else{
[[CDVUIInAppBrowser getInstance] show:command];
}
#endif
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] show:command];
}else{
[[CDVUIInAppBrowser getInstance] show:command];
}
}
- (void)hide:(CDVInvokedUrlCommand*)command
{
#if WK_WEB_VIEW_ONLY
[[CDVWKInAppBrowser getInstance] hide:command];
#else
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] hide:command];
}else{
[[CDVUIInAppBrowser getInstance] hide:command];
}
#endif
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] hide:command];
}else{
[[CDVUIInAppBrowser getInstance] hide:command];
}
}
- (void)injectScriptCode:(CDVInvokedUrlCommand*)command
{
#if WK_WEB_VIEW_ONLY
[[CDVWKInAppBrowser getInstance] injectScriptCode:command];
#else
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] injectScriptCode:command];
}else{
[[CDVUIInAppBrowser getInstance] injectScriptCode:command];
}
#endif
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] injectScriptCode:command];
}else{
[[CDVUIInAppBrowser getInstance] injectScriptCode:command];
}
}
- (void)injectScriptFile:(CDVInvokedUrlCommand*)command
{
#if WK_WEB_VIEW_ONLY
[[CDVWKInAppBrowser getInstance] injectScriptFile:command];
#else
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] injectScriptFile:command];
}else{
[[CDVUIInAppBrowser getInstance] injectScriptFile:command];
}
#endif
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] injectScriptFile:command];
}else{
[[CDVUIInAppBrowser getInstance] injectScriptFile:command];
}
}
- (void)injectStyleCode:(CDVInvokedUrlCommand*)command
{
#if WK_WEB_VIEW_ONLY
[[CDVWKInAppBrowser getInstance] injectStyleCode:command];
#else
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] injectStyleCode:command];
}else{
[[CDVUIInAppBrowser getInstance] injectStyleCode:command];
}
#endif
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] injectStyleCode:command];
}else{
[[CDVUIInAppBrowser getInstance] injectStyleCode:command];
}
}
- (void)injectStyleFile:(CDVInvokedUrlCommand*)command
{
#if WK_WEB_VIEW_ONLY
[[CDVWKInAppBrowser getInstance] injectStyleFile:command];
#else
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] injectStyleFile:command];
}else{
[[CDVUIInAppBrowser getInstance] injectStyleFile:command];
}
#endif
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] injectStyleFile:command];
}else{
[[CDVUIInAppBrowser getInstance] injectStyleFile:command];
}
}
- (void)loadAfterBeforeload:(CDVInvokedUrlCommand*)command
{
#if WK_WEB_VIEW_ONLY
[[CDVWKInAppBrowser getInstance] loadAfterBeforeload:command];
#else
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] loadAfterBeforeload:command];
}else{
[[CDVUIInAppBrowser getInstance] loadAfterBeforeload:command];
}
#endif
if(self.usewkwebview){
[[CDVWKInAppBrowser getInstance] loadAfterBeforeload:command];
}else{
[[CDVUIInAppBrowser getInstance] loadAfterBeforeload:command];
}
}
@end
@end
-4
View File
@@ -17,8 +17,6 @@
under the License.
*/
#if !WK_WEB_VIEW_ONLY
#import <Cordova/CDVPlugin.h>
#import <Cordova/CDVInvokedUrlCommand.h>
#import <Cordova/CDVScreenOrientationDelegate.h>
@@ -91,5 +89,3 @@
- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVInAppBrowserOptions*) browserOptions;
@end
#endif
+2 -4
View File
@@ -17,8 +17,6 @@
under the License.
*/
#if !WK_WEB_VIEW_ONLY
#import "CDVUIInAppBrowser.h"
#import <Cordova/CDVPluginResult.h>
#import <Cordova/CDVUserAgentUtil.h>
@@ -365,7 +363,6 @@ static CDVUIInAppBrowser* instance = nil;
- (void)injectDeferredObject:(NSString*)source withWrapper:(NSString*)jsWrapper
{
[self createIframeBridge];
if (jsWrapper != nil) {
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:@[source] options:0 error:nil];
NSString* sourceArrayString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
@@ -568,6 +565,7 @@ static CDVUIInAppBrowser* instance = nil;
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
{
[self createIframeBridge];
if (self.callbackId != nil) {
// TODO: It would be more useful to return the URL the page is actually on (e.g. if it's been redirected).
NSString* url = [self.inAppBrowserViewController.currentURL absoluteString];
@@ -1128,4 +1126,4 @@ static CDVUIInAppBrowser* instance = nil;
@end
#endif
-2
View File
@@ -27,8 +27,6 @@
@class CDVWKInAppBrowserViewController;
@interface CDVWKInAppBrowser : CDVPlugin {
UIWindow * tmpWindow;
@private
NSString* _beforeload;
BOOL _waitForBeforeload;
+12 -25
View File
@@ -80,7 +80,6 @@ static CDVWKInAppBrowser* instance = nil;
NSLog(@"IAB.close() called but it was already closed.");
return;
}
// Things are cleaned up in browserExit.
[self.inAppBrowserViewController close];
}
@@ -276,9 +275,7 @@ static CDVWKInAppBrowser* instance = nil;
_waitForBeforeload = ![_beforeload isEqualToString:@""];
[self.inAppBrowserViewController navigateTo:url];
if (!browserOptions.hidden) {
[self show:nil withNoAnimate:browserOptions.hidden];
}
[self show:nil withNoAnimate:browserOptions.hidden];
}
- (void)show:(CDVInvokedUrlCommand*)command{
@@ -317,21 +314,19 @@ static CDVWKInAppBrowser* instance = nil;
dispatch_async(dispatch_get_main_queue(), ^{
if (weakSelf.inAppBrowserViewController != nil) {
float osVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
__strong __typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf->tmpWindow) {
CGRect frame = [[UIScreen mainScreen] bounds];
if(initHidden && osVersion < 11){
frame.origin.x = -10000;
}
strongSelf->tmpWindow = [[UIWindow alloc] initWithFrame:frame];
CGRect frame = [[UIScreen mainScreen] bounds];
if(initHidden && osVersion < 11){
frame.origin.x = -10000;
}
UIWindow *tmpWindow = [[UIWindow alloc] initWithFrame:frame];
UIViewController *tmpController = [[UIViewController alloc] init];
[strongSelf->tmpWindow setRootViewController:tmpController];
[strongSelf->tmpWindow setWindowLevel:UIWindowLevelNormal];
[tmpWindow setRootViewController:tmpController];
[tmpWindow setWindowLevel:UIWindowLevelNormal];
if(!initHidden || osVersion < 11){
[self->tmpWindow makeKeyAndVisible];
[tmpWindow makeKeyAndVisible];
}
[tmpController presentViewController:nav animated:!noAnimate completion:nil];
}
@@ -340,10 +335,6 @@ static CDVWKInAppBrowser* instance = nil;
- (void)hide:(CDVInvokedUrlCommand*)command
{
// Set tmpWindow to hidden to make main webview responsive to touch again
// https://stackoverflow.com/questions/4544489/how-to-remove-a-uiwindow
self->tmpWindow.hidden = YES;
if (self.inAppBrowserViewController == nil) {
NSLog(@"Tried to hide IAB after it was closed.");
return;
@@ -699,10 +690,6 @@ static CDVWKInAppBrowser* instance = nil;
// Set navigationDelegate to nil to ensure no callbacks are received from it.
self.inAppBrowserViewController.navigationDelegate = nil;
self.inAppBrowserViewController = nil;
// Set tmpWindow to hidden to make main webview responsive to touch again
// Based on https://stackoverflow.com/questions/4544489/how-to-remove-a-uiwindow
self->tmpWindow.hidden = YES;
if (IsAtLeastiOSVersion(@"7.0")) {
if (_previousStatusBarStyle != -1) {
@@ -799,7 +786,7 @@ BOOL isExiting = FALSE;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
if (@available(iOS 11.0, *)) {
[self.webView.scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
[self.webView.scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
}
#endif
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-inappbrowser-tests",
"version": "3.2.0",
"version": "3.1.1-dev",
"description": "",
"cordova": {
"id": "cordova-plugin-inappbrowser-tests",
+1 -1
View File
@@ -20,7 +20,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-inappbrowser-tests"
version="3.2.0">
version="3.1.1-dev">
<name>Cordova InAppBrowser Plugin Tests</name>
<license>Apache 2.0</license>