@onekeyfe/react-native-app-update 1.1.21
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/LICENSE +21 -0
- package/README.md +36 -0
- package/ReactNativeAppUpdate.podspec +30 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +141 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +17 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeappupdate/ReactNativeAppUpdate.kt +819 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeappupdate/ReactNativeAppUpdatePackage.kt +24 -0
- package/android/src/main/res/xml/app_update_file_paths.xml +4 -0
- package/ios/ReactNativeAppUpdate.swift +41 -0
- package/lib/module/ReactNativeAppUpdate.nitro.js +4 -0
- package/lib/module/ReactNativeAppUpdate.nitro.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/ReactNativeAppUpdate.nitro.d.ts +28 -0
- package/lib/typescript/src/ReactNativeAppUpdate.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JAppUpdateDownloadParams.hpp +65 -0
- package/nitrogen/generated/android/c++/JAppUpdateFileParams.hpp +57 -0
- package/nitrogen/generated/android/c++/JDownloadEvent.hpp +65 -0
- package/nitrogen/generated/android/c++/JFunc_void_DownloadEvent.hpp +78 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeAppUpdateSpec.cpp +162 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeAppUpdateSpec.hpp +72 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/AppUpdateDownloadParams.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/AppUpdateFileParams.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/DownloadEvent.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/Func_void_DownloadEvent.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/HybridReactNativeAppUpdateSpec.kt +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/reactnativeappupdateOnLoad.kt +35 -0
- package/nitrogen/generated/android/reactnativeappupdate+autolinking.cmake +81 -0
- package/nitrogen/generated/android/reactnativeappupdate+autolinking.gradle +27 -0
- package/nitrogen/generated/android/reactnativeappupdateOnLoad.cpp +46 -0
- package/nitrogen/generated/android/reactnativeappupdateOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/ReactNativeAppUpdate+autolinking.rb +60 -0
- package/nitrogen/generated/ios/ReactNativeAppUpdate-Swift-Cxx-Bridge.cpp +57 -0
- package/nitrogen/generated/ios/ReactNativeAppUpdate-Swift-Cxx-Bridge.hpp +154 -0
- package/nitrogen/generated/ios/ReactNativeAppUpdate-Swift-Cxx-Umbrella.hpp +55 -0
- package/nitrogen/generated/ios/ReactNativeAppUpdateAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ReactNativeAppUpdateAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeAppUpdateSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeAppUpdateSpecSwift.hpp +140 -0
- package/nitrogen/generated/ios/swift/AppUpdateDownloadParams.swift +58 -0
- package/nitrogen/generated/ios/swift/AppUpdateFileParams.swift +36 -0
- package/nitrogen/generated/ios/swift/DownloadEvent.swift +58 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_DownloadEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeAppUpdateSpec.swift +63 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeAppUpdateSpec_cxx.swift +261 -0
- package/nitrogen/generated/shared/c++/AppUpdateDownloadParams.hpp +83 -0
- package/nitrogen/generated/shared/c++/AppUpdateFileParams.hpp +75 -0
- package/nitrogen/generated/shared/c++/DownloadEvent.hpp +83 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeAppUpdateSpec.cpp +28 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeAppUpdateSpec.hpp +78 -0
- package/package.json +169 -0
- package/src/ReactNativeAppUpdate.nitro.ts +30 -0
- package/src/index.tsx +8 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeAppUpdateSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `AppUpdateDownloadParams` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::reactnativeappupdate { struct AppUpdateDownloadParams; }
|
|
18
|
+
// Forward declaration of `AppUpdateFileParams` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::reactnativeappupdate { struct AppUpdateFileParams; }
|
|
20
|
+
// Forward declaration of `DownloadEvent` to properly resolve imports.
|
|
21
|
+
namespace margelo::nitro::reactnativeappupdate { struct DownloadEvent; }
|
|
22
|
+
|
|
23
|
+
#include <NitroModules/Promise.hpp>
|
|
24
|
+
#include "AppUpdateDownloadParams.hpp"
|
|
25
|
+
#include "AppUpdateFileParams.hpp"
|
|
26
|
+
#include "DownloadEvent.hpp"
|
|
27
|
+
#include <functional>
|
|
28
|
+
|
|
29
|
+
namespace margelo::nitro::reactnativeappupdate {
|
|
30
|
+
|
|
31
|
+
using namespace margelo::nitro;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* An abstract base class for `ReactNativeAppUpdate`
|
|
35
|
+
* Inherit this class to create instances of `HybridReactNativeAppUpdateSpec` in C++.
|
|
36
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
37
|
+
* @example
|
|
38
|
+
* ```cpp
|
|
39
|
+
* class HybridReactNativeAppUpdate: public HybridReactNativeAppUpdateSpec {
|
|
40
|
+
* public:
|
|
41
|
+
* HybridReactNativeAppUpdate(...): HybridObject(TAG) { ... }
|
|
42
|
+
* // ...
|
|
43
|
+
* };
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
class HybridReactNativeAppUpdateSpec: public virtual HybridObject {
|
|
47
|
+
public:
|
|
48
|
+
// Constructor
|
|
49
|
+
explicit HybridReactNativeAppUpdateSpec(): HybridObject(TAG) { }
|
|
50
|
+
|
|
51
|
+
// Destructor
|
|
52
|
+
~HybridReactNativeAppUpdateSpec() override = default;
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
// Properties
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
public:
|
|
59
|
+
// Methods
|
|
60
|
+
virtual std::shared_ptr<Promise<void>> downloadAPK(const AppUpdateDownloadParams& params) = 0;
|
|
61
|
+
virtual std::shared_ptr<Promise<void>> downloadASC(const AppUpdateFileParams& params) = 0;
|
|
62
|
+
virtual std::shared_ptr<Promise<void>> verifyASC(const AppUpdateFileParams& params) = 0;
|
|
63
|
+
virtual std::shared_ptr<Promise<void>> verifyAPK(const AppUpdateFileParams& params) = 0;
|
|
64
|
+
virtual std::shared_ptr<Promise<void>> installAPK(const AppUpdateFileParams& params) = 0;
|
|
65
|
+
virtual std::shared_ptr<Promise<void>> clearCache() = 0;
|
|
66
|
+
virtual double addDownloadListener(const std::function<void(const DownloadEvent& /* event */)>& callback) = 0;
|
|
67
|
+
virtual void removeDownloadListener(double id) = 0;
|
|
68
|
+
|
|
69
|
+
protected:
|
|
70
|
+
// Hybrid Setup
|
|
71
|
+
void loadHybridMethods() override;
|
|
72
|
+
|
|
73
|
+
protected:
|
|
74
|
+
// Tag for logging
|
|
75
|
+
static constexpr auto TAG = "ReactNativeAppUpdate";
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
} // namespace margelo::nitro::reactnativeappupdate
|
package/package.json
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@onekeyfe/react-native-app-update",
|
|
3
|
+
"version": "1.1.21",
|
|
4
|
+
"description": "react-native-app-update",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"source": "./src/index.tsx",
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"android",
|
|
19
|
+
"ios",
|
|
20
|
+
"cpp",
|
|
21
|
+
"nitrogen",
|
|
22
|
+
"nitro.json",
|
|
23
|
+
"*.podspec",
|
|
24
|
+
"react-native.config.js",
|
|
25
|
+
"!ios/build",
|
|
26
|
+
"!android/build",
|
|
27
|
+
"!android/gradle",
|
|
28
|
+
"!android/gradlew",
|
|
29
|
+
"!android/gradlew.bat",
|
|
30
|
+
"!android/local.properties",
|
|
31
|
+
"!**/__tests__",
|
|
32
|
+
"!**/__fixtures__",
|
|
33
|
+
"!**/__mocks__",
|
|
34
|
+
"!**/.*"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
38
|
+
"prepare": "bob build",
|
|
39
|
+
"nitrogen": "nitrogen",
|
|
40
|
+
"typecheck": "tsc",
|
|
41
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
42
|
+
"test": "jest",
|
|
43
|
+
"release": "yarn prepare && npm whoami && npm publish --access public"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"react-native",
|
|
47
|
+
"ios",
|
|
48
|
+
"android"
|
|
49
|
+
],
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/OneKeyHQ/app-modules/react-native-app-update.git"
|
|
53
|
+
},
|
|
54
|
+
"author": "onekeyfe <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
|
|
55
|
+
"license": "MIT",
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://github.com/OneKeyHQ/app-modules/react-native-app-update/issues"
|
|
58
|
+
},
|
|
59
|
+
"homepage": "https://github.com/OneKeyHQ/app-modules/react-native-app-update#readme",
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"registry": "https://registry.npmjs.org/"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
65
|
+
"@eslint/compat": "^1.3.2",
|
|
66
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
67
|
+
"@eslint/js": "^9.35.0",
|
|
68
|
+
"@react-native/babel-preset": "0.83.0",
|
|
69
|
+
"@react-native/eslint-config": "0.83.0",
|
|
70
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
71
|
+
"@types/jest": "^29.5.14",
|
|
72
|
+
"@types/react": "^19.2.0",
|
|
73
|
+
"commitlint": "^19.8.1",
|
|
74
|
+
"del-cli": "^6.0.0",
|
|
75
|
+
"eslint": "^9.35.0",
|
|
76
|
+
"eslint-config-prettier": "^10.1.8",
|
|
77
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
78
|
+
"jest": "^29.7.0",
|
|
79
|
+
"lefthook": "^2.0.3",
|
|
80
|
+
"nitrogen": "0.31.10",
|
|
81
|
+
"prettier": "^2.8.8",
|
|
82
|
+
"react": "19.2.0",
|
|
83
|
+
"react-native": "0.83.0",
|
|
84
|
+
"react-native-builder-bob": "^0.40.13",
|
|
85
|
+
"react-native-nitro-modules": "0.33.2",
|
|
86
|
+
"release-it": "^19.0.4",
|
|
87
|
+
"turbo": "^2.5.6",
|
|
88
|
+
"typescript": "^5.9.2"
|
|
89
|
+
},
|
|
90
|
+
"peerDependencies": {
|
|
91
|
+
"react": "*",
|
|
92
|
+
"react-native": "*",
|
|
93
|
+
"react-native-nitro-modules": "0.33.2"
|
|
94
|
+
},
|
|
95
|
+
"react-native-builder-bob": {
|
|
96
|
+
"source": "src",
|
|
97
|
+
"output": "lib",
|
|
98
|
+
"targets": [
|
|
99
|
+
[
|
|
100
|
+
"custom",
|
|
101
|
+
{
|
|
102
|
+
"script": "nitrogen",
|
|
103
|
+
"clean": "nitrogen/"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
"module",
|
|
108
|
+
{
|
|
109
|
+
"esm": true
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
[
|
|
113
|
+
"typescript",
|
|
114
|
+
{
|
|
115
|
+
"project": "tsconfig.build.json"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
"prettier": {
|
|
121
|
+
"quoteProps": "consistent",
|
|
122
|
+
"singleQuote": true,
|
|
123
|
+
"tabWidth": 2,
|
|
124
|
+
"trailingComma": "es5",
|
|
125
|
+
"useTabs": false
|
|
126
|
+
},
|
|
127
|
+
"jest": {
|
|
128
|
+
"preset": "react-native",
|
|
129
|
+
"modulePathIgnorePatterns": [
|
|
130
|
+
"<rootDir>/example/node_modules",
|
|
131
|
+
"<rootDir>/lib/"
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
"commitlint": {
|
|
135
|
+
"extends": [
|
|
136
|
+
"@commitlint/config-conventional"
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"release-it": {
|
|
140
|
+
"git": {
|
|
141
|
+
"commitMessage": "chore: release ${version}",
|
|
142
|
+
"tagName": "v${version}"
|
|
143
|
+
},
|
|
144
|
+
"npm": {
|
|
145
|
+
"publish": true
|
|
146
|
+
},
|
|
147
|
+
"github": {
|
|
148
|
+
"release": true
|
|
149
|
+
},
|
|
150
|
+
"plugins": {
|
|
151
|
+
"@release-it/conventional-changelog": {
|
|
152
|
+
"preset": {
|
|
153
|
+
"name": "angular"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"create-react-native-library": {
|
|
159
|
+
"type": "nitro-module",
|
|
160
|
+
"languages": "kotlin-swift",
|
|
161
|
+
"tools": [
|
|
162
|
+
"eslint",
|
|
163
|
+
"jest",
|
|
164
|
+
"lefthook",
|
|
165
|
+
"release-it"
|
|
166
|
+
],
|
|
167
|
+
"version": "0.56.0"
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules';
|
|
2
|
+
|
|
3
|
+
export interface AppUpdateDownloadParams {
|
|
4
|
+
downloadUrl: string;
|
|
5
|
+
notificationTitle: string;
|
|
6
|
+
fileSize: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface AppUpdateFileParams {
|
|
10
|
+
downloadUrl: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface DownloadEvent {
|
|
14
|
+
type: string;
|
|
15
|
+
progress: number;
|
|
16
|
+
message: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ReactNativeAppUpdate
|
|
20
|
+
extends HybridObject<{ ios: 'swift'; android: 'kotlin' }> {
|
|
21
|
+
downloadAPK(params: AppUpdateDownloadParams): Promise<void>;
|
|
22
|
+
downloadASC(params: AppUpdateFileParams): Promise<void>;
|
|
23
|
+
verifyASC(params: AppUpdateFileParams): Promise<void>;
|
|
24
|
+
verifyAPK(params: AppUpdateFileParams): Promise<void>;
|
|
25
|
+
installAPK(params: AppUpdateFileParams): Promise<void>;
|
|
26
|
+
clearCache(): Promise<void>;
|
|
27
|
+
|
|
28
|
+
addDownloadListener(callback: (event: DownloadEvent) => void): number;
|
|
29
|
+
removeDownloadListener(id: number): void;
|
|
30
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
2
|
+
import type { ReactNativeAppUpdate as ReactNativeAppUpdateType } from './ReactNativeAppUpdate.nitro';
|
|
3
|
+
|
|
4
|
+
const ReactNativeAppUpdateHybridObject =
|
|
5
|
+
NitroModules.createHybridObject<ReactNativeAppUpdateType>('ReactNativeAppUpdate');
|
|
6
|
+
|
|
7
|
+
export const ReactNativeAppUpdate = ReactNativeAppUpdateHybridObject;
|
|
8
|
+
export type * from './ReactNativeAppUpdate.nitro';
|