@onekeyfe/react-native-webview-cleaner 6.7.0-alpha.475 → 6.8.0-11

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.
Files changed (2) hide show
  1. package/README.md +81 -100
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,136 +1,117 @@
1
- # @onekeyfe/react-native-webview-cleaner
1
+ <div align="center">
2
2
 
3
- React Native WebView website data cleaner for iOS and Android. The package exposes
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
- The [behavioral contract](docs/SPEC.md) is the authoritative reference for platform
8
- behavior, completion limits, and migration details.
5
+ **Clear the app's WebView website data with one fire-and-forget call.**
6
+
7
+ [![npm](https://img.shields.io/npm/v/%40onekeyfe%2Freact-native-webview-cleaner?label=npm&color=4D6BFE)](https://www.npmjs.com/package/@onekeyfe/react-native-webview-cleaner)
8
+ [![license](https://img.shields.io/npm/l/%40onekeyfe%2Freact-native-webview-cleaner?label=license&color=4D6BFE)](LICENSE)
9
+ ![iOS](https://img.shields.io/badge/iOS-000000?logo=apple&logoColor=white)
10
+ ![Android](https://img.shields.io/badge/Android-3DDC84?logo=android&logoColor=white)
11
+ ![NativeModule](https://img.shields.io/badge/NativeModule-4D6BFE)
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
- Or with npm:
19
-
20
- ```sh
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
- ```sh
28
- cd ios
29
- pod install
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
- // Request deletion of app-wide WebView website data.
55
+ // Requests deletion of app-wide WebView website data.
48
56
  WebViewCleaner.clearAll();
49
- // Execution continues without waiting for native deletion to finish.
57
+ // This returns immediately; native deletion is not awaited.
50
58
  ```
51
59
 
52
- Existing OneKey consumers that install the scoped package under the
53
- `react-native-webview-cleaner` dependency alias can retain their existing import:
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
- The default export exposes one method:
66
-
67
- ```ts
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()` takes no arguments and applies no account, tab, origin, URL, or data-type
72
- filter. It makes one call to `NativeModules.RNWebViewCleaner.clearAll()` and returns
73
- `undefined`. There is no caller-visible completion callback, result, or event.
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
- **`await WebViewCleaner.clearAll()` does not wait for deletion to complete.** The
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
- ## Platform behavior
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
- ## Shared data and concurrent calls
79
+ WebViewCleaner.clearAll();
80
+ ```
91
81
 
92
- The native website data stores are app-wide resources. Clearing them can remove
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
- The app's `main` and `bg` JavaScript runtimes have independent heaps but can operate
98
- on the same native website data stores. Calls from either runtime can affect the
99
- same data. The package provides no cross-runtime queue, cancellation, or
100
- serialization; repeated calls can overlap.
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
- Consumers own any application-level coordination around clearing. Do not treat
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
- ## Failures and resource limits
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
- - An unavailable `NativeModules.RNWebViewCleaner` can cause a synchronous
110
- JavaScript failure. Check native installation, autolinking, and the rebuilt app
111
- when the module is unavailable.
112
- - Native asynchronous failures are not reported through the public `clearAll()`
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
- ## Compatibility and verification status
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
- This package preserves the published legacy bridge API, native module name,
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
- The current contract records source and local package checks as passed. Consumer
127
- Release runtime checks remain pending, including full Android Release APK/R8 and
128
- iOS archive/runtime acceptance with the published version installed and locked.
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 and support
115
+ ## License
133
116
 
134
- Licensed under the [MIT License](LICENSE). Report package issues in the
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).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-webview-cleaner",
3
- "version": "6.7.0-alpha.475",
3
+ "version": "6.8.0-11",
4
4
  "description": "webview cleaner",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",