@onekeyfe/react-native-app-update 3.0.162 → 3.0.165

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 +58 -0
  2. package/package.json +6 -5
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # @onekeyfe/react-native-app-update
2
+
3
+ Android APK download, signature verification and installation support for OneKey.
4
+ The Nitro interface also exposes download progress and downloaded-artifact
5
+ cleanup. The application owns update selection, user interaction and deciding
6
+ when an installation should proceed.
7
+
8
+ ## Installation
9
+
10
+ ```sh
11
+ yarn add @onekeyfe/react-native-app-update react-native-nitro-modules
12
+ ```
13
+
14
+ Rebuild the native application after installation. On iOS, install the application
15
+ pods as part of its usual native dependency workflow.
16
+
17
+ ## Usage
18
+
19
+ ```ts
20
+ import { ReactNativeAppUpdate } from '@onekeyfe/react-native-app-update';
21
+
22
+ const listenerId = ReactNativeAppUpdate.addDownloadListener((event) => {
23
+ console.log(event.type, event.progress);
24
+ });
25
+
26
+ try {
27
+ await ReactNativeAppUpdate.downloadAPK({
28
+ downloadUrl: 'https://updates.example.com/app.apk',
29
+ notificationTitle: 'Application update',
30
+ fileSize: 123456,
31
+ });
32
+ } finally {
33
+ ReactNativeAppUpdate.removeDownloadListener(listenerId);
34
+ }
35
+ ```
36
+
37
+ ## API and platform limits
38
+
39
+ - `downloadAPK` downloads an Android update; `downloadASC`, `verifyASC` and
40
+ `verifyAPK` provide the signature and verification operations.
41
+ - `installAPK` requests Android installation. A completed download is not proof
42
+ of verification or installation; callers must perform those separate steps.
43
+ - `clearCache` and `clearApkCache` clean cached update artifacts.
44
+ - Download listeners return a numeric ID; remove each listener when its owner
45
+ finishes or unmounts.
46
+
47
+ APK operations on iOS are no-op stubs. This package does not implement App Store
48
+ updates. `clearApkCache` does not cancel an in-flight Android download, so callers
49
+ must coordinate cleanup with update state.
50
+
51
+ For complete parameter and event types, see
52
+ [src/ReactNativeAppUpdate.nitro.ts](src/ReactNativeAppUpdate.nitro.ts). Verification
53
+ test helpers are also exposed there; applications should keep the production
54
+ download and verification flow enabled.
55
+
56
+ ## License
57
+
58
+ MIT.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-app-update",
3
- "version": "3.0.162",
4
- "description": "react-native-app-update",
3
+ "version": "3.0.165",
4
+ "description": "Android APK download, signature verification and installation for OneKey",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
7
7
  "exports": {
@@ -50,14 +50,15 @@
50
50
  ],
51
51
  "repository": {
52
52
  "type": "git",
53
- "url": "git+https://github.com/OneKeyHQ/app-modules/react-native-app-update.git"
53
+ "url": "git+https://github.com/OneKeyHQ/app-modules.git",
54
+ "directory": "native-modules/react-native-app-update"
54
55
  },
55
56
  "author": "onekeyfe <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
56
57
  "license": "MIT",
57
58
  "bugs": {
58
- "url": "https://github.com/OneKeyHQ/app-modules/react-native-app-update/issues"
59
+ "url": "https://github.com/OneKeyHQ/app-modules/issues"
59
60
  },
60
- "homepage": "https://github.com/OneKeyHQ/app-modules/react-native-app-update#readme",
61
+ "homepage": "https://github.com/OneKeyHQ/app-modules/tree/main/native-modules/react-native-app-update#readme",
61
62
  "publishConfig": {
62
63
  "registry": "https://registry.npmjs.org/"
63
64
  },