diff --git a/CHANGELOG.md b/CHANGELOG.md index e3a93a7..81d399b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 The changes documented here do not include those from the original repository. +## 2.0.0 + +### Fixes + +- Android: isolate WebView local storage and cookies from the main app by default on Android 28+. [RMET-4918](https://outsystemsrd.atlassian.net/browse/RMET-4918) + +### BREAKING CHANGES + +- Android: `openInWebView` now isolates WebView storage by default on Android 28+. Apps that need to share the main app WebView's `localStorage` or cookies must set `android.isIsolated` to `false`. + ## 1.6.5 ### Fixes diff --git a/README.md b/README.md index 83e63e0..127b144 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,19 @@ It's also possible to install via the repo's URL directly. cordova plugin add https://github.com/OutSystems/cordova-outsystems-inappbrowser ``` +#### LocalStorage Isolation +The `openInWebView` option provides isolation for `localStorage` and `cookies` to ensure that content loaded in the InAppBrowser does not interfere with the main application's storage. + +- **iOS**: Storage is isolated by default. +- **Android (API 28+)**: Storage is isolated by default by running the InAppBrowser in a separate process (`:OSInAppBrowser`) with a dedicated data directory suffix. +- **Android (API < 28)**: Storage is **shared** with the main application due to platform limitations. On these devices, if the URL opened has the same origin as the main app, they will share the same `localStorage`. + +If your use case requires sharing `localStorage` or cookies between the main app and the InAppBrowser on Android, you can opt out of isolation by setting `isIsolated: false` in the `android` options. + +> Disabling isolation reduces the security of your app by allowing potentially untrusted web content to access your application's private storage. Use this only if necessary. + +> **Breaking Change (Android)**: Apps upgrading to this version will lose any existing `localStorage` or cookies previously stored by the InAppBrowser on Android 28+ on the first run. This is because the WebView now runs in a separate process with its own data directory. Users may need to re-authenticate with websites that relied on persisted session data. + ## Supported Platforms - iOS @@ -104,6 +117,7 @@ The action is composed of the following parameters: - **allowZoom**: A boolean that, if set to true, shows the Android browser's zoom controls. - **hardwareBack**: A boolean that, if set to true, uses the hardware back button to navigate backwards through the Web View's history. If there is no previous page, the Web View will close. - **pauseMedia**: A boolean that, if set to true, makes the Web View pause/resume with the app to stop background audio. Note that this may be required to avoid Google Play issues like YouTube video playback while the application is in the background. + - **isIsolated**: A boolean that, if set to true, runs the InAppBrowser in an isolated WebView process on Android 28+. Defaults to true. - **iOS**: iOS-specific Web View options. - **allowOverScroll**: A boolean that, if set to true, turns on the Web View bounce property. - **enableViewportScale**: A boolean that, if set to true, prevents viewport scaling through a meta tag. @@ -145,4 +159,4 @@ The action is composed of the following parameters: |OS-PLUG-IABP-0009|SafariViewController couldn't open the following URL: '\(url)'|:white_check_mark:|:x:| |OS-PLUG-IABP-0010|Custom Tabs couldn't open the following URL: '\(url)'|:x:|:white_check_mark:| |OS-PLUG-IABP-0011|The WebView couldn't open the following URL: '\(url)'|:white_check_mark:|:white_check_mark:| -|OS-PLUG-IABP-0012|There’s no browser view to close.|:white_check_mark:|:white_check_mark:| \ No newline at end of file +|OS-PLUG-IABP-0012|There’s no browser view to close.|:white_check_mark:|:white_check_mark:| diff --git a/dist/definitions.d.ts b/dist/definitions.d.ts index fe4f527..f4a5ff8 100644 --- a/dist/definitions.d.ts +++ b/dist/definitions.d.ts @@ -56,6 +56,7 @@ export interface AndroidWebViewOptions { allowZoom: boolean; hardwareBack: boolean; pauseMedia: boolean; + isIsolated?: boolean; } export declare enum DismissStyle { CLOSE = 0, diff --git a/dist/plugin.cjs b/dist/plugin.cjs index 7444034..a4191cc 100644 --- a/dist/plugin.cjs +++ b/dist/plugin.cjs @@ -46,7 +46,8 @@ var CallbackEventType = /* @__PURE__ */ ((CallbackEventType2) => { const DefaultAndroidWebViewOptions = { allowZoom: false, hardwareBack: true, - pauseMedia: true + pauseMedia: true, + isIsolated: true }; const DefaultiOSWebViewOptions = { allowOverScroll: true, diff --git a/dist/plugin.js b/dist/plugin.js index 8ab2325..c72a455 100644 --- a/dist/plugin.js +++ b/dist/plugin.js @@ -47,7 +47,8 @@ const DefaultAndroidWebViewOptions = { allowZoom: false, hardwareBack: true, - pauseMedia: true + pauseMedia: true, + isIsolated: true }; const DefaultiOSWebViewOptions = { allowOverScroll: true, diff --git a/dist/plugin.mjs b/dist/plugin.mjs index 54be452..b3c1451 100644 --- a/dist/plugin.mjs +++ b/dist/plugin.mjs @@ -44,7 +44,8 @@ var CallbackEventType = /* @__PURE__ */ ((CallbackEventType2) => { const DefaultAndroidWebViewOptions = { allowZoom: false, hardwareBack: true, - pauseMedia: true + pauseMedia: true, + isIsolated: true }; const DefaultiOSWebViewOptions = { allowOverScroll: true, diff --git a/package.json b/package.json index 4ed62a4..aa34feb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.outsystems.plugins.inappbrowser", - "version": "1.6.5", + "version": "2.0.0", "description": "InAppBrowser OutSystems Cordova Plugin", "keywords": [ "ecosystem:cordova", diff --git a/plugin.xml b/plugin.xml index 7b0b044..6823e03 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,5 +1,5 @@ - + cordova-outsystems-inappbrowser InAppBrowser OutSystems Cordova Plugin OutSystems Inc @@ -25,6 +25,7 @@ + diff --git a/src/android/.DS_Store b/src/android/.DS_Store index 564d663..341a9d7 100644 Binary files a/src/android/.DS_Store and b/src/android/.DS_Store differ diff --git a/src/android/OSInAppBrowser.kt b/src/android/OSInAppBrowser.kt index d3b8b5a..bd72f19 100644 --- a/src/android/OSInAppBrowser.kt +++ b/src/android/OSInAppBrowser.kt @@ -268,7 +268,8 @@ class OSInAppBrowser: CordovaPlugin() { it.android.allowZoom ?: true, it.android.hardwareBack ?: true, it.android.pauseMedia ?: true, - it.customWebViewUserAgent + it.customWebViewUserAgent, + it.android.isIsolated ?: true ) } } diff --git a/src/android/OSInAppBrowserWebViewInputArguments.kt b/src/android/OSInAppBrowserWebViewInputArguments.kt index ce9e91b..c1a3ebc 100644 --- a/src/android/OSInAppBrowserWebViewInputArguments.kt +++ b/src/android/OSInAppBrowserWebViewInputArguments.kt @@ -20,5 +20,6 @@ data class OSInAppBrowserWebViewInputArguments( data class OSInAppBrowserWebViewAndroidOptions( @SerializedName("allowZoom") val allowZoom: Boolean?, @SerializedName("hardwareBack") val hardwareBack: Boolean?, - @SerializedName("pauseMedia") val pauseMedia: Boolean? + @SerializedName("pauseMedia") val pauseMedia: Boolean?, + @SerializedName("isIsolated") val isIsolated: Boolean? ) diff --git a/src/android/build.gradle b/src/android/build.gradle index 441e501..6104bc2 100644 --- a/src/android/build.gradle +++ b/src/android/build.gradle @@ -10,7 +10,7 @@ buildscript { } dependencies{ - implementation("io.ionic.libs:ioninappbrowser-android:1.6.2@aar") + implementation("io.ionic.libs:ioninappbrowser-android:2.0.0@aar") implementation("androidx.browser:browser:1.8.0") implementation("com.google.android.gms:play-services-auth:21.2.0") diff --git a/src/www/defaults.ts b/src/www/defaults.ts index 86f7a50..30317b8 100644 --- a/src/www/defaults.ts +++ b/src/www/defaults.ts @@ -3,7 +3,8 @@ import { AndroidAnimation, AndroidSystemBrowserOptions, AndroidViewStyle, Androi export const DefaultAndroidWebViewOptions: AndroidWebViewOptions = { allowZoom: false, hardwareBack: true, - pauseMedia: true + pauseMedia: true, + isIsolated: true } export const DefaultiOSWebViewOptions: iOSWebViewOptions = { @@ -58,4 +59,4 @@ export const DefaultAndroidSystemBrowserOptions: AndroidSystemBrowserOptions = { export const DefaultSystemBrowserOptions: SystemBrowserOptions = { android: DefaultAndroidSystemBrowserOptions, iOS: DefaultiOSSystemBrowserOptions -} \ No newline at end of file +} diff --git a/src/www/definitions.ts b/src/www/definitions.ts index 57d4060..72a35cf 100644 --- a/src/www/definitions.ts +++ b/src/www/definitions.ts @@ -72,6 +72,7 @@ export interface AndroidWebViewOptions { allowZoom: boolean; hardwareBack: boolean; pauseMedia: boolean; + isIsolated?: boolean; } export enum DismissStyle {