react-native-ota-hot-update 1.1.1 → 2.0.0
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 +1 -2
- package/README.md +20 -8
- package/android/build.gradle +32 -4
- package/android/generated/java/com/otahotupdate/NativeOtaHotUpdateSpec.java +54 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNOtaHotUpdateSpec-generated.cpp +56 -0
- package/android/generated/jni/RNOtaHotUpdateSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/ComponentDescriptors.h +24 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/EventEmitters.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/EventEmitters.h +17 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/Props.cpp +19 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/Props.h +18 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/RNOtaHotUpdateSpecJSI-generated.cpp +56 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/RNOtaHotUpdateSpecJSI.h +103 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/ShadowNodes.cpp +17 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/ShadowNodes.h +23 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/States.h +19 -0
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/otahotupdate/OtaHotUpdate.kt +57 -0
- package/android/src/main/java/com/otahotupdate/OtaHotUpdateModule.kt +142 -0
- package/android/src/newarch/OtaHotUpdateSpec.kt +7 -0
- package/android/src/oldarch/OtaHotUpdateSpec.kt +15 -0
- package/ios/OtaHotUpdate.h +13 -0
- package/ios/{RNhotupdate.m → OtaHotUpdate.mm} +50 -33
- package/ios/generated/RNOtaHotUpdateSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/RNOtaHotUpdateSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/RNOtaHotUpdateSpec/EventEmitters.cpp +16 -0
- package/ios/generated/RNOtaHotUpdateSpec/EventEmitters.h +17 -0
- package/ios/generated/RNOtaHotUpdateSpec/Props.cpp +19 -0
- package/ios/generated/RNOtaHotUpdateSpec/Props.h +18 -0
- package/ios/generated/RNOtaHotUpdateSpec/RCTComponentViewHelpers.h +18 -0
- package/ios/generated/RNOtaHotUpdateSpec/RNOtaHotUpdateSpec-generated.mm +67 -0
- package/ios/generated/RNOtaHotUpdateSpec/RNOtaHotUpdateSpec.h +72 -0
- package/ios/generated/RNOtaHotUpdateSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/RNOtaHotUpdateSpec/ShadowNodes.h +23 -0
- package/ios/generated/RNOtaHotUpdateSpec/States.cpp +16 -0
- package/ios/generated/RNOtaHotUpdateSpec/States.h +19 -0
- package/ios/generated/RNOtaHotUpdateSpecJSI-generated.cpp +56 -0
- package/ios/generated/RNOtaHotUpdateSpecJSI.h +103 -0
- package/lib/commonjs/NativeOtaHotUpdate.js +9 -0
- package/lib/commonjs/NativeOtaHotUpdate.js.map +1 -0
- package/lib/commonjs/download.d.js +2 -0
- package/lib/commonjs/download.d.js.map +1 -0
- package/lib/commonjs/index.js +113 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/NativeOtaHotUpdate.js +5 -0
- package/lib/module/NativeOtaHotUpdate.js.map +1 -0
- package/lib/module/download.d.js +2 -0
- package/lib/module/download.d.js.map +1 -0
- package/lib/module/index.js +109 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeOtaHotUpdate.d.ts +11 -0
- package/lib/typescript/commonjs/src/NativeOtaHotUpdate.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +25 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeOtaHotUpdate.d.ts +11 -0
- package/lib/typescript/module/src/NativeOtaHotUpdate.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +25 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +184 -12
- package/{rn-hotupdate.podspec → react-native-ota-hot-update.podspec} +3 -3
- package/react-native.config.js +10 -6
- package/src/NativeOtaHotUpdate.ts +12 -0
- package/src/download.d.ts +759 -689
- package/src/index.tsx +67 -40
- package/android/src/main/java/com/rnhotupdate/HotUpdateModule.java +0 -161
- package/android/src/main/java/com/rnhotupdate/OtaHotUpdate.java +0 -45
- package/ios/RNhotupdate.h +0 -12
- package/ios/RNhotupdate.xcodeproj/project.pbxproj +0 -281
- package/ios/RNhotupdate.xcworkspace/contents.xcworkspacedata +0 -7
- /package/android/src/main/java/com/{rnhotupdate → otahotupdate}/SharedPrefs.kt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeOtaHotUpdate.d.ts","sourceRoot":"","sources":["../../../../src/NativeOtaHotUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,OAAO,IAAI,IAAI,CAAC;IAChB,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACtD;;AAED,wBAAsE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DownloadManager } from './download';
|
|
2
|
+
export interface UpdateOption {
|
|
3
|
+
headers?: object;
|
|
4
|
+
progress?(received: string, total: string): void;
|
|
5
|
+
updateSuccess?(): void;
|
|
6
|
+
updateFail?(message?: string): void;
|
|
7
|
+
restartAfterInstall?: boolean;
|
|
8
|
+
extensionBundle?: string;
|
|
9
|
+
}
|
|
10
|
+
declare function setupBundlePath(path: string, extension?: string): Promise<boolean>;
|
|
11
|
+
declare function getVersionAsNumber(): Promise<number>;
|
|
12
|
+
declare function setCurrentVersion(version: number): Promise<boolean>;
|
|
13
|
+
declare function resetApp(): Promise<void>;
|
|
14
|
+
declare function removeBundle(restartAfterRemoved?: boolean): void;
|
|
15
|
+
declare function downloadBundleUri(downloadManager: DownloadManager, uri: string, version: number, option?: UpdateOption): Promise<void>;
|
|
16
|
+
declare const _default: {
|
|
17
|
+
setupBundlePath: typeof setupBundlePath;
|
|
18
|
+
removeUpdate: typeof removeBundle;
|
|
19
|
+
downloadBundleUri: typeof downloadBundleUri;
|
|
20
|
+
resetApp: typeof resetApp;
|
|
21
|
+
getCurrentVersion: typeof getVersionAsNumber;
|
|
22
|
+
setCurrentVersion: typeof setCurrentVersion;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAWlD,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD,aAAa,CAAC,IAAI,IAAI,CAAC;IACvB,UAAU,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAoCD,iBAAS,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE3E;AAOD,iBAAe,kBAAkB,oBAGhC;AACD,iBAAS,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE5D;AACD,iBAAe,QAAQ,kBAEtB;AACD,iBAAS,YAAY,CAAC,mBAAmB,CAAC,EAAE,OAAO,QAWlD;AAKD,iBAAe,iBAAiB,CAC9B,eAAe,EAAE,eAAe,EAChC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,YAAY,iBA8CtB;;;;;;;;;AAED,wBAOE"}
|
package/package.json
CHANGED
|
@@ -1,26 +1,198 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-ota-hot-update",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Hot update for react native",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/commonjs/index.js",
|
|
7
|
+
"module": "./lib/module/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
12
|
+
"default": "./lib/module/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
16
|
+
"default": "./lib/commonjs/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"src",
|
|
22
|
+
"lib",
|
|
23
|
+
"android",
|
|
24
|
+
"ios",
|
|
25
|
+
"cpp",
|
|
26
|
+
"*.podspec",
|
|
27
|
+
"react-native.config.js",
|
|
28
|
+
"!ios/build",
|
|
29
|
+
"!android/build",
|
|
30
|
+
"!android/gradle",
|
|
31
|
+
"!android/gradlew",
|
|
32
|
+
"!android/gradlew.bat",
|
|
33
|
+
"!android/local.properties",
|
|
34
|
+
"!**/__tests__",
|
|
35
|
+
"!**/__fixtures__",
|
|
36
|
+
"!**/__mocks__",
|
|
37
|
+
"!**/.*"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"example": "yarn workspace react-native-ota-hot-update-example",
|
|
41
|
+
"test": "jest",
|
|
42
|
+
"typecheck": "tsc",
|
|
43
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
44
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
45
|
+
"prepare": "bob build",
|
|
46
|
+
"release": "release-it"
|
|
47
|
+
},
|
|
48
|
+
"keywords": [
|
|
49
|
+
"react-native",
|
|
50
|
+
"ios",
|
|
51
|
+
"android"
|
|
52
|
+
],
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/vantuan88291/react-native-ota-hot-update.git"
|
|
56
|
+
},
|
|
7
57
|
"author": "vantuan88291 <vantuan88291@gmail.com> (https://github.com/vantuan88291)",
|
|
8
58
|
"license": "MIT",
|
|
9
59
|
"bugs": {
|
|
10
60
|
"url": "https://github.com/vantuan88291/react-native-ota-hot-update/issues"
|
|
11
61
|
},
|
|
12
|
-
"homepage": "https://github.com/vantuan88291/react-native-ota-hot-update",
|
|
62
|
+
"homepage": "https://github.com/vantuan88291/react-native-ota-hot-update#readme",
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"registry": "https://registry.npmjs.org/"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
68
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
69
|
+
"@react-native-community/cli": "15.0.1",
|
|
70
|
+
"@react-native/eslint-config": "^0.73.1",
|
|
71
|
+
"@release-it/conventional-changelog": "^9.0.2",
|
|
72
|
+
"@types/jest": "^29.5.5",
|
|
73
|
+
"@types/react": "^18.2.44",
|
|
74
|
+
"commitlint": "^17.0.2",
|
|
75
|
+
"del-cli": "^5.1.0",
|
|
76
|
+
"eslint": "^8.51.0",
|
|
77
|
+
"eslint-config-prettier": "^9.0.0",
|
|
78
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
79
|
+
"jest": "^29.7.0",
|
|
80
|
+
"prettier": "^3.0.3",
|
|
81
|
+
"react": "18.3.1",
|
|
82
|
+
"react-native": "0.76.3",
|
|
83
|
+
"react-native-builder-bob": "^0.33.1",
|
|
84
|
+
"release-it": "^17.10.0",
|
|
85
|
+
"turbo": "^1.10.7",
|
|
86
|
+
"typescript": "^5.2.2"
|
|
87
|
+
},
|
|
88
|
+
"resolutions": {
|
|
89
|
+
"@types/react": "^18.2.44"
|
|
90
|
+
},
|
|
13
91
|
"peerDependencies": {
|
|
14
|
-
"react
|
|
92
|
+
"react": "*",
|
|
93
|
+
"react-native": "*"
|
|
15
94
|
},
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
95
|
+
"workspaces": [
|
|
96
|
+
"example"
|
|
97
|
+
],
|
|
98
|
+
"packageManager": "yarn@3.6.1",
|
|
99
|
+
"jest": {
|
|
100
|
+
"preset": "react-native",
|
|
101
|
+
"modulePathIgnorePatterns": [
|
|
102
|
+
"<rootDir>/example/node_modules",
|
|
103
|
+
"<rootDir>/lib/"
|
|
104
|
+
]
|
|
20
105
|
},
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
106
|
+
"release-it": {
|
|
107
|
+
"git": {
|
|
108
|
+
"commitMessage": "chore: release ${version}",
|
|
109
|
+
"tagName": "v${version}"
|
|
110
|
+
},
|
|
111
|
+
"npm": {
|
|
112
|
+
"publish": true
|
|
113
|
+
},
|
|
114
|
+
"github": {
|
|
115
|
+
"release": true
|
|
116
|
+
},
|
|
117
|
+
"plugins": {
|
|
118
|
+
"@release-it/conventional-changelog": {
|
|
119
|
+
"preset": "angular"
|
|
120
|
+
}
|
|
24
121
|
}
|
|
122
|
+
},
|
|
123
|
+
"eslintConfig": {
|
|
124
|
+
"root": true,
|
|
125
|
+
"extends": [
|
|
126
|
+
"@react-native",
|
|
127
|
+
"prettier"
|
|
128
|
+
],
|
|
129
|
+
"rules": {
|
|
130
|
+
"react/react-in-jsx-scope": "off",
|
|
131
|
+
"prettier/prettier": [
|
|
132
|
+
"error",
|
|
133
|
+
{
|
|
134
|
+
"quoteProps": "consistent",
|
|
135
|
+
"singleQuote": true,
|
|
136
|
+
"tabWidth": 2,
|
|
137
|
+
"trailingComma": "es5",
|
|
138
|
+
"useTabs": false
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
"eslintIgnore": [
|
|
144
|
+
"node_modules/",
|
|
145
|
+
"lib/"
|
|
146
|
+
],
|
|
147
|
+
"prettier": {
|
|
148
|
+
"quoteProps": "consistent",
|
|
149
|
+
"singleQuote": true,
|
|
150
|
+
"tabWidth": 2,
|
|
151
|
+
"trailingComma": "es5",
|
|
152
|
+
"useTabs": false
|
|
153
|
+
},
|
|
154
|
+
"react-native-builder-bob": {
|
|
155
|
+
"source": "src",
|
|
156
|
+
"output": "lib",
|
|
157
|
+
"targets": [
|
|
158
|
+
"codegen",
|
|
159
|
+
[
|
|
160
|
+
"commonjs",
|
|
161
|
+
{
|
|
162
|
+
"esm": true
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
[
|
|
166
|
+
"module",
|
|
167
|
+
{
|
|
168
|
+
"esm": true
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
[
|
|
172
|
+
"typescript",
|
|
173
|
+
{
|
|
174
|
+
"project": "tsconfig.build.json",
|
|
175
|
+
"esm": true
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
"codegenConfig": {
|
|
181
|
+
"name": "RNOtaHotUpdateSpec",
|
|
182
|
+
"type": "all",
|
|
183
|
+
"jsSrcsDir": "src",
|
|
184
|
+
"outputDir": {
|
|
185
|
+
"ios": "ios/generated",
|
|
186
|
+
"android": "android/generated"
|
|
187
|
+
},
|
|
188
|
+
"android": {
|
|
189
|
+
"javaPackageName": "com.otahotupdate"
|
|
190
|
+
},
|
|
191
|
+
"includesGeneratedCode": true
|
|
192
|
+
},
|
|
193
|
+
"create-react-native-library": {
|
|
194
|
+
"type": "module-mixed",
|
|
195
|
+
"languages": "kotlin-objc",
|
|
196
|
+
"version": "0.44.2"
|
|
25
197
|
}
|
|
26
198
|
}
|
|
@@ -4,17 +4,17 @@ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
|
4
4
|
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
5
|
|
|
6
6
|
Pod::Spec.new do |s|
|
|
7
|
-
s.name = "
|
|
7
|
+
s.name = "react-native-ota-hot-update"
|
|
8
8
|
s.version = package["version"]
|
|
9
9
|
s.summary = package["description"]
|
|
10
10
|
s.homepage = package["homepage"]
|
|
11
11
|
s.license = package["license"]
|
|
12
12
|
s.authors = package["author"]
|
|
13
13
|
|
|
14
|
-
s.platforms = { :ios =>
|
|
14
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
15
15
|
s.source = { :git => "https://github.com/vantuan88291/react-native-ota-hot-update.git", :tag => "#{s.version}" }
|
|
16
16
|
|
|
17
|
-
s.source_files = "ios/**/*.{h,m,mm}"
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp}"
|
|
18
18
|
s.dependency 'SSZipArchive', '~> 2.4.3'
|
|
19
19
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
20
20
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
package/react-native.config.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @type {import('@react-native-community/cli-types').UserDependencyConfig}
|
|
3
|
+
*/
|
|
1
4
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
dependency: {
|
|
6
|
+
platforms: {
|
|
7
|
+
android: {
|
|
8
|
+
cmakeListsPath: 'generated/jni/CMakeLists.txt',
|
|
9
|
+
packageInstance: 'new OtaHotUpdate(getApplicationContext())',
|
|
10
|
+
},
|
|
8
11
|
},
|
|
12
|
+
},
|
|
9
13
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
setupBundlePath(path: string, extension: string): Promise<boolean>;
|
|
6
|
+
deleteBundle(i: number): Promise<boolean>;
|
|
7
|
+
restart(): void;
|
|
8
|
+
getCurrentVersion(a: number): Promise<string>;
|
|
9
|
+
setCurrentVersion(version: string): Promise<boolean>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('OtaHotUpdate');
|