Commit 1a7ab4d5 authored by Thierry BUGEAT's avatar Thierry BUGEAT

#46 Update Cordova plugins.

parent f1ed908b
......@@ -7,24 +7,24 @@
"files": {}
},
"installed_plugins": {
"cordova-plugin-whitelist": {
"PACKAGE_NAME": "com.bugeat.myfeeds"
},
"cordova-plugin-device": {
"PACKAGE_NAME": "com.bugeat.myfeeds"
},
"cordova-plugin-file": {
"PACKAGE_NAME": "com.bugeat.myfeeds"
},
"cordova-plugin-network-information": {
"cordova-plugin-inappbrowser": {
"PACKAGE_NAME": "com.bugeat.myfeeds"
},
"cordova-plugin-inappbrowser": {
"cordova-plugin-whitelist": {
"PACKAGE_NAME": "com.bugeat.myfeeds"
},
"cordova-plugin-x-socialsharing": {
"PACKAGE_NAME": "com.bugeat.myfeeds"
},
"cordova-plugin-network-information": {
"PACKAGE_NAME": "com.bugeat.myfeeds"
},
"cordova-plugin-vibration": {
"PACKAGE_NAME": "com.bugeat.myfeeds"
}
......
......@@ -26,7 +26,7 @@ Anyone can contribute to Cordova. And we need your contributions.
There are multiple ways to contribute: report bugs, improve the docs, and
contribute code.
For instructions on this, start with the
For instructions on this, start with the
[contribution overview](http://cordova.apache.org/contribute/).
The details are explained there, but the important items are:
......@@ -35,3 +35,30 @@ The details are explained there, but the important items are:
- Run the tests so your patch doesn't break existing functionality.
We look forward to your contributions!
The notes on [Commit Workflow](https://github.com/apache/cordova-coho/blob/master/docs/committer-workflow.md#commit-workflow) can be helpful even if you are not a committer.
## Running plugin tests
* clone and install [cordova-plugin-test-framework](https://github.com/apache/cordova-plugin-test-framework)
```
git clone git@github.com:apache/cordova-plugin-test-framework.git
```
* edit ```cordova-plugin-test-framework/www/assets/index.html``` and add the following line
```
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com http://cordova.apache.org http://google.co.uk https://google.co.uk 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
```
* create test project
```
cordova create plugintest
cd plugintest
cordova platform add android
cordova plugin add ../cordova-plugin-inappbrowser
cordova plugin add ../cordova-plugin-inappbrowser/tests
cordova plugin add ../cordova-plugin-test-framework
```
* edit ```config.xml``` and replace ```<content src="index.html" />``` with ```<content src="cdvtests/index.html" />```
* run application
```
cordova run
```
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -100,6 +100,7 @@ instance, or the system browser.
- __clearsessioncache__: set to `yes` to have the session cookie cache cleared before the new window is opened
- __zoom__: set to `yes` to show Android browser's zoom controls, set to `no` to hide them. Default value is `yes`.
- __hardwareback__: set to `yes` to use the hardware back button to navigate backwards through the `InAppBrowser`'s history. If there is no previous page, the `InAppBrowser` will close. The default value is `yes`, so you must set it to `no` if you want the back button to simply close the InAppBrowser.
- __mediaPlaybackRequiresUserAction__: Set to `yes` to prevent HTML5 audio or video from autoplaying (defaults to `no`).
iOS only:
......@@ -110,7 +111,7 @@ instance, or the system browser.
- __clearsessioncache__: set to `yes` to have the session cookie cache cleared before the new window is opened
- __toolbar__: set to `yes` or `no` to turn the toolbar on or off for the InAppBrowser (defaults to `yes`)
- __enableViewportScale__: Set to `yes` or `no` to prevent viewport scaling through a meta tag (defaults to `no`).
- __mediaPlaybackRequiresUserAction__: Set to `yes` or `no` to prevent HTML5 audio or video from autoplaying (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`)
- __keyboardDisplayRequiresUserAction__: Set to `yes` or `no` to open the keyboard when form elements receive focus via JavaScript's `focus()` call (defaults to `yes`).
- __suppressesIncrementalRendering__: Set to `yes` or `no` to wait until all new view content is received before being rendered (defaults to `no`).
......@@ -172,6 +173,10 @@ opened with `target='_blank'`. The rules might look like these
### Windows Quirks
Windows 8.0, 8.1 and Windows Phone 8.1 don't support remote urls to be opened in the Cordova WebView so remote urls are always showed in the system's web browser if opened with `target='_self'`.
On Windows 10 if the URL is NOT in the white list and is opened with `target='_self'` it will be showed in the system's web browser instead of InAppBrowser popup.
Similar to Firefox OS IAB window visual behaviour can be overridden via `inAppBrowserWrap`/`inAppBrowserWrapFullscreen` CSS classes
### Browser Quirks
......
......@@ -20,6 +20,42 @@
-->
# Release Notes
### 1.3.0 (Feb 09, 2016)
* [CB-3360](https://issues.apache.org/jira/browse/CB-3360) Set custom inappbrowser user agent for android
* [CB-10538](https://issues.apache.org/jira/browse/CB-10538) cordova-plugin-inappbrowser timeout issue
* [CB-10395](https://issues.apache.org/jira/browse/CB-10395) InAppBrowser's WebView not storing cookies reliable on Android
* Edit package.json license to match SPDX id
* [CB-10305](https://issues.apache.org/jira/browse/CB-10305) Gray bar appears in the wrong place on iOS
* [CB-7786](https://issues.apache.org/jira/browse/CB-7786) Support mediaPlaybackRequiresUserAction on Android
* [CB-7500](https://issues.apache.org/jira/browse/CB-7500) executeScript with callback kills/blurs inAppBrowser window on Android
### 1.2.1 (Feb 02, 2016)
* [CB-10407](https://issues.apache.org/jira/browse/CB-10407) InAppBrowser not firing loadstart event on android
* [CB-10428](https://issues.apache.org/jira/browse/CB-10428) Fix syntax error when browserifying inAppBrowser plugin
* handle app store urls in system browser
* [CB-6702](https://issues.apache.org/jira/browse/CB-6702) InAppBrowser hangs when opening more than one instance
* [CB-10456](https://issues.apache.org/jira/browse/CB-10456) InAppBrowser is not closed if I close it programmatically on Android
* [CB-10451](https://issues.apache.org/jira/browse/CB-10451) InAppBrowser: loadstart event is not triggered on Windows
* [CB-10452](https://issues.apache.org/jira/browse/CB-10452) InAppBrowser: 'exit' event is not triggered on Windows
* [CB-10454](https://issues.apache.org/jira/browse/CB-10454) InAppBrowser: 'loaderror' event does not have code and message on Windows
* [CB-10450](https://issues.apache.org/jira/browse/CB-10450) InAppBrowser: Unable to get property 'canGoBack' of undefined on Windows
* [CB-10441](https://issues.apache.org/jira/browse/CB-10441) Add auto tests for InAppBrowser plugin
### 1.2.0 (Jan 15, 2016)
* CB-8180: Changing methods of interception in `WebViewClient` class
* CB-10009 Improve `InAppBrowser` toolbar look and feel on **Windows**
* Open a new window on the **Browser** platform
### 1.1.1 (Dec 10, 2015)
* CB-9445 Improves executeScript callbacks on iOS
* CB-10035 Incremented plugin version.
* CB-10040 - re-fix: backwards compatible with cordova-ios < 4.0
* CB-8534: Allow plugins to respond to onReceivedHttpAuthRequest. This closes #82
* CB-3750: Fixes spinner on iOS. This closes #89
* CB-7696 Document target=_self behavior for Windows
* CB-10040 - Compile Error in InAppBrowser Plugin for iOS - No known instance method for selector 'URLIsWhitelisted:'
### 1.1.0 (Nov 18, 2015)
* [CB-10035](https://issues.apache.org/jira/browse/CB-10035) Updated `RELEASENOTES` to be newest to oldest
* Invoke webview if using local file
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
{
"name": "cordova-plugin-inappbrowser",
"version": "1.1.0",
"version": "1.3.0",
"description": "Cordova InAppBrowser Plugin",
"cordova": {
"id": "cordova-plugin-inappbrowser",
......@@ -44,5 +44,5 @@
}
],
"author": "Apache Software Foundation",
"license": "Apache 2.0"
"license": "Apache-2.0"
}
......@@ -20,7 +20,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-inappbrowser"
version="1.1.0">
version="1.3.0">
<name>InAppBrowser</name>
<description>Cordova InAppBrowser Plugin</description>
......
File mode changed from 100755 to 100644
This diff is collapsed.
File mode changed from 100755 to 100644
......@@ -21,6 +21,7 @@
var cordova = require('cordova'),
channel = require('cordova/channel'),
modulemapper = require('cordova/modulemapper'),
urlutil = require('cordova/urlutil');
var browserWrap,
......@@ -71,8 +72,10 @@ var IAB = {
features = args[2],
url;
if (target === "_system" || target === "_self" || !target) {
if (target === "_self" || !target) {
window.location = strUrl;
} else if (target === "_system") {
modulemapper.getOriginalSymbol(window, 'window.open').call(window, strUrl, "_blank");
} else {
// "_blank" or anything else
if (!browserWrap) {
......
......@@ -30,7 +30,6 @@
@class CDVInAppBrowserViewController;
@interface CDVInAppBrowser : CDVPlugin {
BOOL _injectedIframeBridge;
}
@property (nonatomic, retain) CDVInAppBrowserViewController* inAppBrowserViewController;
......
......@@ -231,16 +231,19 @@
- (void)openInCordovaWebView:(NSURL*)url withOptions:(NSString*)options
{
if ([self.commandDelegate URLIsWhitelisted:url]) {
NSURLRequest* request = [NSURLRequest requestWithURL:url];
NSURLRequest* request = [NSURLRequest requestWithURL:url];
#ifdef __CORDOVA_4_0_0
[self.webViewEngine loadRequest:request];
// the webview engine itself will filter for this according to <allow-navigation> policy
// in config.xml for cordova-ios-4.0
[self.webViewEngine loadRequest:request];
#else
if ([self.commandDelegate URLIsWhitelisted:url]) {
[self.webView loadRequest:request];
#endif
} else { // this assumes the InAppBrowser can be excepted from the white-list
[self openInInAppBrowser:url withOptions:options];
}
#endif
}
- (void)openInSystem:(NSURL*)url
......@@ -263,11 +266,8 @@
- (void)injectDeferredObject:(NSString*)source withWrapper:(NSString*)jsWrapper
{
if (!_injectedIframeBridge) {
_injectedIframeBridge = YES;
// Create an iframe bridge in the new document to communicate with the CDVInAppBrowserViewController
[self.inAppBrowserViewController.webView stringByEvaluatingJavaScriptFromString:@"(function(d){var e = _cdvIframeBridge = d.createElement('iframe');e.style.display='none';d.body.appendChild(e);})(document)"];
}
// Ensure an iframe bridge is created to communicate with the CDVInAppBrowserViewController
[self.inAppBrowserViewController.webView stringByEvaluatingJavaScriptFromString:@"(function(d){_cdvIframeBridge=d.getElementById('_cdvIframeBridge');if(!_cdvIframeBridge) {var e = _cdvIframeBridge = d.createElement('iframe');e.id='_cdvIframeBridge'; e.style.display='none';d.body.appendChild(e);}})(document)"];
if (jsWrapper != nil) {
NSData* jsonData = [NSJSONSerialization dataWithJSONObject:@[source] options:0 error:nil];
......@@ -390,7 +390,14 @@
[self.commandDelegate sendPluginResult:pluginResult callbackId:scriptCallbackId];
return NO;
}
} else if ((self.callbackId != nil) && isTopLevelNavigation) {
}
//if is an app store link, let the system handle it, otherwise it fails to load it
else if ([[ url scheme] isEqualToString:@"itms-appss"] || [[ url scheme] isEqualToString:@"itms-apps"]) {
[theWebView stopLoading];
[self openInSystem:url];
return NO;
}
else if ((self.callbackId != nil) && isTopLevelNavigation) {
// Send a loadstart event for each top-level navigation (includes redirects).
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
messageAsDictionary:@{@"type":@"loadstart", @"url":[url absoluteString]}];
......@@ -404,7 +411,6 @@
- (void)webViewDidStartLoad:(UIWebView*)theWebView
{
_injectedIframeBridge = NO;
}
- (void)webViewDidFinishLoad:(UIWebView*)theWebView
......@@ -512,15 +518,15 @@
self.webView.scalesPageToFit = NO;
self.webView.userInteractionEnabled = YES;
self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
self.spinner.alpha = 1.000;
self.spinner.autoresizesSubviews = YES;
self.spinner.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin;
self.spinner.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin);
self.spinner.clearsContextBeforeDrawing = NO;
self.spinner.clipsToBounds = NO;
self.spinner.contentMode = UIViewContentModeScaleToFill;
self.spinner.frame = CGRectMake(454.0, 231.0, 20.0, 20.0);
self.spinner.hidden = YES;
self.spinner.frame = CGRectMake(CGRectGetMidX(self.webView.frame), CGRectGetMidY(self.webView.frame), 20.0, 20.0);
self.spinner.hidden = NO;
self.spinner.hidesWhenStopped = YES;
self.spinner.multipleTouchEnabled = NO;
self.spinner.opaque = NO;
......@@ -749,6 +755,10 @@
return UIStatusBarStyleDefault;
}
- (BOOL)prefersStatusBarHidden {
return NO;
}
- (void)close
{
[CDVUserAgentUtil releaseLock:&_userAgentLockToken];
......@@ -994,13 +1004,26 @@
// simplified from: http://stackoverflow.com/a/25669695/219684
UIToolbar* bgToolbar = [[UIToolbar alloc] initWithFrame:frame];
UIToolbar* bgToolbar = [[UIToolbar alloc] initWithFrame:[self invertFrameIfNeeded:frame]];
bgToolbar.barStyle = UIBarStyleDefault;
[bgToolbar setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
[self.view addSubview:bgToolbar];
[super viewDidLoad];
}
- (CGRect) invertFrameIfNeeded:(CGRect)rect {
// We need to invert since on iOS 7 frames are always in Portrait context
if (!IsAtLeastiOSVersion(@"8.0")) {
if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) {
CGFloat temp = rect.size.width;
rect.size.width = rect.size.height;
rect.size.height = temp;
rect.origin = CGPointZero;
}
}
return rect;
}
#pragma mark CDVScreenOrientationDelegate
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
This diff is collapsed.
File mode changed from 100755 to 100644
......@@ -20,10 +20,12 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-inappbrowser-tests"
version="1.1.0">
version="1.3.0">
<name>Cordova InAppBrowser Plugin Tests</name>
<license>Apache 2.0</license>
<dependency id="cordova-plugin-dialogs" />
<js-module src="tests.js" name="tests">
</js-module>
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
......@@ -38,5 +38,8 @@
<button onclick="document.getElementById('player').play()"> play </button>
<button onclick="document.getElementById('player').pause()"> pause </button>
</div>
<script>
document.getElementById('player').play();
</script>
</body>
</html>
......@@ -24,6 +24,110 @@ var isWindows = cordova.platformId == 'windows';
window.alert = window.alert || navigator.notification.alert;
exports.defineAutoTests = function () {
describe('cordova.InAppBrowser', function () {
it("inappbrowser.spec.1 should exist", function () {
expect(cordova.InAppBrowser).toBeDefined();
});
it("inappbrowser.spec.2 should contain open function", function () {
expect(cordova.InAppBrowser.open).toBeDefined();
expect(cordova.InAppBrowser.open).toEqual(jasmine.any(Function));
});
});
describe('open method', function () {
var iabInstance;
var originalTimeout;
var url = 'https://dist.apache.org/repos/dist/dev/cordova/';
var badUrl = 'http://bad-uri/';
beforeEach(function () {
// increase timeout to ensure test url could be loaded within test time
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;
iabInstance = null;
});
afterEach(function (done) {
// restore original timeout
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
if (iabInstance !== null && iabInstance.close) {
iabInstance.close();
}
iabInstance = null;
// add some extra time so that iab dialog is closed
setTimeout(done, 2000);
});
function verifyEvent(evt, type) {
expect(evt).toBeDefined();
expect(evt.type).toEqual(type);
if (type !== 'exit') { // `exit` event does not have url field
expect(evt.url).toEqual(url);
}
}
function verifyLoadErrorEvent(evt) {
expect(evt).toBeDefined();
expect(evt.type).toEqual('loaderror');
expect(evt.url).toEqual(badUrl);
expect(evt.code).toEqual(jasmine.any(Number));
expect(evt.message).toEqual(jasmine.any(String));
}
it("inappbrowser.spec.3 should retun InAppBrowser instance with required methods", function () {
iabInstance = cordova.InAppBrowser.open(url, '_blank');
expect(iabInstance).toBeDefined();
expect(iabInstance.addEventListener).toEqual(jasmine.any(Function));
expect(iabInstance.removeEventListener).toEqual(jasmine.any(Function));
expect(iabInstance.close).toEqual(jasmine.any(Function));
expect(iabInstance.show).toEqual(jasmine.any(Function));
expect(iabInstance.executeScript).toEqual(jasmine.any(Function));
expect(iabInstance.insertCSS).toEqual(jasmine.any(Function));
});
it("inappbrowser.spec.4 should support loadstart and loadstop events", function (done) {
var onLoadStart = jasmine.createSpy('loadstart event callback').and.callFake(function (evt) {
verifyEvent(evt, 'loadstart');
});
iabInstance = cordova.InAppBrowser.open(url, '_blank');
iabInstance.addEventListener('loadstart', onLoadStart);
iabInstance.addEventListener('loadstop', function (evt) {
verifyEvent(evt, 'loadstop');
expect(onLoadStart).toHaveBeenCalled();
done();
});
});
it("inappbrowser.spec.5 should support exit event", function (done) {
iabInstance = cordova.InAppBrowser.open(url, '_blank');
iabInstance.addEventListener('exit', function (evt) {
verifyEvent(evt, 'exit');
done();
});
iabInstance.close();
iabInstance = null;
});
it("inappbrowser.spec.6 should support loaderror event", function (done) {
iabInstance = cordova.InAppBrowser.open(badUrl, '_blank');
iabInstance.addEventListener('loaderror', function (evt) {
verifyLoadErrorEvent(evt);
done();
});
});
});
};
exports.defineManualTests = function (contentEl, createActionButton) {
function doOpen(url, target, params, numExpectedRedirects, useWindowOpen) {
......@@ -319,7 +423,11 @@ exports.defineManualTests = function (contentEl, createActionButton) {
var video_tag_tests = '<h1>Video tag</h1>' +
'<div id="openRemoteVideo"></div>' +
'Expected result: open successfully in InAppBrowser with an embedded video that works after clicking the "play" button.';
'Expected result: open successfully in InAppBrowser with an embedded video plays automatically on iOS and Android.' +
'<div id="openRemoteNeedUserNoVideo"></div>' +
'Expected result: open successfully in InAppBrowser with an embedded video plays automatically on iOS and Android.' +
'<div id="openRemoteNeedUserYesVideo"></div>' +
'Expected result: open successfully in InAppBrowser with an embedded video does not play automatically on iOS and Android but rather works after clicking the "play" button.';
var local_with_anchor_tag_tests = '<h1>Local with anchor tag</h1>' +
'<div id="openAnchor1"></div>' +
......@@ -507,6 +615,12 @@ exports.defineManualTests = function (contentEl, createActionButton) {
createActionButton('Remote Video', function () {
doOpen(videohtml, '_blank');
}, 'openRemoteVideo');
createActionButton('Remote Need User No Video', function () {
doOpen(videohtml, '_blank', 'mediaPlaybackRequiresUserAction=no');
}, 'openRemoteNeedUserNoVideo');
createActionButton('Remote Need User Yes Video', function () {
doOpen(videohtml, '_blank', 'mediaPlaybackRequiresUserAction=yes');
}, 'openRemoteNeedUserYesVideo');
//Local With Anchor Tag
createActionButton('Anchor1', function () {
......@@ -516,4 +630,3 @@ exports.defineManualTests = function (contentEl, createActionButton) {
doOpen(localhtml + '#anchor2', '_blank');
}, 'openAnchor2');
};
......@@ -38,3 +38,77 @@
.inAppBrowserWrapFullscreen {
border: 0;
}
.inappbrowser-app-bar {
height: 70px;
background-color: #404040;
z-index: 9999999;
}
.inappbrowser-app-bar-inner {
padding-top: 10px;
height: 60px;
width: 155px;
margin: 0 auto;
background-color: #404040;
z-index: 9999999;
}
.app-bar-action {
width: auto;
height: 40px;
margin-left: 20px;
font-family: "Segoe UI Symbol";
float: left;
color: white;
font-size: 12px;
text-transform: lowercase;
text-align: center;
cursor: default;
}
.app-bar-action[disabled] {
color: gray;
/*disable click*/
pointer-events: none;
}
.app-bar-action::before {
font-size: 28px;
display: block;
height: 36px;
}
/* Back */
.action-back {
margin-left: 0px;
}
.action-back::before {
content: "\E0BA";
}
.action-back:not([disabled]):hover::before {
content: "\E0B3";
}
/* Forward */
.action-forward::before {
content: "\E0AC";
}
.action-forward:not([disabled]):hover::before {
content: "\E0AF";
}
/* Close */
.action-close::before {
content: "\E0C7";
/* close icon is larger so we re-size it to fit other icons */
font-size: 20px;
line-height: 40px;
}
.action-close:not([disabled]):hover::before {
content: "\E0CA";
}