Compare commits

..

22 Commits

Author SHA1 Message Date
Niklas Merz 8bc15de222 Revert "fix: explicitly import dependencies, instead of relying on PCH files. This is important in Swift projects, where you cannot use prefix headers. (#927)"
This reverts commit 31860cf6c3.
2023-11-03 19:16:03 +01:00
alekop 31860cf6c3 fix: explicitly import dependencies, instead of relying on PCH files. This is important in Swift projects, where you cannot use prefix headers. (#927)
Co-authored-by: Aleko Petkov <apetkov@spideroak-inc.com>
2023-11-03 19:15:52 +01:00
joanbat d735e136cd GH-706 android: Allow permissions requests (#968)
Co-authored-by: joanb-moncasoft <55381916+joanb-moncasoft@users.noreply.github.com>
2023-10-27 10:36:16 -03:00
エリス 65e86c7e1b chore: update asf config (#1029) 2023-10-19 09:45:12 +09:00
Norman Breau d533f2a953 chore: 5.1.0-dev (#1021) 2023-09-15 00:34:39 -03:00
Norman Breau b18b9794a8 feat(android): Download event (#1019)
* feat(android): Added download event

* android typos, whitespaces and whiteline corrected

* Update README.md

* fix: removed added whitespace trail

---------

Co-authored-by: Shaikh Amaan FM <thisisamaan.s@gmail.com>
Co-authored-by: Shaikh Amaan FM <53618794+shaikh-amaan-fm@users.noreply.github.com>
2023-09-15 00:23:22 -03:00
Norman Breau ac16f78b15 ci(gh-action): Paramedic CI sync (#1020) 2023-09-14 21:06:14 -03:00
jcesarmobile ec16fee79f feat(ios): Make WebView inspectable (#1015) 2023-09-11 14:20:53 +02:00
jcesarmobile 178f2d3e59 chore: use https urls in tests and README (#1016) 2023-09-07 23:36:52 +02:00
jcesarmobile 1e8599a32a chore: Update SUPPORT_QUESTION.md template (#1017) 2023-08-25 11:07:57 +02:00
DAnn2012 8ee1d38821 fix(docs): missing xml indicator in code block (#977) 2022-09-25 18:04:14 -03:00
エリス 405468cb2d ci: sync workflow with paramedic (#971) 2022-08-13 00:41:39 +09:00
エリス a877f62d62 dep(npm): bump package-lock v2 w/ rebuild (#964) 2022-08-10 16:49:34 +09:00
エリス bd02f45383 ci(android): update java requirement for cordova-android@11 (#957) 2022-07-16 16:44:21 +09:00
エリス dfcffb4812 fix(android): increase toolbar to 48dp (#946)
Material Design Guidelines says "For most platforms, consider making touch targets at least 48 x 48dp."
2022-07-12 21:17:49 +09:00
エリス 1718efa138 ci(ios): update workflow w/ iOS 15 (#912) 2021-10-18 21:13:18 +09:00
エリス 0f468c7393 ci: add action-badge (#907) 2021-09-25 01:03:30 +09:00
エリス 2043109c16 ci: remove travis & appveyor (#906) 2021-09-25 00:07:33 +09:00
エリス 89c5a6a21b ci: add gh-actions workflows (#903) 2021-09-16 22:19:15 +09:00
Niklas Merz 9bc8f7629e fix(android): add space between default useragent and custom AppendUserAgent (#861)
cordova-android adds a space between the default user agent and the custom one:
https://github.com/apache/cordova-android/blob/c144c0811249e22f91253ef919cc767f892a8fdf/framework/src/org/apache/cordova/engine/SystemWebViewEngine.java#L214

With this change cordova-androids and the IAB user agent are exactly the same.
2021-06-23 12:09:27 +02:00
jcesarmobile 2fef3046fc fix(ios): make system open tel, sms, mailto and geo links (#881) 2021-06-11 14:25:43 +02:00
Niklas Merz 3b6757fc44 Incremented plugin version. (cordova-plugin-inappbrowser-5.0.0) 2021-02-10 18:11:21 +01:00
20 changed files with 3494 additions and 711 deletions
-34
View File
@@ -1,34 +0,0 @@
# appveyor file
# http://www.appveyor.com/docs/appveyor-yml
max_jobs: 1
shallow_clone: true
init:
- git config --global core.autocrlf true
image:
- Visual Studio 2017
environment:
matrix:
- nodejs_version: "10"
- nodejs_version: "12"
- nodejs_version: "14"
platform:
- x86
- x64
install:
- ps: Install-Product node $env:nodejs_version
- node --version
- npm install -g cordova-paramedic@https://github.com/apache/cordova-paramedic.git
- npm install -g cordova
- npm install
build: off
test_script:
- cordova-paramedic --config pr\windows-10-store --plugin . --justBuild
+26
View File
@@ -15,6 +15,32 @@
# specific language governing permissions and limitations
# under the License.
github:
description: Apache Cordova InAppBrowser Plugin
homepage: https://cordova.apache.org/
labels:
- android
- cordova
- hacktoberfest
- ios
- java
- javascript
- library
- mobile
- nodejs
- objective-c
features:
wiki: false
issues: true
projects: true
enabled_merge_buttons:
squash: true
merge: false
rebase: false
notifications:
commits: commits@cordova.apache.org
issues: issues@cordova.apache.org
+3 -4
View File
@@ -13,7 +13,8 @@ For usage and support questions, please check out the resources below. Thanks!
You can get answers to your usage and support questions about **Apache Cordova** on:
* Slack Community Chat: https://cordova.slack.com (you can sign-up at http://slack.cordova.io/)
* GitHub Discussions: https://github.com/apache/cordova/discussions
* Slack Community Chat: https://cordova.slack.com (you can sign-up at https://s.apache.org/cordova-slack)
* StackOverflow: https://stackoverflow.com/questions/tagged/cordova using the tag `cordova`
---
@@ -22,6 +23,4 @@ If you are using a tool that uses Cordova internally, like e.g. Ionic, check the
* **Ionic Framework**
* [Ionic Community Forum](https://forum.ionicframework.com/)
* [Ionic Worldwide Slack](https://ionicworldwide.herokuapp.com/)
* **PhoneGap**
* [PhoneGap Developer Community](https://forums.adobe.com/community/phonegap)
* [Ionic Discord](https://ionic.link/discord)
+137
View File
@@ -0,0 +1,137 @@
# 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.
name: Android Testsuite
on:
push:
paths-ignore:
- '**.md'
- 'LICENSE'
- '.eslint*'
pull_request:
paths-ignore:
- '**.md'
- 'LICENSE'
- '.eslint*'
jobs:
test:
name: Android ${{ matrix.versions.android }} Test
runs-on: macos-latest
continue-on-error: true
# hoist configurations to top that are expected to be updated
env:
# Storing a copy of the repo
repo: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
node-version: 16
# These are the default Java configurations used by most tests.
# To customize these options, add "java-distro" or "java-version" to the strategy matrix with its overriding value.
default_java-distro: temurin
default_java-version: 11
# These are the default Android System Image configurations used by most tests.
# To customize these options, add "system-image-arch" or "system-image-target" to the strategy matrix with its overriding value.
default_system-image-arch: x86_64
default_system-image-target: google_apis # Most system images have a google_api option. Set this as default.
# configurations for each testing strategy (test matrix)
strategy:
matrix:
versions:
# Test the lowest minimum supported APIs
- android: 7
android-api: 24
# Test the last 3-4 supported APIs
- android: 10
android-api: 29
- android: 11
android-api: 30
- android: 12L
android-api: 32
- android: 13
android-api: 33
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- uses: actions/setup-java@v3
env:
java-version: ${{ matrix.versions.java-version == '' && env.default_java-version || matrix.versions.java-version }}
java-distro: ${{ matrix.versions.java-distro == '' && env.default_java-distro || matrix.versions.java-distro }}
with:
distribution: ${{ env.java-distro }}
java-version: ${{ env.java-version }}
- name: Run Environment Information
run: |
node --version
npm --version
java -version
- name: Run npm install
run: |
export PATH="/usr/local/lib/android/sdk/platform-tools":$PATH
export JAVA_HOME=$JAVA_HOME_11_X64
npm i -g cordova@latest
npm ci
- name: Run paramedic install
if: ${{ endswith(env.repo, '/cordova-paramedic') != true }}
run: npm i -g github:apache/cordova-paramedic
- uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b
env:
system-image-arch: ${{ matrix.versions.system-image-arch == '' && env.default_system-image-arch || matrix.versions.system-image-arch }}
system-image-target: ${{ matrix.versions.system-image-target == '' && env.default_system-image-target || matrix.versions.system-image-target }}
with:
api-level: ${{ matrix.versions.android-api }}
target: ${{ env.system-image-target }}
arch: ${{ env.system-image-arch }}
force-avd-creation: false
disable-animations: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
script: echo "Pregenerate the AVD before running Paramedic"
- name: Run paramedic tests
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b
env:
system-image-arch: ${{ matrix.versions.system-image-arch == '' && env.default_system-image-arch || matrix.versions.system-image-arch }}
system-image-target: ${{ matrix.versions.system-image-target == '' && env.default_system-image-target || matrix.versions.system-image-target }}
test_config: 'android-${{ matrix.versions.android }}.config.json'
# Generally, this should automatically work for cordova-paramedic & plugins. If the path is unique, this can be manually changed.
test_plugin_path: ${{ endswith(env.repo, '/cordova-paramedic') && './spec/testable-plugin/' || './' }}
paramedic: ${{ endswith(env.repo, '/cordova-paramedic') && 'node main.js' || 'cordova-paramedic' }}
with:
api-level: ${{ matrix.versions.android-api }}
target: ${{ env.system-image-target }}
arch: ${{ env.system-image-arch }}
force-avd-creation: false
disable-animations: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
script: ${{ env.paramedic }} --config ./pr/local/${{ env.test_config }} --plugin ${{ env.test_plugin_path }}
+73
View File
@@ -0,0 +1,73 @@
# 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.
name: Chrome Testsuite
on:
push:
paths-ignore:
- '**.md'
- 'LICENSE'
- '.eslint*'
pull_request:
paths-ignore:
- '**.md'
- 'LICENSE'
- '.eslint*'
jobs:
test:
name: Chrome Latest Test
runs-on: ubuntu-latest
# hoist configurations to top that are expected to be updated
env:
# Storing a copy of the repo
repo: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
node-version: 16
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- name: Run install xvfb
run: sudo apt-get install xvfb
- name: Run Environment Information
run: |
node --version
npm --version
- name: Run npm install
run: |
npm i -g cordova@latest
npm ci
- name: Run paramedic install
if: ${{ endswith(env.repo, '/cordova-paramedic') != true }}
run: npm i -g github:apache/cordova-paramedic
- name: Run paramedic tests
env:
test_config: 'browser.config.json'
# Generally, this should automatically work for cordova-paramedic & plugins. If the path is unique, this can be manually changed.
test_plugin_path: ${{ endswith(env.repo, '/cordova-paramedic') && './spec/testable-plugin/' || './' }}
paramedic: ${{ endswith(env.repo, '/cordova-paramedic') && 'node main.js' || 'cordova-paramedic' }}
run: xvfb-run --auto-servernum ${{ env.paramedic }} --config ./pr/local/${{ env.test_config }} --plugin ${{ env.test_plugin_path }}
+101
View File
@@ -0,0 +1,101 @@
# 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.
name: iOS Testsuite
on:
push:
paths-ignore:
- '**.md'
- 'LICENSE'
- '.eslint*'
pull_request:
paths-ignore:
- '**.md'
- 'LICENSE'
- '.eslint*'
jobs:
test:
name: iOS ${{ matrix.versions.ios-version }} Test
runs-on: ${{ matrix.versions.os-version }}
continue-on-error: true
# hoist configurations to top that are expected to be updated
env:
# Storing a copy of the repo
repo: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
node-version: 16
# > Starting April 26, 2021, all iOS and iPadOS apps submitted to the App Store must be built with Xcode 12 and the iOS 14 SDK.
# Because of Apple's requirement, listed above, We will only be using the latest Xcode release for testing.
# To customize these options, add "xcode-version" to the strategy matrix with its overriding value.
default_xcode-version: latest-stable
strategy:
matrix:
versions:
- os-version: macos-11
ios-version: 13.x
xcode-version: 11.x
- os-version: macos-11
ios-version: 14.x
xcode-version: 12.x
- os-version: macos-11
ios-version: 15.x
xcode-version: 13.x
- os-version: macos-12
ios-version: 16.x
xcode-version: 14.x
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ env.node-version }}
- uses: maxim-lobanov/setup-xcode@9a697e2b393340c3cacd97468baa318e4c883d98
env:
xcode-version: ${{ matrix.versions.xcode-version == '' && env.default_xcode-version || matrix.versions.xcode-version }}
with:
xcode-version: ${{ env.xcode-version }}
- name: Run Environment Information
run: |
node --version
npm --version
xcodebuild -version
- name: Run npm install
run: |
npm i -g cordova@latest ios-deploy@latest
npm ci
- name: Run paramedic install
if: ${{ endswith(env.repo, '/cordova-paramedic') != true }}
run: npm i -g github:apache/cordova-paramedic
- name: Run paramedic tests
env:
test_config: 'ios-${{ matrix.versions.ios-version }}.config.json'
# Generally, this should automatically work for cordova-paramedic & plugins. If the path is unique, this can be manually changed.
test_plugin_path: ${{ endswith(env.repo, '/cordova-paramedic') && './spec/testable-plugin/' || './' }}
paramedic: ${{ endswith(env.repo, '/cordova-paramedic') && 'node main.js' || 'cordova-paramedic' }}
run: ${{ env.paramedic }} --config ./pr/local/${{ env.test_config }} --plugin ${{ env.test_plugin_path }}
+56
View File
@@ -0,0 +1,56 @@
# 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.
name: Lint Test
on:
push:
paths:
- '**.js'
- '.eslint*'
- '.github/workflow/lint.yml'
pull_request:
paths:
- '**.js'
- '.eslint*'
- '.github/workflow/lint.yml'
jobs:
test:
name: Lint Test
runs-on: ubuntu-latest
env:
node-version: 16
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.node-version }}
- name: Run Environment Information
run: |
node --version
npm --version
- name: Run npm install
run: |
npm ci
- name: Run lint test
run: |
npm run lint
-1
View File
@@ -1,3 +1,2 @@
.*
appveyor.yml
tests
-118
View File
@@ -1,118 +0,0 @@
# This Travis configuration file is built after a Cordova Paramedic
# specific template with minimal modifications and adaptations:
# https://github.com/apache/cordova-paramedic/blob/master/.travis.yml
sudo: false
addons:
jwt:
# SAUCE_ACCESS_KEY
secure: TZ88IEvAw1bsWPWxvDzXdpi2NK0i3PN4hG15+vDpIt6wXGVPknjxuXWJeLj7TqBpAIvP7XDfS8ZvHVPLe7fe8oOchZPLuiDw9VVIk6cnHjE6wpoavdGc/1mDJ3Bi4PDcHwRUr5ng5spYQqqlTwcECkH/q7iPgudiFM6rlOlGRyA=
env:
global:
- SAUCE_USERNAME=snay
- TRAVIS_NODE_VERSION=12
- ANDROID_API_LEVEL=29
- ANDROID_BUILD_TOOLS_VERSION=29.0.2
language: node_js
node_js: 14
# yaml anchor/alias: https://medium.com/@tommyvn/travis-yml-dry-with-anchors-8b6a3ac1b027
_ios: &_ios
os: osx
osx_image: xcode11.6
_android: &_android
language: android
os: linux
jdk: oraclejdk8
android:
components:
- tools
- build-tools-$ANDROID_BUILD_TOOLS_VERSION
- android-$ANDROID_API_LEVEL
licenses:
- "android-sdk-preview-license-.+"
- "android-sdk-license-.+"
- "google-gdk-license-.+"
matrix:
include:
# local tests, without saucelabs
- env: PLATFORM=local/browser
<<: *_ios
- env: PLATFORM=local/ios-10.0
<<: *_ios
# many tests with saucelabs
- env: PLATFORM=browser-chrome
- env: PLATFORM=browser-firefox
- env: PLATFORM=browser-safari
- env: PLATFORM=browser-edge
- env: PLATFORM=ios-11.3
<<: *_ios
- env: PLATFORM=ios-12.0
<<: *_ios
- env: PLATFORM=android-5.1
<<: *_android
- env: PLATFORM=android-6.0
<<: *_android
- env: PLATFORM=android-7.0
<<: *_android
- env: PLATFORM=android-7.1
<<: *_android
- env: PLATFORM=android-8.0
<<: *_android
- env: PLATFORM=android-8.1
<<: *_android
- env: PLATFORM=android-9.0
<<: *_android
before_install:
# manually install Node for `language: android`
- if [[ "$PLATFORM" =~ android ]]; then nvm install $TRAVIS_NODE_VERSION; fi
- node --version
- if [[ "$PLATFORM" =~ android ]]; then gradle --version; fi
- if [[ "$PLATFORM" =~ ios ]]; then npm install -g ios-deploy; fi
- npm install -g cordova
# install paramedic if not running on paramedic repo
- if ! [[ "$TRAVIS_REPO_SLUG" =~ cordova-paramedic ]]; then npm install -g github:apache/cordova-paramedic; fi
install:
- npm install
before_script:
- |
if [[ "$TRAVIS_REPO_SLUG" =~ cordova-paramedic ]]; then
# when used in the cordova-paramedic repo
TEST_COMMAND="npm run eslint"
PARAMEDIC_PLUGIN_TO_TEST="./spec/testable-plugin/"
PARAMEDIC_COMMAND="node main.js"
else
# when used in any other (plugin) repo
TEST_COMMAND="npm test"
PARAMEDIC_PLUGIN_TO_TEST=$(pwd)
PARAMEDIC_COMMAND="cordova-paramedic"
fi
- PARAMEDIC_BUILDNAME=travis-$TRAVIS_REPO_SLUG-$TRAVIS_JOB_NUMBER
- |
echo "Variables now are set to:"
echo "TEST_COMMAND=$TEST_COMMAND"
echo "ADDITIONAL_TESTS=$ADDITIONAL_TESTS"
echo "PARAMEDIC_COMMAND=$PARAMEDIC_COMMAND"
echo "PLATFORM=$PLATFORM"
echo "PARAMEDIC_PLUGIN_TO_TEST=$PARAMEDIC_PLUGIN_TO_TEST"
echo "PARAMEDIC_BUILDNAME=$PARAMEDIC_BUILDNAME"
script:
- $TEST_COMMAND
- |
if [[ "$ADDITIONAL_TESTS_DIR" != "" ]]; then
cd $ADDITIONAL_TESTS_DIR && npm install && npm test;
else
$PARAMEDIC_COMMAND --config ./pr/$PLATFORM --plugin $PARAMEDIC_PLUGIN_TO_TEST --buildName $PARAMEDIC_BUILDNAME;
fi
+54 -30
View File
@@ -21,19 +21,18 @@ description: Open an in-app browser window.
# under the License.
-->
|AppVeyor|Travis CI|
|:-:|:-:|
|[![Build status](https://ci.appveyor.com/api/projects/status/github/apache/cordova-plugin-inappbrowser?branch=master)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-plugin-inappbrowser)|[![Build Status](https://travis-ci.org/apache/cordova-plugin-inappbrowser.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-inappbrowser)|
# cordova-plugin-inappbrowser
[![Android Testsuite](https://github.com/apache/cordova-plugin-inappbrowser/actions/workflows/android.yml/badge.svg)](https://github.com/apache/cordova-plugin-inappbrowser/actions/workflows/android.yml) [![Chrome Testsuite](https://github.com/apache/cordova-plugin-inappbrowser/actions/workflows/chrome.yml/badge.svg)](https://github.com/apache/cordova-plugin-inappbrowser/actions/workflows/chrome.yml) [![iOS Testsuite](https://github.com/apache/cordova-plugin-inappbrowser/actions/workflows/ios.yml/badge.svg)](https://github.com/apache/cordova-plugin-inappbrowser/actions/workflows/ios.yml) [![Lint Test](https://github.com/apache/cordova-plugin-inappbrowser/actions/workflows/lint.yml/badge.svg)](https://github.com/apache/cordova-plugin-inappbrowser/actions/workflows/lint.yml)
You can show helpful articles, videos, and web resources inside of your app. Users can view web pages without leaving your app.
> To get a few ideas, check out the [sample](#sample) at the bottom of this page or go straight to the [reference](#reference) content.
This plugin provides a web browser view that displays when calling `cordova.InAppBrowser.open()`.
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
var ref = cordova.InAppBrowser.open('https://apache.org', '_blank', 'location=yes');
### `window.open`
@@ -72,7 +71,7 @@ simply hook `window.open` during initialization. For example:
#### <b>config.xml</b>
- <b>InAppBrowserStatusBarStyle [iOS only]</b>: (string, options 'lightcontent', 'darkcontent' or 'default'. Defaults to 'default') set text color style for iOS. 'lightcontent' is intended for use on dark backgrounds. 'darkcontent' is only available since iOS 13 and intended for use on light backgrounds.
```
```xml
<preference name="InAppBrowserStatusBarStyle" value="lightcontent" />
```
@@ -167,7 +166,7 @@ instance, or the system browser.
### Example
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
var ref = cordova.InAppBrowser.open('https://apache.org', '_blank', 'location=yes');
var ref2 = cordova.InAppBrowser.open(encodeURI('http://ja.m.wikipedia.org/wiki/ハングル'), '_blank', 'location=yes');
### OSX Quirks
@@ -222,6 +221,7 @@ The object returned from a call to `cordova.InAppBrowser.open` when the target i
- __exit__: event fires when the `InAppBrowser` window is closed.
- __beforeload__: event fires when the `InAppBrowser` decides whether to load an URL or not (only with option `beforeload` set).
- __message__: event fires when the `InAppBrowser` receives a message posted from the page loaded inside the `InAppBrowser` Webview.
- __download__: _(Android Only)_ event fires when the `InAppBrowser` loads a URL that leads in downloading of a file.
- __callback__: the function that executes when the event fires. The function is passed an `InAppBrowserEvent` object as a parameter.
@@ -322,20 +322,43 @@ function messageCallBack(params){
}
```
#### Download event Example
Whenever the InAppBrowser receives or locates to a url which leads in downloading a file, the callback assigned to the "download" event is called. The parameter passed to this callback is an object with the the following properties
- **type** _it contains the String value "download" always_
- **url** _The url that leaded to the downloading of file. Basically, the download link of file_
- **userAgent** _User Agent of the webview_
- **contentDisposition** _If the url contains "content-disposition" header, then this property holds the value of that field else this field is empty_
- **contentLength** _If the link of the file allows to obtain file size then this property holds the file size else it contains int value 0_
- **mimetype** _The MIME type of the file_
```
function downloadListener(params){
var url = params.url;
var mimetype = params.mimetype;
var xhr = new XMLHttpRequest();
xhr.open("GET", params.url);
xhr.onload = function() {
var content = xhr.responseText;
};
xhr.send();
}
```
### InAppBrowserEvent Properties
- __type__: the eventname, either `loadstart`, `loadstop`, `loaderror`, `message` or `exit`. _(String)_
- __url__: the URL that was loaded. _(String)_
- __code__: the error code, only in the case of `loaderror`. _(Number)_
- __message__: the error message, only in the case of `loaderror`. _(String)_
- __data__: the message contents , only in the case of `message`. A stringified JSON object. _(String)_
### Supported Platforms
- Android
@@ -354,7 +377,7 @@ function messageCallBack(params){
### Quick Example
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
var ref = cordova.InAppBrowser.open('https://apache.org', '_blank', 'location=yes');
ref.addEventListener('loadstart', function(event) { alert(event.url); });
## InAppBrowser.removeEventListener
@@ -372,6 +395,7 @@ function messageCallBack(params){
- __loaderror__: event fires when the `InAppBrowser` encounters an error loading a URL.
- __exit__: event fires when the `InAppBrowser` window is closed.
- __message__: event fires when the `InAppBrowser` receives a message posted from the page loaded inside the `InAppBrowser` Webview.
- __download__: _(Android only)_ event fires when the `InAppBrowser` loads a URL that leads in downloading of a file.
- __callback__: the function to execute when the event fires.
The function is passed an `InAppBrowserEvent` object.
@@ -385,7 +409,7 @@ The function is passed an `InAppBrowserEvent` object.
### Quick Example
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
var ref = cordova.InAppBrowser.open('https://apache.org', '_blank', 'location=yes');
var myCallback = function(event) { alert(event.url); }
ref.addEventListener('loadstart', myCallback);
ref.removeEventListener('loadstart', myCallback);
@@ -407,7 +431,7 @@ The function is passed an `InAppBrowserEvent` object.
### Quick Example
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
var ref = cordova.InAppBrowser.open('https://apache.org', '_blank', 'location=yes');
ref.close();
## InAppBrowser.show
@@ -427,7 +451,7 @@ The function is passed an `InAppBrowserEvent` object.
### Quick Example
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'hidden=yes');
var ref = cordova.InAppBrowser.open('https://apache.org', '_blank', 'hidden=yes');
// some time later...
ref.show();
@@ -447,7 +471,7 @@ The function is passed an `InAppBrowserEvent` object.
### Quick Example
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank');
var ref = cordova.InAppBrowser.open('https://apache.org', '_blank');
// some time later...
ref.hide();
@@ -479,7 +503,7 @@ The function is passed an `InAppBrowserEvent` object.
### Quick Example
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
var ref = cordova.InAppBrowser.open('https://apache.org', '_blank', 'location=yes');
ref.addEventListener('loadstop', function() {
ref.executeScript({file: "myscript.js"});
});
@@ -514,7 +538,7 @@ Due to [MSDN docs](https://msdn.microsoft.com/en-us/library/windows.ui.xaml.cont
### Quick Example
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
var ref = cordova.InAppBrowser.open('https://apache.org', '_blank', 'location=yes');
ref.addEventListener('loadstop', function() {
ref.insertCSS({file: "mystyles.css"});
});
@@ -696,13 +720,13 @@ iab.open('local-url.html', 'random_string', 'location=no'); // loads in the InAp
```
var iab = cordova.InAppBrowser;
iab.open('http://whitelisted-url.com'); // loads in the Cordova WebView
iab.open('http://whitelisted-url.com', '_self'); // loads in the Cordova WebView
iab.open('http://whitelisted-url.com', '_system'); // loads in the system browser
iab.open('http://whitelisted-url.com', '_blank'); // loads in the InAppBrowser
iab.open('http://whitelisted-url.com', 'random_string'); // loads in the InAppBrowser
iab.open('https://whitelisted-url.com'); // loads in the Cordova WebView
iab.open('https://whitelisted-url.com', '_self'); // loads in the Cordova WebView
iab.open('https://whitelisted-url.com', '_system'); // loads in the system browser
iab.open('https://whitelisted-url.com', '_blank'); // loads in the InAppBrowser
iab.open('https://whitelisted-url.com', 'random_string'); // loads in the InAppBrowser
iab.open('http://whitelisted-url.com', 'random_string', 'location=no'); // loads in the InAppBrowser, no location bar
iab.open('https://whitelisted-url.com', 'random_string', 'location=no'); // loads in the InAppBrowser, no location bar
```
@@ -711,11 +735,11 @@ iab.open('http://whitelisted-url.com', 'random_string', 'location=no'); // loads
```
var iab = cordova.InAppBrowser;
iab.open('http://url-that-fails-whitelist.com'); // loads in the InAppBrowser
iab.open('http://url-that-fails-whitelist.com', '_self'); // loads in the InAppBrowser
iab.open('http://url-that-fails-whitelist.com', '_system'); // loads in the system browser
iab.open('http://url-that-fails-whitelist.com', '_blank'); // loads in the InAppBrowser
iab.open('http://url-that-fails-whitelist.com', 'random_string'); // loads in the InAppBrowser
iab.open('http://url-that-fails-whitelist.com', 'random_string', 'location=no'); // loads in the InAppBrowser, no location bar
iab.open('https://url-that-fails-whitelist.com'); // loads in the InAppBrowser
iab.open('https://url-that-fails-whitelist.com', '_self'); // loads in the InAppBrowser
iab.open('https://url-that-fails-whitelist.com', '_system'); // loads in the system browser
iab.open('https://url-that-fails-whitelist.com', '_blank'); // loads in the InAppBrowser
iab.open('https://url-that-fails-whitelist.com', 'random_string'); // loads in the InAppBrowser
iab.open('https://url-that-fails-whitelist.com', 'random_string', 'location=no'); // loads in the InAppBrowser, no location bar
```
+2954 -492
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-inappbrowser",
"version": "5.0.0",
"version": "5.1.0-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="5.0.0">
version="5.1.0-dev">
<name>InAppBrowser</name>
<description>Cordova InAppBrowser Plugin</description>
+32 -4
View File
@@ -54,6 +54,7 @@ import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.DownloadListener;
import android.webkit.WebViewClient;
import android.widget.EditText;
import android.widget.ImageButton;
@@ -97,6 +98,7 @@ public class InAppBrowser extends CordovaPlugin {
private static final String LOAD_START_EVENT = "loadstart";
private static final String LOAD_STOP_EVENT = "loadstop";
private static final String LOAD_ERROR_EVENT = "loaderror";
private static final String DOWNLOAD_EVENT = "download";
private static final String MESSAGE_EVENT = "message";
private static final String CLEAR_ALL_CACHE = "clearcache";
private static final String CLEAR_SESSION_CACHE = "clearsessioncache";
@@ -117,6 +119,8 @@ public class InAppBrowser extends CordovaPlugin {
private static final String BEFORELOAD = "beforeload";
private static final String FULLSCREEN = "fullscreen";
private static final int TOOLBAR_HEIGHT = 48;
private static final List customizableOptions = Arrays.asList(CLOSE_BUTTON_CAPTION, TOOLBAR_COLOR, NAVIGATION_COLOR, CLOSE_BUTTON_COLOR, FOOTER_COLOR);
private InAppBrowserDialog dialog;
@@ -270,6 +274,7 @@ public class InAppBrowser extends CordovaPlugin {
((InAppBrowserClient)inAppWebView.getWebViewClient()).waitForBeforeload = false;
}
inAppWebView.loadUrl(url);
}
});
}
@@ -799,7 +804,7 @@ public class InAppBrowser extends CordovaPlugin {
RelativeLayout toolbar = new RelativeLayout(cordova.getActivity());
//Please, no more black!
toolbar.setBackgroundColor(toolbarColor);
toolbar.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(44)));
toolbar.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(TOOLBAR_HEIGHT)));
toolbar.setPadding(this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2), this.dpToPixels(2));
if (leftToRight) {
toolbar.setHorizontalGravity(Gravity.LEFT);
@@ -901,7 +906,7 @@ public class InAppBrowser extends CordovaPlugin {
_footerColor = android.graphics.Color.LTGRAY;
}
footer.setBackgroundColor(_footerColor);
RelativeLayout.LayoutParams footerLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(44));
RelativeLayout.LayoutParams footerLayout = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, this.dpToPixels(TOOLBAR_HEIGHT));
footerLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
footer.setLayoutParams(footerLayout);
if (closeButtonCaption != "") footer.setPadding(this.dpToPixels(8), this.dpToPixels(8), this.dpToPixels(8), this.dpToPixels(8));
@@ -911,7 +916,6 @@ public class InAppBrowser extends CordovaPlugin {
View footerClose = createCloseButton(7);
footer.addView(footerClose);
// WebView
inAppWebView = new WebView(cordova.getActivity());
inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
@@ -944,6 +948,30 @@ public class InAppBrowser extends CordovaPlugin {
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setBuiltInZoomControls(showZoomControls);
settings.setPluginState(android.webkit.WebSettings.PluginState.ON);
// download event
inAppWebView.setDownloadListener(
new DownloadListener(){
public void onDownloadStart(
String url, String userAgent, String contentDisposition, String mimetype, long contentLength
){
try{
JSONObject succObj = new JSONObject();
succObj.put("type", DOWNLOAD_EVENT);
succObj.put("url",url);
succObj.put("userAgent",userAgent);
succObj.put("contentDisposition",contentDisposition);
succObj.put("mimetype",mimetype);
succObj.put("contentLength",contentLength);
sendUpdate(succObj, true);
}
catch(Exception e){
LOG.e(LOG_TAG,e.getMessage());
}
}
}
);
// Add postMessage interface
class JsObject {
@@ -970,7 +998,7 @@ public class InAppBrowser extends CordovaPlugin {
settings.setUserAgentString(overrideUserAgent);
}
if (appendUserAgent != null) {
settings.setUserAgentString(settings.getUserAgentString() + appendUserAgent);
settings.setUserAgentString(settings.getUserAgentString() + " " + appendUserAgent);
}
//Toggle whether this is enabled or not!
+8
View File
@@ -34,6 +34,7 @@ import android.webkit.WebStorage;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.GeolocationPermissions.Callback;
import android.webkit.PermissionRequest;
public class InAppChromeClient extends WebChromeClient {
@@ -45,6 +46,13 @@ public class InAppChromeClient extends WebChromeClient {
super();
this.webView = webView;
}
public void onPermissionRequest(final PermissionRequest request) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
request.grant(request.getResources());
}
}
/**
* Handle database quota exceeded notification.
*
+19 -2
View File
@@ -18,6 +18,7 @@
*/
#import "CDVWKInAppBrowser.h"
#import <Cordova/NSDictionary+CordovaPreferences.h>
#if __has_include(<Cordova/CDVWebViewProcessPoolFactory.h>) // Cordova-iOS >=6
#import <Cordova/CDVWebViewProcessPoolFactory.h>
@@ -539,8 +540,9 @@ static CDVWKInAppBrowser* instance = nil;
[self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
}
//if is an app store link, let the system handle it, otherwise it fails to load it
if ([[ url scheme] isEqualToString:@"itms-appss"] || [[ url scheme] isEqualToString:@"itms-apps"]) {
//if is an app store, tel, sms, mailto or geo link, let the system handle it, otherwise it fails to load it
NSArray * allowedSchemes = @[@"itms-appss", @"itms-apps", @"tel", @"sms", @"mailto", @"geo"];
if ([allowedSchemes containsObject:[url scheme]]) {
[theWebView stopLoading];
[self openInSystem:url];
shouldStart = NO;
@@ -773,6 +775,21 @@ BOOL isExiting = FALSE;
self.webView = [[WKWebView alloc] initWithFrame:webViewBounds configuration:configuration];
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 160400
// With the introduction of iOS 16.4 the webview is no longer inspectable by default.
// We'll honor that change for release builds, but will still allow inspection on debug builds by default.
// We also introduce an override option, so consumers can influence this decision in their own build.
if (@available(iOS 16.4, *)) {
#ifdef DEBUG
BOOL allowWebviewInspectionDefault = YES;
#else
BOOL allowWebviewInspectionDefault = NO;
#endif
self.webView.inspectable = [_settings cordovaBoolSettingForKey:@"InspectableWebview" defaultValue:allowWebviewInspectionDefault];
}
#endif
[self.view addSubview:self.webView];
[self.view sendSubviewToBack:self.webView];
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-inappbrowser-tests",
"version": "5.0.0",
"version": "5.1.0-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="5.0.0">
version="5.1.0-dev">
<name>Cordova InAppBrowser Plugin Tests</name>
<license>Apache 2.0</license>
+21 -21
View File
@@ -657,49 +657,49 @@ exports.defineManualTests = function (contentEl, createActionButton) {
createActionButton(
'* target=Default',
function () {
doOpen('http://cordova.apache.org');
doOpen('https://cordova.apache.org');
},
'openWhiteListed'
);
createActionButton(
'* target=Default (window.open)',
function () {
doHookOpen('http://cordova.apache.org');
doHookOpen('https://cordova.apache.org');
},
'openWhiteListedHook'
);
createActionButton(
'* target=_self',
function () {
doOpen('http://cordova.apache.org', '_self');
doOpen('https://cordova.apache.org', '_self');
},
'openWhiteListedSelf'
);
createActionButton(
'target=_system',
function () {
doOpen('http://cordova.apache.org', '_system');
doOpen('https://cordova.apache.org', '_system');
},
'openWhiteListedSystem'
);
createActionButton(
'target=_blank',
function () {
doOpen('http://cordova.apache.org', '_blank');
doOpen('https://cordova.apache.org', '_blank');
},
'openWhiteListedBlank'
);
createActionButton(
'target=Random',
function () {
doOpen('http://cordova.apache.org', 'random_string');
doOpen('https://cordova.apache.org', 'random_string');
},
'openWhiteListedRandom'
);
createActionButton(
'* target=Random, no location bar',
function () {
doOpen('http://cordova.apache.org', 'random_string', 'location=no');
doOpen('https://cordova.apache.org', 'random_string', 'location=no');
},
'openWhiteListedRandomNoLocation'
);
@@ -708,49 +708,49 @@ exports.defineManualTests = function (contentEl, createActionButton) {
createActionButton(
'target=Default',
function () {
doOpen('http://www.apple.com');
doOpen('https://www.apple.com');
},
'openNonWhiteListed'
);
createActionButton(
'target=Default (window.open)',
function () {
doHookOpen('http://www.apple.com');
doHookOpen('https://www.apple.com');
},
'openNonWhiteListedHook'
);
createActionButton(
'target=_self',
function () {
doOpen('http://www.apple.com', '_self');
doOpen('https://www.apple.com', '_self');
},
'openNonWhiteListedSelf'
);
createActionButton(
'target=_system',
function () {
doOpen('http://www.apple.com', '_system');
doOpen('https://www.apple.com', '_system');
},
'openNonWhiteListedSystem'
);
createActionButton(
'target=_blank',
function () {
doOpen('http://www.apple.com', '_blank');
doOpen('https://www.apple.com', '_blank');
},
'openNonWhiteListedBlank'
);
createActionButton(
'target=Random',
function () {
doOpen('http://www.apple.com', 'random_string');
doOpen('https://www.apple.com', 'random_string');
},
'openNonWhiteListedRandom'
);
createActionButton(
'* target=Random, no location bar',
function () {
doOpen('http://www.apple.com', 'random_string', 'location=no');
doOpen('https://www.apple.com', 'random_string', 'location=no');
},
'openNonWhiteListedRandomNoLocation'
);
@@ -759,14 +759,14 @@ exports.defineManualTests = function (contentEl, createActionButton) {
createActionButton(
'http://google.co.uk',
function () {
doOpen('http://google.co.uk', 'random_string', '', 1);
doOpen('https://google.co.uk', 'random_string', '', 1);
},
'openRedirect301'
);
createActionButton(
'http://goo.gl/pUFqg',
function () {
doOpen('http://goo.gl/pUFqg', 'random_string', '', 2);
doOpen('https://goo.gl/pUFqg', 'random_string', '', 2);
},
'openRedirect302'
);
@@ -775,7 +775,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
createActionButton(
'Remote URL',
function () {
doOpen('http://www.stluciadance.com/prospectus_file/sample.pdf');
doOpen('https://www.stluciadance.com/prospectus_file/sample.pdf');
},
'openPDF'
);
@@ -798,7 +798,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
createActionButton(
'Invalid Host',
function () {
doOpen('http://www.inv;alid.com/', '_blank');
doOpen('https://www.inv;alid.com/', '_blank');
},
'openInvalidHost'
);
@@ -974,21 +974,21 @@ exports.defineManualTests = function (contentEl, createActionButton) {
createActionButton(
'no hardwareback (defaults to yes)',
function () {
doOpen('http://cordova.apache.org', '_blank');
doOpen('https://cordova.apache.org', '_blank');
},
'openHardwareBackDefault'
);
createActionButton(
'hardwareback=yes',
function () {
doOpen('http://cordova.apache.org', '_blank', 'hardwareback=yes');
doOpen('https://cordova.apache.org', '_blank', 'hardwareback=yes');
},
'openHardwareBackYes'
);
createActionButton(
'hardwareback=no',
function () {
doOpen('http://cordova.apache.org', '_blank', 'hardwareback=no');
doOpen('https://cordova.apache.org', '_blank', 'hardwareback=no');
},
'openHardwareBackNo'
);
+6 -1
View File
@@ -33,7 +33,8 @@
loaderror: channel.create('loaderror'),
exit: channel.create('exit'),
customscheme: channel.create('customscheme'),
message: channel.create('message')
message: channel.create('message'),
download: channel.create('download')
};
}
@@ -89,6 +90,10 @@
} else {
throw new Error('insertCSS requires exactly one of code or file to be specified');
}
},
addDownloadListener: function (success, error) {
exec(success, error, 'InAppBrowser', 'downloadListener');
}
};