@onekeyfe/react-native-webview-cleaner 6.7.0-alpha.475 → 6.8.0-2
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/README.md +81 -100
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,136 +1,117 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
one method, `clearAll()`, which requests deletion through the platform's website
|
|
5
|
-
data APIs. It uses the existing React Native bridge module `RNWebViewCleaner`.
|
|
3
|
+
# @onekeyfe/react-native-webview-cleaner
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
**Clear the app's WebView website data with one fire-and-forget call.**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@onekeyfe/react-native-webview-cleaner)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
Exposes a single `clearAll()` method that requests deletion of app-wide WebView
|
|
16
|
+
website data through the platform stores. iOS removes every `WKWebsiteDataStore`
|
|
17
|
+
data type modified since the Unix epoch from the default data store; Android
|
|
18
|
+
removes all cookies, flushes them, and deletes all `WebStorage` data. The call is
|
|
19
|
+
fire-and-forget — it returns `undefined`, takes no filters, and reports no
|
|
20
|
+
completion. There is no Web implementation.
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- **One call** — `clearAll()` clears the app's default WebView stores without
|
|
25
|
+
arguments, keys or per-origin bookkeeping.
|
|
26
|
+
- **Covers both stores** — WebKit website data types on iOS; cookies plus
|
|
27
|
+
`WebStorage` on Android.
|
|
28
|
+
- **No retained state** — the wrapper performs one bridge call and keeps no
|
|
29
|
+
JavaScript cache, queue or request state.
|
|
30
|
+
- **Legacy-compatible entry point** — the default export and the
|
|
31
|
+
`RNWebViewCleaner` native module name are unchanged, so existing consumers and
|
|
32
|
+
dependency aliases keep working.
|
|
33
|
+
- **No new native runtime** — the package is a classic React Native bridge
|
|
34
|
+
module; it does not add a Nitro dependency.
|
|
9
35
|
|
|
10
36
|
## Installation
|
|
11
37
|
|
|
12
|
-
Install the package in your React Native application using one package manager:
|
|
13
|
-
|
|
14
38
|
```sh
|
|
15
39
|
yarn add @onekeyfe/react-native-webview-cleaner
|
|
16
40
|
```
|
|
17
41
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
npm install @onekeyfe/react-native-webview-cleaner
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
For iOS, install the application's CocoaPods dependencies from its `ios` directory
|
|
25
|
-
and rebuild the native app:
|
|
42
|
+
Install the app's iOS pods and rebuild the native binary; Android links through
|
|
43
|
+
autolinking and also requires a native rebuild. The package has no Nitro or
|
|
44
|
+
other native peer dependency.
|
|
26
45
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Android also requires a native rebuild after installation. React Native autolinking
|
|
33
|
-
uses the installed npm package; this package does not require Nitro Modules.
|
|
34
|
-
Standalone CocoaPods installation from the podspec's source repository is outside
|
|
35
|
-
the verified installation scope; the podspec retains a historical source placeholder.
|
|
36
|
-
|
|
37
|
-
The package declares `react` and `react-native` as peer dependencies and Node.js
|
|
38
|
-
18 or newer as its package engine. The wildcard peer ranges do not establish
|
|
39
|
-
compatibility with every React Native version or architecture. See the verification
|
|
40
|
-
status below for the current limits of acceptance evidence.
|
|
46
|
+
If an application installs the package under the legacy
|
|
47
|
+
`react-native-webview-cleaner` dependency alias, the alias import below still
|
|
48
|
+
resolves to the same module.
|
|
41
49
|
|
|
42
50
|
## Usage
|
|
43
51
|
|
|
44
52
|
```ts
|
|
45
53
|
import WebViewCleaner from '@onekeyfe/react-native-webview-cleaner';
|
|
46
54
|
|
|
47
|
-
//
|
|
55
|
+
// Requests deletion of app-wide WebView website data.
|
|
48
56
|
WebViewCleaner.clearAll();
|
|
49
|
-
//
|
|
57
|
+
// This returns immediately; native deletion is not awaited.
|
|
50
58
|
```
|
|
51
59
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```ts
|
|
56
|
-
import WebViewCleaner from 'react-native-webview-cleaner';
|
|
57
|
-
|
|
58
|
-
WebViewCleaner.clearAll();
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Use the import that matches the dependency name in your application's manifest.
|
|
60
|
+
The application owns any coordination around clearing — for example deciding
|
|
61
|
+
when to run it relative to logout or the next WebView load.
|
|
62
62
|
|
|
63
63
|
## API
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
clearAll(): void;
|
|
69
|
-
```
|
|
65
|
+
| Export | Signature | Platforms | Description |
|
|
66
|
+
| --- | --- | :-: | --- |
|
|
67
|
+
| default `clearAll` | `() => void` | iOS, Android | Requests deletion of the app's default WebView website data. |
|
|
70
68
|
|
|
71
|
-
`clearAll()`
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
`clearAll()` has no caller-visible completion callback, result or event. The
|
|
70
|
+
wrapper calls `NativeModules.RNWebViewCleaner.clearAll()` and discards the native
|
|
71
|
+
result, including the iOS promise. See [`src/index.ts`](src/index.ts) for the
|
|
72
|
+
wrapper and [`docs/SPEC.md`](docs/SPEC.md) for the full behavioral contract.
|
|
74
73
|
|
|
75
|
-
|
|
76
|
-
JavaScript wrapper discards the native return value, including the native promise
|
|
77
|
-
on iOS. A subsequent WebView operation can run while deletion is still pending.
|
|
74
|
+
If the installed dependency uses the legacy alias, import it the same way:
|
|
78
75
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
| Platform | Requested operation | Completion behavior |
|
|
82
|
-
| --- | --- | --- |
|
|
83
|
-
| iOS | Dispatch to the main queue and remove all WebKit website data types from `WKWebsiteDataStore.defaultDataStore` modified since the Unix epoch. | WebKit invokes a native completion handler and the native promise resolves with `nil`; the JavaScript wrapper discards that promise. |
|
|
84
|
-
| Android | Call `CookieManager.removeAllCookies(null)`, then `CookieManager.flush()`, then `WebStorage.deleteAllData()`. | The native method returns `void`. Cookie removal may still be pending. |
|
|
85
|
-
| Web | Unsupported. | No Web implementation or fallback is provided. |
|
|
86
|
-
|
|
87
|
-
The Android operation does not guarantee removal of every WebView disk cache.
|
|
88
|
-
The two platforms retain their existing platform-specific deletion behavior.
|
|
76
|
+
```ts
|
|
77
|
+
import WebViewCleaner from 'react-native-webview-cleaner';
|
|
89
78
|
|
|
90
|
-
|
|
79
|
+
WebViewCleaner.clearAll();
|
|
80
|
+
```
|
|
91
81
|
|
|
92
|
-
|
|
93
|
-
cookies and website storage used by other WebViews in the same app and can affect
|
|
94
|
-
their signed-in website sessions. There is no per-wallet, per-account, or per-tab
|
|
95
|
-
partition in this API.
|
|
82
|
+
## Platform support
|
|
96
83
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
84
|
+
| Capability | iOS | Android | Web |
|
|
85
|
+
| --- | :-: | :-: | :-: |
|
|
86
|
+
| Remove website data | ✅ all WebKit types since epoch | ✅ cookies + `WebStorage` | — |
|
|
87
|
+
| Filter by account, origin or data type | — | — | — |
|
|
88
|
+
| Completion callback or result | — | — | — |
|
|
89
|
+
| Await deletion completion | — | — | — |
|
|
101
90
|
|
|
102
|
-
|
|
103
|
-
the return from `clearAll()` as a completion barrier for logout, account switching,
|
|
104
|
-
or the next WebView load. Workflows requiring confirmed completion need an API
|
|
105
|
-
that explicitly reports it.
|
|
91
|
+
## Caveats
|
|
106
92
|
|
|
107
|
-
|
|
93
|
+
> [!IMPORTANT]
|
|
94
|
+
> `clearAll()` returns `undefined`; `await` does not wait for deletion to finish.
|
|
95
|
+
> Do not treat the call as a completion barrier for logout, account switching or
|
|
96
|
+
> the next WebView load.
|
|
108
97
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
method. A JavaScript `try`/`catch` cannot confirm the outcome of deletion.
|
|
114
|
-
- The package provides no retries, fallback, progress reporting, or timeout.
|
|
115
|
-
- Platform APIs control deletion duration and data volume. There is no guaranteed
|
|
116
|
-
latency, byte count, or package-defined numeric limit.
|
|
117
|
-
- The wrapper retains no JavaScript cache or request state. Native deletion can
|
|
118
|
-
involve system I/O, and platform permissions and security checks still apply.
|
|
98
|
+
> [!WARNING]
|
|
99
|
+
> The native stores are app-wide. Clearing removes cookies and website storage
|
|
100
|
+
> used by every WebView in the same app, with no per-wallet, per-account or
|
|
101
|
+
> per-tab partition, and repeated calls can overlap.
|
|
119
102
|
|
|
120
|
-
|
|
103
|
+
> [!NOTE]
|
|
104
|
+
> Android's operation does not guarantee removal of every WebView disk cache, and
|
|
105
|
+
> cookie removal may still be pending when the method returns. Native failures are
|
|
106
|
+
> not reported through the public API; an unavailable native module can throw
|
|
107
|
+
> synchronously.
|
|
121
108
|
|
|
122
|
-
|
|
123
|
-
consumer alias, and autolinking paths. It ships CommonJS, ESM, TypeScript
|
|
124
|
-
declarations, and a React Native source entry point.
|
|
109
|
+
## References
|
|
125
110
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
These checks are distinct from source conformance; consult the
|
|
130
|
-
[SPEC](docs/SPEC.md) for acceptance requirements and known migration limitations.
|
|
111
|
+
- [Package spec](docs/SPEC.md)
|
|
112
|
+
- [npm package](https://www.npmjs.com/package/@onekeyfe/react-native-webview-cleaner)
|
|
113
|
+
- [Changelog](../../CHANGELOG.md)
|
|
131
114
|
|
|
132
|
-
## License
|
|
115
|
+
## License
|
|
133
116
|
|
|
134
|
-
|
|
135
|
-
[app-modules issue tracker](https://github.com/OneKeyHQ/app-modules/issues), including
|
|
136
|
-
the package version, platform, React Native version, and reproduction steps.
|
|
117
|
+
MIT. See [LICENSE](LICENSE).
|