@capawesome/capacitor-system-webview 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{CapawesomeCapacitorSystemWebView.podspec → CapawesomeCapacitorSystemWebview.podspec} +1 -1
- package/Package.swift +6 -6
- package/README.md +63 -10
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/systemwebview/{SystemWebView.java → SystemWebview.java} +3 -3
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/systemwebview/{SystemWebViewPlugin.java → SystemWebviewPlugin.java} +5 -5
- package/dist/docs.json +1 -1
- package/dist/esm/definitions.d.ts +1 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +1 -1
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +5 -5
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +5 -5
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/{SystemWebViewPlugin.swift → SystemWebviewPlugin.swift} +4 -4
- package/package.json +12 -4
package/{CapawesomeCapacitorSystemWebView.podspec → CapawesomeCapacitorSystemWebview.podspec}
RENAMED
|
@@ -3,7 +3,7 @@ require 'json'
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
4
|
|
|
5
5
|
Pod::Spec.new do |s|
|
|
6
|
-
s.name = '
|
|
6
|
+
s.name = 'CapawesomeCapacitorSystemWebview'
|
|
7
7
|
s.version = package['version']
|
|
8
8
|
s.summary = package['description']
|
|
9
9
|
s.license = package['license']
|
package/Package.swift
CHANGED
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
import PackageDescription
|
|
3
3
|
|
|
4
4
|
let package = Package(
|
|
5
|
-
name: "
|
|
5
|
+
name: "CapawesomeCapacitorSystemWebview",
|
|
6
6
|
platforms: [.iOS(.v15)],
|
|
7
7
|
products: [
|
|
8
8
|
.library(
|
|
9
|
-
name: "
|
|
10
|
-
targets: ["
|
|
9
|
+
name: "CapawesomeCapacitorSystemWebview",
|
|
10
|
+
targets: ["SystemWebviewPlugin"])
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
13
|
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0")
|
|
14
14
|
],
|
|
15
15
|
targets: [
|
|
16
16
|
.target(
|
|
17
|
-
name: "
|
|
17
|
+
name: "SystemWebviewPlugin",
|
|
18
18
|
dependencies: [
|
|
19
19
|
.product(name: "Capacitor", package: "capacitor-swift-pm"),
|
|
20
20
|
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
21
21
|
],
|
|
22
22
|
path: "ios/Plugin"),
|
|
23
23
|
.testTarget(
|
|
24
|
-
name: "
|
|
25
|
-
dependencies: ["
|
|
24
|
+
name: "SystemWebviewPluginTests",
|
|
25
|
+
dependencies: ["SystemWebviewPlugin"],
|
|
26
26
|
path: "ios/PluginTests")
|
|
27
27
|
]
|
|
28
28
|
)
|
package/README.md
CHANGED
|
@@ -18,9 +18,14 @@ Capacitor plugin to detect an outdated Android System WebView and guide users to
|
|
|
18
18
|
|
|
19
19
|
Missing a feature? Just [open an issue](https://github.com/capawesome-team/capacitor-plugins/issues) and we'll take a look!
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Use Cases
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
The System WebView plugin is typically used to protect an app against outdated Android System WebViews, for example:
|
|
24
|
+
|
|
25
|
+
- **Update checks on app start**: Check with `isUpdateRequired(...)` whether the installed WebView meets the minimum Chromium version your app's bundle requires.
|
|
26
|
+
- **Guided update flows**: Prompt the user with a dialog and send them straight to the Play Store entry of their active WebView provider with `openAppStore()`.
|
|
27
|
+
- **Support diagnostics**: Read the package name and version of the active WebView provider with `getInfo()` and attach it to bug reports to explain hard-to-diagnose rendering issues.
|
|
28
|
+
- **Feature gating**: Only enable web features like CSS `:has()` or container queries when the installed WebView is recent enough to support them.
|
|
24
29
|
|
|
25
30
|
## Compatibility
|
|
26
31
|
|
|
@@ -72,14 +77,18 @@ No configuration required for this plugin.
|
|
|
72
77
|
|
|
73
78
|
## Usage
|
|
74
79
|
|
|
75
|
-
The
|
|
80
|
+
The following examples show how to prompt the user to update the WebView and read information about the WebView provider.
|
|
81
|
+
|
|
82
|
+
### Prompt the user to update the WebView
|
|
83
|
+
|
|
84
|
+
The recommended pattern is to check whether an update is required on app start, prompt the user with the [Dialog](https://capawesome.io/docs/sdks/capacitor/dialog/) plugin, and then open the Play Store. Only available on Android:
|
|
76
85
|
|
|
77
86
|
```typescript
|
|
87
|
+
import { SystemWebview } from '@capawesome/capacitor-system-webview';
|
|
78
88
|
import { Dialog } from '@capacitor/dialog';
|
|
79
|
-
import { SystemWebView } from '@capawesome/capacitor-system-webview';
|
|
80
89
|
|
|
81
90
|
const promptForUpdateIfRequired = async () => {
|
|
82
|
-
const { required } = await
|
|
91
|
+
const { required } = await SystemWebview.isUpdateRequired({
|
|
83
92
|
minMajorVersion: 105,
|
|
84
93
|
});
|
|
85
94
|
if (!required) {
|
|
@@ -92,19 +101,27 @@ const promptForUpdateIfRequired = async () => {
|
|
|
92
101
|
okButtonTitle: 'Update',
|
|
93
102
|
});
|
|
94
103
|
if (value) {
|
|
95
|
-
await
|
|
104
|
+
await SystemWebview.openAppStore();
|
|
96
105
|
}
|
|
97
106
|
};
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
> [!NOTE]
|
|
110
|
+
> A WebView update only takes effect the next time the app process is started. The currently running app keeps using the old WebView until it is restarted.
|
|
111
|
+
|
|
112
|
+
### Read information about the WebView provider
|
|
113
|
+
|
|
114
|
+
Get the package name, version name and Chromium major version of the active WebView provider, for example to attach it to your support diagnostics. Only available on Android:
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
import { SystemWebview } from '@capawesome/capacitor-system-webview';
|
|
98
118
|
|
|
99
119
|
const getInfo = async () => {
|
|
100
|
-
const info = await
|
|
120
|
+
const info = await SystemWebview.getInfo();
|
|
101
121
|
return info;
|
|
102
122
|
};
|
|
103
123
|
```
|
|
104
124
|
|
|
105
|
-
> [!NOTE]
|
|
106
|
-
> A WebView update only takes effect the next time the app process is started. The currently running app keeps using the old WebView until it is restarted.
|
|
107
|
-
|
|
108
125
|
## API
|
|
109
126
|
|
|
110
127
|
<docgen-index>
|
|
@@ -218,6 +235,42 @@ The following table gives a rough idea of when some popular web features became
|
|
|
218
235
|
|
|
219
236
|
Pick the minimum version based on the features your app uses and pass it as `minMajorVersion`.
|
|
220
237
|
|
|
238
|
+
## FAQ
|
|
239
|
+
|
|
240
|
+
### How is this plugin different from other similar plugins?
|
|
241
|
+
|
|
242
|
+
It turns a hard-to-diagnose class of Android bugs into something you can detect and fix: read the active WebView provider's package name, version, and Chromium major version, compare it against the minimum your app's bundle needs, and send users straight to the Play Store entry of their own WebView provider to update it. Your app declares the minimum Chromium version it requires, so the check always matches the web features your bundle actually uses. The API is fully typed and kept current with the latest Capacitor version.
|
|
243
|
+
|
|
244
|
+
### Why is this plugin not available on iOS?
|
|
245
|
+
|
|
246
|
+
On iOS, the `WKWebView` is part of the operating system and is updated together with iOS itself. It cannot be updated separately, so there is nothing for an app to detect or fix. All methods therefore reject as unimplemented on iOS and Web.
|
|
247
|
+
|
|
248
|
+
### Which minimum Chromium version should I require?
|
|
249
|
+
|
|
250
|
+
There is no universal threshold, because "outdated" depends on which web features your app's bundle actually needs. Pick the minimum Chromium major version based on the features your app uses (for example, CSS `:has()` and container queries require Chromium 105 or newer) and pass it as `minMajorVersion` to `isUpdateRequired(...)`. See [Why Outdated System WebViews Matter](#why-outdated-system-webviews-matter) for a rough feature baseline table.
|
|
251
|
+
|
|
252
|
+
### Why is `majorVersion` sometimes `null`?
|
|
253
|
+
|
|
254
|
+
The `majorVersion` is derived from the integer before the first dot of the WebView provider's `versionName`. If the `versionName` is not a Chromium-style version, which can happen with OEM WebView forks, the `majorVersion` is `null`. In that case, you can still inspect the raw `packageName` and `versionName` returned by `getInfo()`.
|
|
255
|
+
|
|
256
|
+
### Why does my app still use the old WebView after the user updated it?
|
|
257
|
+
|
|
258
|
+
A WebView update only takes effect the next time the app process is started. The currently running app keeps using the old WebView until it is restarted.
|
|
259
|
+
|
|
260
|
+
### Can I use this plugin with Ionic, React, Vue or Angular?
|
|
261
|
+
|
|
262
|
+
Yes, the plugin is framework-agnostic. It works in any Capacitor app regardless of the web framework, including Ionic with Angular, React, or Vue, as well as plain JavaScript projects.
|
|
263
|
+
|
|
264
|
+
## Related Plugins
|
|
265
|
+
|
|
266
|
+
- [App Update](https://capawesome.io/docs/sdks/capacitor/app-update/): Assist with native app updates.
|
|
267
|
+
- [Device Info](https://capawesome.io/docs/sdks/capacitor/device-info/): Read device information, such as the model, manufacturer, and operating system.
|
|
268
|
+
- [Dialog](https://capawesome.io/docs/sdks/capacitor/dialog/): Show native alert, confirm, and prompt dialogs.
|
|
269
|
+
|
|
270
|
+
## Newsletter
|
|
271
|
+
|
|
272
|
+
Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).
|
|
273
|
+
|
|
221
274
|
## Changelog
|
|
222
275
|
|
|
223
276
|
See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/system-webview/CHANGELOG.md).
|
|
@@ -15,12 +15,12 @@ import io.capawesome.capacitorjs.plugins.systemwebview.classes.results.IsUpdateR
|
|
|
15
15
|
import io.capawesome.capacitorjs.plugins.systemwebview.interfaces.EmptyCallback;
|
|
16
16
|
import io.capawesome.capacitorjs.plugins.systemwebview.interfaces.NonEmptyResultCallback;
|
|
17
17
|
|
|
18
|
-
public class
|
|
18
|
+
public class SystemWebview {
|
|
19
19
|
|
|
20
20
|
@NonNull
|
|
21
|
-
private final
|
|
21
|
+
private final SystemWebviewPlugin plugin;
|
|
22
22
|
|
|
23
|
-
public
|
|
23
|
+
public SystemWebview(@NonNull SystemWebviewPlugin plugin) {
|
|
24
24
|
this.plugin = plugin;
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -15,17 +15,17 @@ import io.capawesome.capacitorjs.plugins.systemwebview.interfaces.EmptyCallback;
|
|
|
15
15
|
import io.capawesome.capacitorjs.plugins.systemwebview.interfaces.NonEmptyResultCallback;
|
|
16
16
|
import io.capawesome.capacitorjs.plugins.systemwebview.interfaces.Result;
|
|
17
17
|
|
|
18
|
-
@CapacitorPlugin(name = "
|
|
19
|
-
public class
|
|
18
|
+
@CapacitorPlugin(name = "SystemWebview")
|
|
19
|
+
public class SystemWebviewPlugin extends Plugin {
|
|
20
20
|
|
|
21
21
|
public static final String ERROR_UNKNOWN_ERROR = "An unknown error occurred.";
|
|
22
|
-
public static final String TAG = "
|
|
22
|
+
public static final String TAG = "SystemWebviewPlugin";
|
|
23
23
|
|
|
24
|
-
private
|
|
24
|
+
private SystemWebview implementation;
|
|
25
25
|
|
|
26
26
|
@Override
|
|
27
27
|
public void load() {
|
|
28
|
-
implementation = new
|
|
28
|
+
implementation = new SystemWebview(this);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
@PluginMethod
|
package/dist/docs.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA6FA;;GAEG;AACH,MAAM,CAAN,IAAY,SAqBX;AArBD,WAAY,SAAS;IACnB;;;;OAIG;IACH,uCAA0B,CAAA;IAC1B;;;;;OAKG;IACH,uDAA0C,CAAA;IAC1C;;;;;OAKG;IACH,uEAA0D,CAAA;AAC5D,CAAC,EArBW,SAAS,KAAT,SAAS,QAqBpB","sourcesContent":["export interface
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AA6FA;;GAEG;AACH,MAAM,CAAN,IAAY,SAqBX;AArBD,WAAY,SAAS;IACnB;;;;OAIG;IACH,uCAA0B,CAAA;IAC1B;;;;;OAKG;IACH,uDAA0C,CAAA;IAC1C;;;;;OAKG;IACH,uEAA0D,CAAA;AAC5D,CAAC,EArBW,SAAS,KAAT,SAAS,QAqBpB","sourcesContent":["export interface SystemWebviewPlugin {\n /**\n * Get information about the active Android System WebView provider.\n *\n * Only available on Android.\n *\n * @since 0.1.0\n */\n getInfo(): Promise<GetInfoResult>;\n /**\n * Check whether the active Android System WebView is older than the minimum\n * Chromium major version required by your app.\n *\n * Only available on Android.\n *\n * @since 0.1.0\n */\n isUpdateRequired(\n options: IsUpdateRequiredOptions,\n ): Promise<IsUpdateRequiredResult>;\n /**\n * Open the Play Store entry of the active Android System WebView provider so\n * the user can update it.\n *\n * Only available on Android.\n *\n * @since 0.1.0\n */\n openAppStore(): Promise<void>;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface GetInfoResult {\n /**\n * The Chromium major version of the active WebView provider.\n *\n * This is the integer before the first dot of the `versionName`\n * (e.g. `126` for `126.0.6478.122`).\n *\n * `null` if the `versionName` is not a Chromium-style version, which can\n * happen with OEM WebView forks.\n *\n * @since 0.1.0\n * @example 126\n */\n majorVersion: number | null;\n /**\n * The package name of the active WebView provider.\n *\n * @since 0.1.0\n * @example \"com.google.android.webview\"\n */\n packageName: string;\n /**\n * The version name of the active WebView provider.\n *\n * @since 0.1.0\n * @example \"126.0.6478.122\"\n */\n versionName: string;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface IsUpdateRequiredOptions {\n /**\n * The minimum Chromium major version your app requires.\n *\n * The active WebView is considered outdated if its `majorVersion` is lower\n * than this value.\n *\n * @since 0.1.0\n * @example 105\n */\n minMajorVersion: number;\n}\n\n/**\n * @since 0.1.0\n */\nexport interface IsUpdateRequiredResult {\n /**\n * `true` if the active WebView is older than the required minimum version,\n * otherwise `false`.\n *\n * @since 0.1.0\n */\n required: boolean;\n}\n\n/**\n * @since 0.1.0\n */\nexport enum ErrorCode {\n /**\n * The Play Store could not be opened.\n *\n * @since 0.1.0\n */\n OpenFailed = 'OPEN_FAILED',\n /**\n * The WebView version name is not a Chromium-style version and could not be\n * parsed into a major version.\n *\n * @since 0.1.0\n */\n VersionUnparseable = 'VERSION_UNPARSEABLE',\n /**\n * The active WebView package could not be determined, which can happen on\n * custom ROMs or when the System WebView is disabled.\n *\n * @since 0.1.0\n */\n WebViewPackageUnavailable = 'WEB_VIEW_PACKAGE_UNAVAILABLE',\n}\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const
|
|
1
|
+
import type { SystemWebviewPlugin } from './definitions';
|
|
2
|
+
declare const SystemWebview: SystemWebviewPlugin;
|
|
3
3
|
export * from './definitions';
|
|
4
|
-
export {
|
|
4
|
+
export { SystemWebview };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { registerPlugin } from '@capacitor/core';
|
|
2
|
-
const
|
|
3
|
-
web: () => import('./web').then(m => new m.
|
|
2
|
+
const SystemWebview = registerPlugin('SystemWebview', {
|
|
3
|
+
web: () => import('./web').then(m => new m.SystemWebviewWeb()),
|
|
4
4
|
});
|
|
5
5
|
export * from './definitions';
|
|
6
|
-
export {
|
|
6
|
+
export { SystemWebview };
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,aAAa,GAAG,cAAc,CAAsB,eAAe,EAAE;IACzE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;CAC/D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type {
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,aAAa,GAAG,cAAc,CAAsB,eAAe,EAAE;IACzE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;CAC/D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { SystemWebviewPlugin } from './definitions';\n\nconst SystemWebview = registerPlugin<SystemWebviewPlugin>('SystemWebview', {\n web: () => import('./web').then(m => new m.SystemWebviewWeb()),\n});\n\nexport * from './definitions';\nexport { SystemWebview };\n"]}
|
package/dist/esm/web.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WebPlugin } from '@capacitor/core';
|
|
2
|
-
import type { GetInfoResult, IsUpdateRequiredResult,
|
|
3
|
-
export declare class
|
|
2
|
+
import type { GetInfoResult, IsUpdateRequiredResult, SystemWebviewPlugin } from './definitions';
|
|
3
|
+
export declare class SystemWebviewWeb extends WebPlugin implements SystemWebviewPlugin {
|
|
4
4
|
getInfo(): Promise<GetInfoResult>;
|
|
5
5
|
isUpdateRequired(): Promise<IsUpdateRequiredResult>;
|
|
6
6
|
openAppStore(): Promise<void>;
|
package/dist/esm/web.js
CHANGED
package/dist/esm/web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAC7C,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n GetInfoResult,\n IsUpdateRequiredResult,\n
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAC7C,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;IACtD,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n GetInfoResult,\n IsUpdateRequiredResult,\n SystemWebviewPlugin,\n} from './definitions';\n\nexport class SystemWebviewWeb extends WebPlugin implements SystemWebviewPlugin {\n async getInfo(): Promise<GetInfoResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async isUpdateRequired(): Promise<IsUpdateRequiredResult> {\n throw this.unimplemented('Not implemented on web.');\n }\n\n async openAppStore(): Promise<void> {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"]}
|
package/dist/plugin.cjs.js
CHANGED
|
@@ -29,11 +29,11 @@ exports.ErrorCode = void 0;
|
|
|
29
29
|
ErrorCode["WebViewPackageUnavailable"] = "WEB_VIEW_PACKAGE_UNAVAILABLE";
|
|
30
30
|
})(exports.ErrorCode || (exports.ErrorCode = {}));
|
|
31
31
|
|
|
32
|
-
const
|
|
33
|
-
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.
|
|
32
|
+
const SystemWebview = core.registerPlugin('SystemWebview', {
|
|
33
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.SystemWebviewWeb()),
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
class
|
|
36
|
+
class SystemWebviewWeb extends core.WebPlugin {
|
|
37
37
|
async getInfo() {
|
|
38
38
|
throw this.unimplemented('Not implemented on web.');
|
|
39
39
|
}
|
|
@@ -47,8 +47,8 @@ class SystemWebViewWeb extends core.WebPlugin {
|
|
|
47
47
|
|
|
48
48
|
var web = /*#__PURE__*/Object.freeze({
|
|
49
49
|
__proto__: null,
|
|
50
|
-
|
|
50
|
+
SystemWebviewWeb: SystemWebviewWeb
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
exports.
|
|
53
|
+
exports.SystemWebview = SystemWebview;
|
|
54
54
|
//# sourceMappingURL=plugin.cjs.js.map
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * @since 0.1.0\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n /**\n * The Play Store could not be opened.\n *\n * @since 0.1.0\n */\n ErrorCode[\"OpenFailed\"] = \"OPEN_FAILED\";\n /**\n * The WebView version name is not a Chromium-style version and could not be\n * parsed into a major version.\n *\n * @since 0.1.0\n */\n ErrorCode[\"VersionUnparseable\"] = \"VERSION_UNPARSEABLE\";\n /**\n * The active WebView package could not be determined, which can happen on\n * custom ROMs or when the System WebView is disabled.\n *\n * @since 0.1.0\n */\n ErrorCode[\"WebViewPackageUnavailable\"] = \"WEB_VIEW_PACKAGE_UNAVAILABLE\";\n})(ErrorCode || (ErrorCode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * @since 0.1.0\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n /**\n * The Play Store could not be opened.\n *\n * @since 0.1.0\n */\n ErrorCode[\"OpenFailed\"] = \"OPEN_FAILED\";\n /**\n * The WebView version name is not a Chromium-style version and could not be\n * parsed into a major version.\n *\n * @since 0.1.0\n */\n ErrorCode[\"VersionUnparseable\"] = \"VERSION_UNPARSEABLE\";\n /**\n * The active WebView package could not be determined, which can happen on\n * custom ROMs or when the System WebView is disabled.\n *\n * @since 0.1.0\n */\n ErrorCode[\"WebViewPackageUnavailable\"] = \"WEB_VIEW_PACKAGE_UNAVAILABLE\";\n})(ErrorCode || (ErrorCode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst SystemWebview = registerPlugin('SystemWebview', {\n web: () => import('./web').then(m => new m.SystemWebviewWeb()),\n});\nexport * from './definitions';\nexport { SystemWebview };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class SystemWebviewWeb extends WebPlugin {\n async getInfo() {\n throw this.unimplemented('Not implemented on web.');\n }\n async isUpdateRequired() {\n throw this.unimplemented('Not implemented on web.');\n }\n async openAppStore() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ErrorCode","registerPlugin","WebPlugin"],"mappings":";;;;AAAA;AACA;AACA;AACWA;AACX,CAAC,UAAU,SAAS,EAAE;AACtB;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,YAAY,CAAC,GAAG,aAAa;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,oBAAoB,CAAC,GAAG,qBAAqB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,CAAC,2BAA2B,CAAC,GAAG,8BAA8B;AAC3E,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC;;ACxB5B,MAAC,aAAa,GAAGC,mBAAc,CAAC,eAAe,EAAE;AACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;AAClE,CAAC;;ACFM,MAAM,gBAAgB,SAASC,cAAS,CAAC;AAChD,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ;;;;;;;;;"}
|
package/dist/plugin.js
CHANGED
|
@@ -28,11 +28,11 @@ var capacitorSim = (function (exports, core) {
|
|
|
28
28
|
ErrorCode["WebViewPackageUnavailable"] = "WEB_VIEW_PACKAGE_UNAVAILABLE";
|
|
29
29
|
})(exports.ErrorCode || (exports.ErrorCode = {}));
|
|
30
30
|
|
|
31
|
-
const
|
|
32
|
-
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.
|
|
31
|
+
const SystemWebview = core.registerPlugin('SystemWebview', {
|
|
32
|
+
web: () => Promise.resolve().then(function () { return web; }).then(m => new m.SystemWebviewWeb()),
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
class
|
|
35
|
+
class SystemWebviewWeb extends core.WebPlugin {
|
|
36
36
|
async getInfo() {
|
|
37
37
|
throw this.unimplemented('Not implemented on web.');
|
|
38
38
|
}
|
|
@@ -46,10 +46,10 @@ var capacitorSim = (function (exports, core) {
|
|
|
46
46
|
|
|
47
47
|
var web = /*#__PURE__*/Object.freeze({
|
|
48
48
|
__proto__: null,
|
|
49
|
-
|
|
49
|
+
SystemWebviewWeb: SystemWebviewWeb
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
exports.
|
|
52
|
+
exports.SystemWebview = SystemWebview;
|
|
53
53
|
|
|
54
54
|
return exports;
|
|
55
55
|
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * @since 0.1.0\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n /**\n * The Play Store could not be opened.\n *\n * @since 0.1.0\n */\n ErrorCode[\"OpenFailed\"] = \"OPEN_FAILED\";\n /**\n * The WebView version name is not a Chromium-style version and could not be\n * parsed into a major version.\n *\n * @since 0.1.0\n */\n ErrorCode[\"VersionUnparseable\"] = \"VERSION_UNPARSEABLE\";\n /**\n * The active WebView package could not be determined, which can happen on\n * custom ROMs or when the System WebView is disabled.\n *\n * @since 0.1.0\n */\n ErrorCode[\"WebViewPackageUnavailable\"] = \"WEB_VIEW_PACKAGE_UNAVAILABLE\";\n})(ErrorCode || (ErrorCode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["/**\n * @since 0.1.0\n */\nexport var ErrorCode;\n(function (ErrorCode) {\n /**\n * The Play Store could not be opened.\n *\n * @since 0.1.0\n */\n ErrorCode[\"OpenFailed\"] = \"OPEN_FAILED\";\n /**\n * The WebView version name is not a Chromium-style version and could not be\n * parsed into a major version.\n *\n * @since 0.1.0\n */\n ErrorCode[\"VersionUnparseable\"] = \"VERSION_UNPARSEABLE\";\n /**\n * The active WebView package could not be determined, which can happen on\n * custom ROMs or when the System WebView is disabled.\n *\n * @since 0.1.0\n */\n ErrorCode[\"WebViewPackageUnavailable\"] = \"WEB_VIEW_PACKAGE_UNAVAILABLE\";\n})(ErrorCode || (ErrorCode = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from '@capacitor/core';\nconst SystemWebview = registerPlugin('SystemWebview', {\n web: () => import('./web').then(m => new m.SystemWebviewWeb()),\n});\nexport * from './definitions';\nexport { SystemWebview };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class SystemWebviewWeb extends WebPlugin {\n async getInfo() {\n throw this.unimplemented('Not implemented on web.');\n }\n async isUpdateRequired() {\n throw this.unimplemented('Not implemented on web.');\n }\n async openAppStore() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["ErrorCode","registerPlugin","WebPlugin"],"mappings":";;;IAAA;IACA;IACA;AACWA;IACX,CAAC,UAAU,SAAS,EAAE;IACtB;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,YAAY,CAAC,GAAG,aAAa;IAC3C;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,oBAAoB,CAAC,GAAG,qBAAqB;IAC3D;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,SAAS,CAAC,2BAA2B,CAAC,GAAG,8BAA8B;IAC3E,CAAC,EAAEA,iBAAS,KAAKA,iBAAS,GAAG,EAAE,CAAC,CAAC;;ACxB5B,UAAC,aAAa,GAAGC,mBAAc,CAAC,eAAe,EAAE;IACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAClE,CAAC;;ICFM,MAAM,gBAAgB,SAASC,cAAS,CAAC;IAChD,IAAI,MAAM,OAAO,GAAG;IACpB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
import Capacitor
|
|
3
3
|
|
|
4
|
-
@objc(
|
|
5
|
-
public class
|
|
6
|
-
public let identifier = "
|
|
7
|
-
public let jsName = "
|
|
4
|
+
@objc(SystemWebviewPlugin)
|
|
5
|
+
public class SystemWebviewPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
6
|
+
public let identifier = "SystemWebviewPlugin"
|
|
7
|
+
public let jsName = "SystemWebview"
|
|
8
8
|
public let pluginMethods: [CAPPluginMethod] = [
|
|
9
9
|
CAPPluginMethod(name: "getInfo", returnType: CAPPluginReturnPromise),
|
|
10
10
|
CAPPluginMethod(name: "isUpdateRequired", returnType: CAPPluginReturnPromise),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capawesome/capacitor-system-webview",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Capacitor plugin to detect an outdated Android System WebView and guide users to update it.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"android/build.gradle",
|
|
12
12
|
"dist/",
|
|
13
13
|
"ios/Plugin/",
|
|
14
|
-
"
|
|
14
|
+
"CapawesomeCapacitorSystemWebview.podspec",
|
|
15
15
|
"Package.swift"
|
|
16
16
|
],
|
|
17
17
|
"author": "Robin Genz <mail@robingenz.dev>",
|
|
@@ -37,7 +37,15 @@
|
|
|
37
37
|
"keywords": [
|
|
38
38
|
"capacitor",
|
|
39
39
|
"plugin",
|
|
40
|
-
"native"
|
|
40
|
+
"native",
|
|
41
|
+
"capacitor-plugin",
|
|
42
|
+
"android system webview",
|
|
43
|
+
"webview version",
|
|
44
|
+
"webview update",
|
|
45
|
+
"outdated webview",
|
|
46
|
+
"chromium version",
|
|
47
|
+
"webview",
|
|
48
|
+
"android"
|
|
41
49
|
],
|
|
42
50
|
"scripts": {
|
|
43
51
|
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
@@ -49,7 +57,7 @@
|
|
|
49
57
|
"eslint": "eslint . --ext ts",
|
|
50
58
|
"prettier": "prettier \"**/*.{css,html,ts,js,java}\"",
|
|
51
59
|
"swiftlint": "node-swiftlint",
|
|
52
|
-
"docgen": "docgen --api
|
|
60
|
+
"docgen": "docgen --api SystemWebviewPlugin --output-readme README.md --output-json dist/docs.json",
|
|
53
61
|
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
54
62
|
"clean": "rimraf ./dist",
|
|
55
63
|
"watch": "tsc --watch",
|