@onekeyfe/react-native-webview-cleaner 6.7.0-alpha.415 → 6.7.0-alpha.418
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 +127 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,56 @@
|
|
|
1
|
-
# react-native-webview-cleaner
|
|
1
|
+
# @onekeyfe/react-native-webview-cleaner
|
|
2
2
|
|
|
3
|
-
React Native WebView website data cleaner for iOS and Android.
|
|
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`.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
The [behavioral contract](docs/SPEC.md) is the authoritative reference for platform
|
|
8
|
+
behavior, completion limits, and migration details.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Install the package in your React Native application using one package manager:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
yarn add @onekeyfe/react-native-webview-cleaner
|
|
16
|
+
```
|
|
17
|
+
|
|
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:
|
|
26
|
+
|
|
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.
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import WebViewCleaner from '@onekeyfe/react-native-webview-cleaner';
|
|
46
|
+
|
|
47
|
+
// Request deletion of app-wide WebView website data.
|
|
48
|
+
WebViewCleaner.clearAll();
|
|
49
|
+
// Execution continues without waiting for native deletion to finish.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Existing OneKey consumers that install the scoped package under the
|
|
53
|
+
`react-native-webview-cleaner` dependency alias can retain their existing import:
|
|
6
54
|
|
|
7
55
|
```ts
|
|
8
56
|
import WebViewCleaner from 'react-native-webview-cleaner';
|
|
@@ -10,4 +58,79 @@ import WebViewCleaner from 'react-native-webview-cleaner';
|
|
|
10
58
|
WebViewCleaner.clearAll();
|
|
11
59
|
```
|
|
12
60
|
|
|
13
|
-
|
|
61
|
+
Use the import that matches the dependency name in your application's manifest.
|
|
62
|
+
|
|
63
|
+
## API
|
|
64
|
+
|
|
65
|
+
The default export exposes one method:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
clearAll(): void;
|
|
69
|
+
```
|
|
70
|
+
|
|
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.
|
|
74
|
+
|
|
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.
|
|
78
|
+
|
|
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.
|
|
89
|
+
|
|
90
|
+
## Shared data and concurrent calls
|
|
91
|
+
|
|
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.
|
|
96
|
+
|
|
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.
|
|
101
|
+
|
|
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.
|
|
106
|
+
|
|
107
|
+
## Failures and resource limits
|
|
108
|
+
|
|
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.
|
|
119
|
+
|
|
120
|
+
## Compatibility and verification status
|
|
121
|
+
|
|
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.
|
|
125
|
+
|
|
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.
|
|
131
|
+
|
|
132
|
+
## License and support
|
|
133
|
+
|
|
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.
|