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
package/LICENSE
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
4
|
-
|
|
3
|
+
Copyright (c) 2024 vantuan88291
|
|
5
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
5
|
of this software and associated documentation files (the "Software"), to deal
|
|
7
6
|
in the Software without restriction, including without limitation the rights
|
package/README.md
CHANGED
|
@@ -10,12 +10,16 @@ iOS GIF | Android GIF
|
|
|
10
10
|
[](https://img.shields.io/npm/dw/react-native-ota-hot-update)
|
|
11
11
|
[](https://img.shields.io/npm/v/react-native-ota-hot-update?color=red)
|
|
12
12
|
|
|
13
|
+
## New architecture supported
|
|
14
|
+
|
|
15
|
+
New architecture backward compatibility supported from version 2, it also supported old architecture, for source code of old architecture please refer to branch `oldArch`
|
|
16
|
+
|
|
13
17
|
## Installation
|
|
14
18
|
|
|
15
19
|
if you don't want to manage the download progress, need to install blob util together:
|
|
16
20
|
|
|
17
21
|
```bash
|
|
18
|
-
yarn add react-native-ota-hot-update && react-native-blob-util
|
|
22
|
+
yarn add react-native-ota-hot-update && yarn add react-native-blob-util
|
|
19
23
|
```
|
|
20
24
|
Auto linking already, need pod install for ios:
|
|
21
25
|
```bash
|
|
@@ -26,13 +30,13 @@ cd ios && pod install
|
|
|
26
30
|
Open `AppDelegate.m` and add this:
|
|
27
31
|
|
|
28
32
|
```bash
|
|
29
|
-
#import "
|
|
33
|
+
#import "OtaHotUpdate.h"
|
|
30
34
|
...
|
|
31
35
|
{
|
|
32
36
|
#if DEBUG
|
|
33
37
|
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
|
|
34
38
|
#else
|
|
35
|
-
return [
|
|
39
|
+
return [OtaHotUpdate getBundle]; ## add this line
|
|
36
40
|
#endif
|
|
37
41
|
}
|
|
38
42
|
```
|
|
@@ -50,7 +54,7 @@ AppDelegate.mm:
|
|
|
50
54
|
[application endBackgroundTask:self.taskIdentifier];
|
|
51
55
|
self.taskIdentifier = UIBackgroundTaskInvalid;
|
|
52
56
|
}
|
|
53
|
-
|
|
57
|
+
|
|
54
58
|
__weak AppDelegate *weakSelf = self;
|
|
55
59
|
self.taskIdentifier = [application beginBackgroundTaskWithName:nil expirationHandler:^{
|
|
56
60
|
if (weakSelf) {
|
|
@@ -65,13 +69,21 @@ AppDelegate.mm:
|
|
|
65
69
|
### Android
|
|
66
70
|
Open `MainApplication.java/kt` and add these codes bellow:
|
|
67
71
|
```bash
|
|
68
|
-
import com.
|
|
72
|
+
import com.otahotupdate.OtaHotUpdate
|
|
69
73
|
...
|
|
70
74
|
override fun getJSBundleFile(): String? {
|
|
71
|
-
return OtaHotUpdate.
|
|
75
|
+
return OtaHotUpdate.bundleJS
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
```
|
|
79
|
+
Open `AndroidManifest.xml` :
|
|
80
|
+
|
|
81
|
+
`<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />`
|
|
82
|
+
|
|
83
|
+
`<application
|
|
84
|
+
...
|
|
85
|
+
android:requestLegacyExternalStorage="true"
|
|
86
|
+
`
|
|
75
87
|
|
|
76
88
|
## That's it, can check the example code
|
|
77
89
|
|
|
@@ -116,8 +128,8 @@ After you have done everything related to version manager, you just handle the w
|
|
|
116
128
|
```bash
|
|
117
129
|
import hotUpdate from 'react-native-ota-hot-update';
|
|
118
130
|
import ReactNativeBlobUtil from 'react-native-blob-util';
|
|
119
|
-
|
|
120
|
-
|
|
131
|
+
|
|
132
|
+
|
|
121
133
|
hotUpdate.downloadBundleUri(ReactNativeBlobUtil, url, version, {
|
|
122
134
|
updateSuccess: () => {
|
|
123
135
|
console.log('update success!');
|
package/android/build.gradle
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
buildscript {
|
|
2
2
|
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
-
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["
|
|
3
|
+
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["OtaHotUpdate_kotlinVersion"]
|
|
4
4
|
|
|
5
5
|
repositories {
|
|
6
6
|
google()
|
|
@@ -31,11 +31,11 @@ if (isNewArchitectureEnabled()) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
def getExtOrDefault(name) {
|
|
34
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["
|
|
34
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["OtaHotUpdate_" + name]
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
def getExtOrIntegerDefault(name) {
|
|
38
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["
|
|
38
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["OtaHotUpdate_" + name]).toInteger()
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
def supportsNamespace() {
|
|
@@ -49,7 +49,7 @@ def supportsNamespace() {
|
|
|
49
49
|
|
|
50
50
|
android {
|
|
51
51
|
if (supportsNamespace()) {
|
|
52
|
-
namespace "com.
|
|
52
|
+
namespace "com.otahotupdate"
|
|
53
53
|
|
|
54
54
|
sourceSets {
|
|
55
55
|
main {
|
|
@@ -63,9 +63,14 @@ android {
|
|
|
63
63
|
defaultConfig {
|
|
64
64
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
65
65
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
66
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
66
67
|
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
buildFeatures {
|
|
71
|
+
buildConfig true
|
|
72
|
+
}
|
|
73
|
+
|
|
69
74
|
buildTypes {
|
|
70
75
|
release {
|
|
71
76
|
minifyEnabled false
|
|
@@ -80,6 +85,21 @@ android {
|
|
|
80
85
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
81
86
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
82
87
|
}
|
|
88
|
+
|
|
89
|
+
sourceSets {
|
|
90
|
+
main {
|
|
91
|
+
if (isNewArchitectureEnabled()) {
|
|
92
|
+
java.srcDirs += [
|
|
93
|
+
"src/newarch",
|
|
94
|
+
// Codegen specs
|
|
95
|
+
"generated/java",
|
|
96
|
+
"generated/jni"
|
|
97
|
+
]
|
|
98
|
+
} else {
|
|
99
|
+
java.srcDirs += ["src/oldarch"]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
83
103
|
}
|
|
84
104
|
|
|
85
105
|
repositories {
|
|
@@ -95,5 +115,13 @@ dependencies {
|
|
|
95
115
|
//noinspection GradleDynamicVersion
|
|
96
116
|
implementation "com.facebook.react:react-native:+"
|
|
97
117
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
118
|
+
implementation 'com.jakewharton:process-phoenix:3.0.0'
|
|
98
119
|
}
|
|
99
120
|
|
|
121
|
+
if (isNewArchitectureEnabled()) {
|
|
122
|
+
react {
|
|
123
|
+
jsRootDir = file("../src/")
|
|
124
|
+
libraryName = "OtaHotUpdate"
|
|
125
|
+
codegenJavaPackageName = "com.otahotupdate"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
+
*
|
|
10
|
+
* @nolint
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
package com.otahotupdate;
|
|
14
|
+
|
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
+
import com.facebook.react.bridge.Promise;
|
|
17
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
18
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
19
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
20
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
21
|
+
import javax.annotation.Nonnull;
|
|
22
|
+
|
|
23
|
+
public abstract class NativeOtaHotUpdateSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
24
|
+
public static final String NAME = "OtaHotUpdate";
|
|
25
|
+
|
|
26
|
+
public NativeOtaHotUpdateSpec(ReactApplicationContext reactContext) {
|
|
27
|
+
super(reactContext);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Override
|
|
31
|
+
public @Nonnull String getName() {
|
|
32
|
+
return NAME;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@ReactMethod
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
public abstract void setupBundlePath(String path, String extension, Promise promise);
|
|
38
|
+
|
|
39
|
+
@ReactMethod
|
|
40
|
+
@DoNotStrip
|
|
41
|
+
public abstract void deleteBundle(double i, Promise promise);
|
|
42
|
+
|
|
43
|
+
@ReactMethod
|
|
44
|
+
@DoNotStrip
|
|
45
|
+
public abstract void restart();
|
|
46
|
+
|
|
47
|
+
@ReactMethod
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
public abstract void getCurrentVersion(double a, Promise promise);
|
|
50
|
+
|
|
51
|
+
@ReactMethod
|
|
52
|
+
@DoNotStrip
|
|
53
|
+
public abstract void setCurrentVersion(String version, Promise promise);
|
|
54
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
cmake_minimum_required(VERSION 3.13)
|
|
7
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
+
|
|
9
|
+
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNOtaHotUpdateSpec/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_RNOtaHotUpdateSpec
|
|
13
|
+
OBJECT
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_RNOtaHotUpdateSpec PUBLIC . react/renderer/components/RNOtaHotUpdateSpec)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_RNOtaHotUpdateSpec
|
|
21
|
+
fbjni
|
|
22
|
+
jsi
|
|
23
|
+
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
+
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
+
reactnative
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
target_compile_options(
|
|
29
|
+
react_codegen_RNOtaHotUpdateSpec
|
|
30
|
+
PRIVATE
|
|
31
|
+
-DLOG_TAG=\"ReactNative\"
|
|
32
|
+
-fexceptions
|
|
33
|
+
-frtti
|
|
34
|
+
-std=c++20
|
|
35
|
+
-Wall
|
|
36
|
+
)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "RNOtaHotUpdateSpec.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
static facebook::jsi::Value __hostFunction_NativeOtaHotUpdateSpecJSI_setupBundlePath(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
16
|
+
static jmethodID cachedMethodId = nullptr;
|
|
17
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "setupBundlePath", "(Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static facebook::jsi::Value __hostFunction_NativeOtaHotUpdateSpecJSI_deleteBundle(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
21
|
+
static jmethodID cachedMethodId = nullptr;
|
|
22
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "deleteBundle", "(DLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static facebook::jsi::Value __hostFunction_NativeOtaHotUpdateSpecJSI_restart(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
26
|
+
static jmethodID cachedMethodId = nullptr;
|
|
27
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "restart", "()V", args, count, cachedMethodId);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static facebook::jsi::Value __hostFunction_NativeOtaHotUpdateSpecJSI_getCurrentVersion(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
31
|
+
static jmethodID cachedMethodId = nullptr;
|
|
32
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "getCurrentVersion", "(DLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static facebook::jsi::Value __hostFunction_NativeOtaHotUpdateSpecJSI_setCurrentVersion(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
36
|
+
static jmethodID cachedMethodId = nullptr;
|
|
37
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "setCurrentVersion", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
NativeOtaHotUpdateSpecJSI::NativeOtaHotUpdateSpecJSI(const JavaTurboModule::InitParams ¶ms)
|
|
41
|
+
: JavaTurboModule(params) {
|
|
42
|
+
methodMap_["setupBundlePath"] = MethodMetadata {2, __hostFunction_NativeOtaHotUpdateSpecJSI_setupBundlePath};
|
|
43
|
+
methodMap_["deleteBundle"] = MethodMetadata {1, __hostFunction_NativeOtaHotUpdateSpecJSI_deleteBundle};
|
|
44
|
+
methodMap_["restart"] = MethodMetadata {0, __hostFunction_NativeOtaHotUpdateSpecJSI_restart};
|
|
45
|
+
methodMap_["getCurrentVersion"] = MethodMetadata {1, __hostFunction_NativeOtaHotUpdateSpecJSI_getCurrentVersion};
|
|
46
|
+
methodMap_["setCurrentVersion"] = MethodMetadata {1, __hostFunction_NativeOtaHotUpdateSpecJSI_setCurrentVersion};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
std::shared_ptr<TurboModule> RNOtaHotUpdateSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
50
|
+
if (moduleName == "OtaHotUpdate") {
|
|
51
|
+
return std::make_shared<NativeOtaHotUpdateSpecJSI>(params);
|
|
52
|
+
}
|
|
53
|
+
return nullptr;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <ReactCommon/JavaTurboModule.h>
|
|
14
|
+
#include <ReactCommon/TurboModule.h>
|
|
15
|
+
#include <jsi/jsi.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* JNI C++ class for module 'NativeOtaHotUpdate'
|
|
21
|
+
*/
|
|
22
|
+
class JSI_EXPORT NativeOtaHotUpdateSpecJSI : public JavaTurboModule {
|
|
23
|
+
public:
|
|
24
|
+
NativeOtaHotUpdateSpecJSI(const JavaTurboModule::InitParams ¶ms);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
JSI_EXPORT
|
|
29
|
+
std::shared_ptr<TurboModule> RNOtaHotUpdateSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
30
|
+
|
|
31
|
+
} // namespace facebook::react
|
package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/ComponentDescriptors.cpp
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "ComponentDescriptors.h"
|
|
12
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
13
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
void RNOtaHotUpdateSpec_registerComponentDescriptorsFromCodegen(
|
|
18
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace facebook::react
|
package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/ComponentDescriptors.h
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include "ShadowNodes.h"
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
void RNOtaHotUpdateSpec_registerComponentDescriptorsFromCodegen(
|
|
22
|
+
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
23
|
+
|
|
24
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "EventEmitters.h"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
namespace facebook::react {
|
|
15
|
+
|
|
16
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "Props.h"
|
|
12
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
13
|
+
#include <react/renderer/core/propsConversions.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
namespace facebook::react {
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "RNOtaHotUpdateSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
static jsi::Value __hostFunction_NativeOtaHotUpdateCxxSpecJSI_setupBundlePath(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
+
return static_cast<NativeOtaHotUpdateCxxSpecJSI *>(&turboModule)->setupBundlePath(
|
|
16
|
+
rt,
|
|
17
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
|
18
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt)
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
static jsi::Value __hostFunction_NativeOtaHotUpdateCxxSpecJSI_deleteBundle(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
22
|
+
return static_cast<NativeOtaHotUpdateCxxSpecJSI *>(&turboModule)->deleteBundle(
|
|
23
|
+
rt,
|
|
24
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
static jsi::Value __hostFunction_NativeOtaHotUpdateCxxSpecJSI_restart(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
28
|
+
static_cast<NativeOtaHotUpdateCxxSpecJSI *>(&turboModule)->restart(
|
|
29
|
+
rt
|
|
30
|
+
);
|
|
31
|
+
return jsi::Value::undefined();
|
|
32
|
+
}
|
|
33
|
+
static jsi::Value __hostFunction_NativeOtaHotUpdateCxxSpecJSI_getCurrentVersion(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
34
|
+
return static_cast<NativeOtaHotUpdateCxxSpecJSI *>(&turboModule)->getCurrentVersion(
|
|
35
|
+
rt,
|
|
36
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
static jsi::Value __hostFunction_NativeOtaHotUpdateCxxSpecJSI_setCurrentVersion(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
40
|
+
return static_cast<NativeOtaHotUpdateCxxSpecJSI *>(&turboModule)->setCurrentVersion(
|
|
41
|
+
rt,
|
|
42
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
NativeOtaHotUpdateCxxSpecJSI::NativeOtaHotUpdateCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
47
|
+
: TurboModule("OtaHotUpdate", jsInvoker) {
|
|
48
|
+
methodMap_["setupBundlePath"] = MethodMetadata {2, __hostFunction_NativeOtaHotUpdateCxxSpecJSI_setupBundlePath};
|
|
49
|
+
methodMap_["deleteBundle"] = MethodMetadata {1, __hostFunction_NativeOtaHotUpdateCxxSpecJSI_deleteBundle};
|
|
50
|
+
methodMap_["restart"] = MethodMetadata {0, __hostFunction_NativeOtaHotUpdateCxxSpecJSI_restart};
|
|
51
|
+
methodMap_["getCurrentVersion"] = MethodMetadata {1, __hostFunction_NativeOtaHotUpdateCxxSpecJSI_getCurrentVersion};
|
|
52
|
+
methodMap_["setCurrentVersion"] = MethodMetadata {1, __hostFunction_NativeOtaHotUpdateCxxSpecJSI_setCurrentVersion};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
} // namespace facebook::react
|
package/android/generated/jni/react/renderer/components/RNOtaHotUpdateSpec/RNOtaHotUpdateSpecJSI.h
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class JSI_EXPORT NativeOtaHotUpdateCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeOtaHotUpdateCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual jsi::Value setupBundlePath(jsi::Runtime &rt, jsi::String path, jsi::String extension) = 0;
|
|
24
|
+
virtual jsi::Value deleteBundle(jsi::Runtime &rt, double i) = 0;
|
|
25
|
+
virtual void restart(jsi::Runtime &rt) = 0;
|
|
26
|
+
virtual jsi::Value getCurrentVersion(jsi::Runtime &rt, double a) = 0;
|
|
27
|
+
virtual jsi::Value setCurrentVersion(jsi::Runtime &rt, jsi::String version) = 0;
|
|
28
|
+
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
template <typename T>
|
|
32
|
+
class JSI_EXPORT NativeOtaHotUpdateCxxSpec : public TurboModule {
|
|
33
|
+
public:
|
|
34
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
35
|
+
return delegate_.get(rt, propName);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static constexpr std::string_view kModuleName = "OtaHotUpdate";
|
|
39
|
+
|
|
40
|
+
protected:
|
|
41
|
+
NativeOtaHotUpdateCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
42
|
+
: TurboModule(std::string{NativeOtaHotUpdateCxxSpec::kModuleName}, jsInvoker),
|
|
43
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
private:
|
|
47
|
+
class Delegate : public NativeOtaHotUpdateCxxSpecJSI {
|
|
48
|
+
public:
|
|
49
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
50
|
+
NativeOtaHotUpdateCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
51
|
+
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
jsi::Value setupBundlePath(jsi::Runtime &rt, jsi::String path, jsi::String extension) override {
|
|
55
|
+
static_assert(
|
|
56
|
+
bridging::getParameterCount(&T::setupBundlePath) == 3,
|
|
57
|
+
"Expected setupBundlePath(...) to have 3 parameters");
|
|
58
|
+
|
|
59
|
+
return bridging::callFromJs<jsi::Value>(
|
|
60
|
+
rt, &T::setupBundlePath, jsInvoker_, instance_, std::move(path), std::move(extension));
|
|
61
|
+
}
|
|
62
|
+
jsi::Value deleteBundle(jsi::Runtime &rt, double i) override {
|
|
63
|
+
static_assert(
|
|
64
|
+
bridging::getParameterCount(&T::deleteBundle) == 2,
|
|
65
|
+
"Expected deleteBundle(...) to have 2 parameters");
|
|
66
|
+
|
|
67
|
+
return bridging::callFromJs<jsi::Value>(
|
|
68
|
+
rt, &T::deleteBundle, jsInvoker_, instance_, std::move(i));
|
|
69
|
+
}
|
|
70
|
+
void restart(jsi::Runtime &rt) override {
|
|
71
|
+
static_assert(
|
|
72
|
+
bridging::getParameterCount(&T::restart) == 1,
|
|
73
|
+
"Expected restart(...) to have 1 parameters");
|
|
74
|
+
|
|
75
|
+
return bridging::callFromJs<void>(
|
|
76
|
+
rt, &T::restart, jsInvoker_, instance_);
|
|
77
|
+
}
|
|
78
|
+
jsi::Value getCurrentVersion(jsi::Runtime &rt, double a) override {
|
|
79
|
+
static_assert(
|
|
80
|
+
bridging::getParameterCount(&T::getCurrentVersion) == 2,
|
|
81
|
+
"Expected getCurrentVersion(...) to have 2 parameters");
|
|
82
|
+
|
|
83
|
+
return bridging::callFromJs<jsi::Value>(
|
|
84
|
+
rt, &T::getCurrentVersion, jsInvoker_, instance_, std::move(a));
|
|
85
|
+
}
|
|
86
|
+
jsi::Value setCurrentVersion(jsi::Runtime &rt, jsi::String version) override {
|
|
87
|
+
static_assert(
|
|
88
|
+
bridging::getParameterCount(&T::setCurrentVersion) == 2,
|
|
89
|
+
"Expected setCurrentVersion(...) to have 2 parameters");
|
|
90
|
+
|
|
91
|
+
return bridging::callFromJs<jsi::Value>(
|
|
92
|
+
rt, &T::setCurrentVersion, jsInvoker_, instance_, std::move(version));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private:
|
|
96
|
+
friend class NativeOtaHotUpdateCxxSpec;
|
|
97
|
+
T *instance_;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
Delegate delegate_;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "ShadowNodes.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include "EventEmitters.h"
|
|
14
|
+
#include "Props.h"
|
|
15
|
+
#include "States.h"
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <jsi/jsi.h>
|
|
18
|
+
|
|
19
|
+
namespace facebook::react {
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
} // namespace facebook::react
|