@hot-updater/react-native 0.19.0 → 0.19.1-rc.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.
@@ -0,0 +1,94 @@
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.facebook.fbreact.specs;
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.bridge.ReadableMap;
21
+ import com.facebook.react.common.build.ReactBuildConfig;
22
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
23
+ import java.util.Arrays;
24
+ import java.util.HashSet;
25
+ import java.util.Map;
26
+ import java.util.Set;
27
+ import javax.annotation.Nonnull;
28
+ import javax.annotation.Nullable;
29
+
30
+ public abstract class NativeHotUpdaterSpec extends ReactContextBaseJavaModule implements TurboModule {
31
+ public static final String NAME = "HotUpdater";
32
+
33
+ public NativeHotUpdaterSpec(ReactApplicationContext reactContext) {
34
+ super(reactContext);
35
+ }
36
+
37
+ @Override
38
+ public @Nonnull String getName() {
39
+ return NAME;
40
+ }
41
+
42
+ @ReactMethod
43
+ @DoNotStrip
44
+ public abstract void reload();
45
+
46
+ @ReactMethod
47
+ @DoNotStrip
48
+ public abstract void updateBundle(ReadableMap params, Promise promise);
49
+
50
+ @ReactMethod
51
+ @DoNotStrip
52
+ public abstract void getAppVersion(Promise promise);
53
+
54
+ @ReactMethod
55
+ @DoNotStrip
56
+ public abstract void setChannel(String channel, Promise promise);
57
+
58
+ @ReactMethod
59
+ @DoNotStrip
60
+ public abstract void addListener(String eventName);
61
+
62
+ @ReactMethod
63
+ @DoNotStrip
64
+ public abstract void removeListeners(double count);
65
+
66
+ protected abstract Map<String, Object> getTypedExportedConstants();
67
+
68
+ @Override
69
+ @DoNotStrip
70
+ public final @Nullable Map<String, Object> getConstants() {
71
+ Map<String, Object> constants = getTypedExportedConstants();
72
+ if (ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD) {
73
+ Set<String> obligatoryFlowConstants = new HashSet<>(Arrays.asList(
74
+ "MIN_BUNDLE_ID"
75
+ ));
76
+ Set<String> optionalFlowConstants = new HashSet<>(Arrays.asList(
77
+ "APP_VERSION",
78
+ "CHANNEL"
79
+ ));
80
+ Set<String> undeclaredConstants = new HashSet<>(constants.keySet());
81
+ undeclaredConstants.removeAll(obligatoryFlowConstants);
82
+ undeclaredConstants.removeAll(optionalFlowConstants);
83
+ if (!undeclaredConstants.isEmpty()) {
84
+ throw new IllegalStateException(String.format("Native Module Flow doesn't declare constants: %s", undeclaredConstants));
85
+ }
86
+ undeclaredConstants = obligatoryFlowConstants;
87
+ undeclaredConstants.removeAll(constants.keySet());
88
+ if (!undeclaredConstants.isEmpty()) {
89
+ throw new IllegalStateException(String.format("Native Module doesn't fill in constants: %s", undeclaredConstants));
90
+ }
91
+ }
92
+ return constants;
93
+ }
94
+ }
@@ -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/HotUpdaterSpec/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_HotUpdaterSpec
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_HotUpdaterSpec PUBLIC . react/renderer/components/HotUpdaterSpec)
18
+
19
+ target_link_libraries(
20
+ react_codegen_HotUpdaterSpec
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_HotUpdaterSpec
30
+ PRIVATE
31
+ -DLOG_TAG=\"ReactNative\"
32
+ -fexceptions
33
+ -frtti
34
+ -std=c++20
35
+ -Wall
36
+ )
@@ -0,0 +1,68 @@
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 "HotUpdater.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_reload(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, VoidKind, "reload", "()V", args, count, cachedMethodId);
18
+ }
19
+
20
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_updateBundle(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, "updateBundle", "(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
23
+ }
24
+
25
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_getAppVersion(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, PromiseKind, "getAppVersion", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
28
+ }
29
+
30
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_setChannel(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, "setChannel", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
33
+ }
34
+
35
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_addListener(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, VoidKind, "addListener", "(Ljava/lang/String;)V", args, count, cachedMethodId);
38
+ }
39
+
40
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
41
+ static jmethodID cachedMethodId = nullptr;
42
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "removeListeners", "(D)V", args, count, cachedMethodId);
43
+ }
44
+
45
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
46
+ static jmethodID cachedMethodId = nullptr;
47
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, ObjectKind, "getConstants", "()Ljava/util/Map;", args, count, cachedMethodId);
48
+ }
49
+
50
+ NativeHotUpdaterSpecJSI::NativeHotUpdaterSpecJSI(const JavaTurboModule::InitParams &params)
51
+ : JavaTurboModule(params) {
52
+ methodMap_["reload"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterSpecJSI_reload};
53
+ methodMap_["updateBundle"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterSpecJSI_updateBundle};
54
+ methodMap_["getAppVersion"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterSpecJSI_getAppVersion};
55
+ methodMap_["setChannel"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterSpecJSI_setChannel};
56
+ methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterSpecJSI_addListener};
57
+ methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterSpecJSI_removeListeners};
58
+ methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterSpecJSI_getConstants};
59
+ }
60
+
61
+ std::shared_ptr<TurboModule> HotUpdater_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
62
+ if (moduleName == "HotUpdater") {
63
+ return std::make_shared<NativeHotUpdaterSpecJSI>(params);
64
+ }
65
+ return nullptr;
66
+ }
67
+
68
+ } // 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 'NativeHotUpdater'
21
+ */
22
+ class JSI_EXPORT NativeHotUpdaterSpecJSI : public JavaTurboModule {
23
+ public:
24
+ NativeHotUpdaterSpecJSI(const JavaTurboModule::InitParams &params);
25
+ };
26
+
27
+
28
+ JSI_EXPORT
29
+ std::shared_ptr<TurboModule> HotUpdater_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
+
31
+ } // namespace facebook::react
@@ -0,0 +1,68 @@
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 "HotUpdaterSpec.h"
12
+
13
+ namespace facebook::react {
14
+
15
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_reload(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, VoidKind, "reload", "()V", args, count, cachedMethodId);
18
+ }
19
+
20
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_updateBundle(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, "updateBundle", "(Lcom/facebook/react/bridge/ReadableMap;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
23
+ }
24
+
25
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_getAppVersion(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, PromiseKind, "getAppVersion", "(Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
28
+ }
29
+
30
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_setChannel(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, "setChannel", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
33
+ }
34
+
35
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_addListener(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, VoidKind, "addListener", "(Ljava/lang/String;)V", args, count, cachedMethodId);
38
+ }
39
+
40
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_removeListeners(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
41
+ static jmethodID cachedMethodId = nullptr;
42
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "removeListeners", "(D)V", args, count, cachedMethodId);
43
+ }
44
+
45
+ static facebook::jsi::Value __hostFunction_NativeHotUpdaterSpecJSI_getConstants(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
46
+ static jmethodID cachedMethodId = nullptr;
47
+ return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, ObjectKind, "getConstants", "()Ljava/util/Map;", args, count, cachedMethodId);
48
+ }
49
+
50
+ NativeHotUpdaterSpecJSI::NativeHotUpdaterSpecJSI(const JavaTurboModule::InitParams &params)
51
+ : JavaTurboModule(params) {
52
+ methodMap_["reload"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterSpecJSI_reload};
53
+ methodMap_["updateBundle"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterSpecJSI_updateBundle};
54
+ methodMap_["getAppVersion"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterSpecJSI_getAppVersion};
55
+ methodMap_["setChannel"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterSpecJSI_setChannel};
56
+ methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterSpecJSI_addListener};
57
+ methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterSpecJSI_removeListeners};
58
+ methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterSpecJSI_getConstants};
59
+ }
60
+
61
+ std::shared_ptr<TurboModule> HotUpdaterSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params) {
62
+ if (moduleName == "HotUpdater") {
63
+ return std::make_shared<NativeHotUpdaterSpecJSI>(params);
64
+ }
65
+ return nullptr;
66
+ }
67
+
68
+ } // 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 'NativeHotUpdater'
21
+ */
22
+ class JSI_EXPORT NativeHotUpdaterSpecJSI : public JavaTurboModule {
23
+ public:
24
+ NativeHotUpdaterSpecJSI(const JavaTurboModule::InitParams &params);
25
+ };
26
+
27
+
28
+ JSI_EXPORT
29
+ std::shared_ptr<TurboModule> HotUpdaterSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams &params);
30
+
31
+ } // namespace facebook::react
@@ -0,0 +1,69 @@
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 "HotUpdaterJSI.h"
11
+
12
+ namespace facebook::react {
13
+
14
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_reload(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
+ static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->reload(
16
+ rt
17
+ );
18
+ return jsi::Value::undefined();
19
+ }
20
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_updateBundle(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
21
+ return static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->updateBundle(
22
+ rt,
23
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asObject(rt)
24
+ );
25
+ }
26
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_getAppVersion(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
27
+ return static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->getAppVersion(
28
+ rt
29
+ );
30
+ }
31
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_setChannel(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
32
+ return static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->setChannel(
33
+ rt,
34
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
35
+ );
36
+ }
37
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_addListener(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
38
+ static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->addListener(
39
+ rt,
40
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
41
+ );
42
+ return jsi::Value::undefined();
43
+ }
44
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_removeListeners(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
45
+ static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->removeListeners(
46
+ rt,
47
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
48
+ );
49
+ return jsi::Value::undefined();
50
+ }
51
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
52
+ return static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->getConstants(
53
+ rt
54
+ );
55
+ }
56
+
57
+ NativeHotUpdaterCxxSpecJSI::NativeHotUpdaterCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
58
+ : TurboModule("HotUpdater", jsInvoker) {
59
+ methodMap_["reload"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterCxxSpecJSI_reload};
60
+ methodMap_["updateBundle"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterCxxSpecJSI_updateBundle};
61
+ methodMap_["getAppVersion"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterCxxSpecJSI_getAppVersion};
62
+ methodMap_["setChannel"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterCxxSpecJSI_setChannel};
63
+ methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterCxxSpecJSI_addListener};
64
+ methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterCxxSpecJSI_removeListeners};
65
+ methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterCxxSpecJSI_getConstants};
66
+ }
67
+
68
+
69
+ } // namespace facebook::react
@@ -0,0 +1,168 @@
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
+
19
+ #pragma mark - NativeHotUpdaterUpdateBundleParams
20
+
21
+ template <typename P0, typename P1>
22
+ struct NativeHotUpdaterUpdateBundleParams {
23
+ P0 bundleId;
24
+ P1 zipUrl;
25
+ bool operator==(const NativeHotUpdaterUpdateBundleParams &other) const {
26
+ return bundleId == other.bundleId && zipUrl == other.zipUrl;
27
+ }
28
+ };
29
+
30
+ template <typename T>
31
+ struct NativeHotUpdaterUpdateBundleParamsBridging {
32
+ static T types;
33
+
34
+ static T fromJs(
35
+ jsi::Runtime &rt,
36
+ const jsi::Object &value,
37
+ const std::shared_ptr<CallInvoker> &jsInvoker) {
38
+ T result{
39
+ bridging::fromJs<decltype(types.bundleId)>(rt, value.getProperty(rt, "bundleId"), jsInvoker),
40
+ bridging::fromJs<decltype(types.zipUrl)>(rt, value.getProperty(rt, "zipUrl"), jsInvoker)};
41
+ return result;
42
+ }
43
+
44
+ #ifdef DEBUG
45
+ static jsi::String bundleIdToJs(jsi::Runtime &rt, decltype(types.bundleId) value) {
46
+ return bridging::toJs(rt, value);
47
+ }
48
+
49
+ static std::optional<jsi::String> zipUrlToJs(jsi::Runtime &rt, decltype(types.zipUrl) value) {
50
+ return bridging::toJs(rt, value);
51
+ }
52
+ #endif
53
+
54
+ static jsi::Object toJs(
55
+ jsi::Runtime &rt,
56
+ const T &value,
57
+ const std::shared_ptr<CallInvoker> &jsInvoker) {
58
+ auto result = facebook::jsi::Object(rt);
59
+ result.setProperty(rt, "bundleId", bridging::toJs(rt, value.bundleId, jsInvoker));
60
+ result.setProperty(rt, "zipUrl", bridging::toJs(rt, value.zipUrl, jsInvoker));
61
+ return result;
62
+ }
63
+ };
64
+
65
+ class JSI_EXPORT NativeHotUpdaterCxxSpecJSI : public TurboModule {
66
+ protected:
67
+ NativeHotUpdaterCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
68
+
69
+ public:
70
+ virtual void reload(jsi::Runtime &rt) = 0;
71
+ virtual jsi::Value updateBundle(jsi::Runtime &rt, jsi::Object params) = 0;
72
+ virtual jsi::Value getAppVersion(jsi::Runtime &rt) = 0;
73
+ virtual jsi::Value setChannel(jsi::Runtime &rt, jsi::String channel) = 0;
74
+ virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
75
+ virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
76
+ virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
77
+
78
+ };
79
+
80
+ template <typename T>
81
+ class JSI_EXPORT NativeHotUpdaterCxxSpec : public TurboModule {
82
+ public:
83
+ jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
84
+ return delegate_.get(rt, propName);
85
+ }
86
+
87
+ static constexpr std::string_view kModuleName = "HotUpdater";
88
+
89
+ protected:
90
+ NativeHotUpdaterCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
91
+ : TurboModule(std::string{NativeHotUpdaterCxxSpec::kModuleName}, jsInvoker),
92
+ delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
93
+
94
+
95
+ private:
96
+ class Delegate : public NativeHotUpdaterCxxSpecJSI {
97
+ public:
98
+ Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
99
+ NativeHotUpdaterCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
100
+
101
+ }
102
+
103
+ void reload(jsi::Runtime &rt) override {
104
+ static_assert(
105
+ bridging::getParameterCount(&T::reload) == 1,
106
+ "Expected reload(...) to have 1 parameters");
107
+
108
+ return bridging::callFromJs<void>(
109
+ rt, &T::reload, jsInvoker_, instance_);
110
+ }
111
+ jsi::Value updateBundle(jsi::Runtime &rt, jsi::Object params) override {
112
+ static_assert(
113
+ bridging::getParameterCount(&T::updateBundle) == 2,
114
+ "Expected updateBundle(...) to have 2 parameters");
115
+
116
+ return bridging::callFromJs<jsi::Value>(
117
+ rt, &T::updateBundle, jsInvoker_, instance_, std::move(params));
118
+ }
119
+ jsi::Value getAppVersion(jsi::Runtime &rt) override {
120
+ static_assert(
121
+ bridging::getParameterCount(&T::getAppVersion) == 1,
122
+ "Expected getAppVersion(...) to have 1 parameters");
123
+
124
+ return bridging::callFromJs<jsi::Value>(
125
+ rt, &T::getAppVersion, jsInvoker_, instance_);
126
+ }
127
+ jsi::Value setChannel(jsi::Runtime &rt, jsi::String channel) override {
128
+ static_assert(
129
+ bridging::getParameterCount(&T::setChannel) == 2,
130
+ "Expected setChannel(...) to have 2 parameters");
131
+
132
+ return bridging::callFromJs<jsi::Value>(
133
+ rt, &T::setChannel, jsInvoker_, instance_, std::move(channel));
134
+ }
135
+ void addListener(jsi::Runtime &rt, jsi::String eventName) override {
136
+ static_assert(
137
+ bridging::getParameterCount(&T::addListener) == 2,
138
+ "Expected addListener(...) to have 2 parameters");
139
+
140
+ return bridging::callFromJs<void>(
141
+ rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
142
+ }
143
+ void removeListeners(jsi::Runtime &rt, double count) override {
144
+ static_assert(
145
+ bridging::getParameterCount(&T::removeListeners) == 2,
146
+ "Expected removeListeners(...) to have 2 parameters");
147
+
148
+ return bridging::callFromJs<void>(
149
+ rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
150
+ }
151
+ jsi::Object getConstants(jsi::Runtime &rt) override {
152
+ static_assert(
153
+ bridging::getParameterCount(&T::getConstants) == 1,
154
+ "Expected getConstants(...) to have 1 parameters");
155
+
156
+ return bridging::callFromJs<jsi::Object>(
157
+ rt, &T::getConstants, jsInvoker_, instance_);
158
+ }
159
+
160
+ private:
161
+ friend class NativeHotUpdaterCxxSpec;
162
+ T *instance_;
163
+ };
164
+
165
+ Delegate delegate_;
166
+ };
167
+
168
+ } // namespace facebook::react
@@ -0,0 +1,69 @@
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 "HotUpdaterSpecJSI.h"
11
+
12
+ namespace facebook::react {
13
+
14
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_reload(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
+ static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->reload(
16
+ rt
17
+ );
18
+ return jsi::Value::undefined();
19
+ }
20
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_updateBundle(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
21
+ return static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->updateBundle(
22
+ rt,
23
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asObject(rt)
24
+ );
25
+ }
26
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_getAppVersion(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
27
+ return static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->getAppVersion(
28
+ rt
29
+ );
30
+ }
31
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_setChannel(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
32
+ return static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->setChannel(
33
+ rt,
34
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
35
+ );
36
+ }
37
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_addListener(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
38
+ static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->addListener(
39
+ rt,
40
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
41
+ );
42
+ return jsi::Value::undefined();
43
+ }
44
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_removeListeners(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
45
+ static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->removeListeners(
46
+ rt,
47
+ count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber()
48
+ );
49
+ return jsi::Value::undefined();
50
+ }
51
+ static jsi::Value __hostFunction_NativeHotUpdaterCxxSpecJSI_getConstants(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
52
+ return static_cast<NativeHotUpdaterCxxSpecJSI *>(&turboModule)->getConstants(
53
+ rt
54
+ );
55
+ }
56
+
57
+ NativeHotUpdaterCxxSpecJSI::NativeHotUpdaterCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
58
+ : TurboModule("HotUpdater", jsInvoker) {
59
+ methodMap_["reload"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterCxxSpecJSI_reload};
60
+ methodMap_["updateBundle"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterCxxSpecJSI_updateBundle};
61
+ methodMap_["getAppVersion"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterCxxSpecJSI_getAppVersion};
62
+ methodMap_["setChannel"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterCxxSpecJSI_setChannel};
63
+ methodMap_["addListener"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterCxxSpecJSI_addListener};
64
+ methodMap_["removeListeners"] = MethodMetadata {1, __hostFunction_NativeHotUpdaterCxxSpecJSI_removeListeners};
65
+ methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeHotUpdaterCxxSpecJSI_getConstants};
66
+ }
67
+
68
+
69
+ } // namespace facebook::react
@@ -0,0 +1,172 @@
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
+
19
+ #pragma mark - NativeHotUpdaterUpdateBundleParams
20
+
21
+ template <typename P0, typename P1>
22
+ struct NativeHotUpdaterUpdateBundleParams {
23
+ P0 bundleId;
24
+ P1 zipUrl;
25
+ bool operator==(const NativeHotUpdaterUpdateBundleParams &other) const {
26
+ return bundleId == other.bundleId && zipUrl == other.zipUrl;
27
+ }
28
+ };
29
+
30
+ template <typename T>
31
+ struct NativeHotUpdaterUpdateBundleParamsBridging {
32
+ static T types;
33
+
34
+ static T fromJs(
35
+ jsi::Runtime &rt,
36
+ const jsi::Object &value,
37
+ const std::shared_ptr<CallInvoker> &jsInvoker) {
38
+ T result{
39
+ bridging::fromJs<decltype(types.bundleId)>(rt, value.getProperty(rt, "bundleId"), jsInvoker),
40
+ bridging::fromJs<decltype(types.zipUrl)>(rt, value.getProperty(rt, "zipUrl"), jsInvoker)};
41
+ return result;
42
+ }
43
+
44
+ #ifdef DEBUG
45
+ static jsi::String bundleIdToJs(jsi::Runtime &rt, decltype(types.bundleId) value) {
46
+ return bridging::toJs(rt, value);
47
+ }
48
+
49
+ static std::optional<jsi::String> zipUrlToJs(jsi::Runtime &rt, decltype(types.zipUrl) value) {
50
+ return bridging::toJs(rt, value);
51
+ }
52
+ #endif
53
+
54
+ static jsi::Object toJs(
55
+ jsi::Runtime &rt,
56
+ const T &value,
57
+ const std::shared_ptr<CallInvoker> &jsInvoker) {
58
+ auto result = facebook::jsi::Object(rt);
59
+ result.setProperty(rt, "bundleId", bridging::toJs(rt, value.bundleId, jsInvoker));
60
+ result.setProperty(rt, "zipUrl", bridging::toJs(rt, value.zipUrl, jsInvoker));
61
+ return result;
62
+ }
63
+ };
64
+
65
+ class JSI_EXPORT NativeHotUpdaterCxxSpecJSI : public TurboModule {
66
+ protected:
67
+ NativeHotUpdaterCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
68
+
69
+ public:
70
+ virtual void reload(jsi::Runtime &rt) = 0;
71
+ virtual jsi::Value updateBundle(jsi::Runtime &rt, jsi::Object params) = 0;
72
+ virtual jsi::Value getAppVersion(jsi::Runtime &rt) = 0;
73
+ virtual jsi::Value setChannel(jsi::Runtime &rt, jsi::String channel) = 0;
74
+ virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
75
+ virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
76
+ virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
77
+
78
+ };
79
+
80
+ template <typename T>
81
+ class JSI_EXPORT NativeHotUpdaterCxxSpec : public TurboModule {
82
+ public:
83
+ jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
84
+ return delegate_.create(rt, propName);
85
+ }
86
+
87
+ std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
88
+ return delegate_.getPropertyNames(runtime);
89
+ }
90
+
91
+ static constexpr std::string_view kModuleName = "HotUpdater";
92
+
93
+ protected:
94
+ NativeHotUpdaterCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
95
+ : TurboModule(std::string{NativeHotUpdaterCxxSpec::kModuleName}, jsInvoker),
96
+ delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
97
+
98
+
99
+ private:
100
+ class Delegate : public NativeHotUpdaterCxxSpecJSI {
101
+ public:
102
+ Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
103
+ NativeHotUpdaterCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
104
+
105
+ }
106
+
107
+ void reload(jsi::Runtime &rt) override {
108
+ static_assert(
109
+ bridging::getParameterCount(&T::reload) == 1,
110
+ "Expected reload(...) to have 1 parameters");
111
+
112
+ return bridging::callFromJs<void>(
113
+ rt, &T::reload, jsInvoker_, instance_);
114
+ }
115
+ jsi::Value updateBundle(jsi::Runtime &rt, jsi::Object params) override {
116
+ static_assert(
117
+ bridging::getParameterCount(&T::updateBundle) == 2,
118
+ "Expected updateBundle(...) to have 2 parameters");
119
+
120
+ return bridging::callFromJs<jsi::Value>(
121
+ rt, &T::updateBundle, jsInvoker_, instance_, std::move(params));
122
+ }
123
+ jsi::Value getAppVersion(jsi::Runtime &rt) override {
124
+ static_assert(
125
+ bridging::getParameterCount(&T::getAppVersion) == 1,
126
+ "Expected getAppVersion(...) to have 1 parameters");
127
+
128
+ return bridging::callFromJs<jsi::Value>(
129
+ rt, &T::getAppVersion, jsInvoker_, instance_);
130
+ }
131
+ jsi::Value setChannel(jsi::Runtime &rt, jsi::String channel) override {
132
+ static_assert(
133
+ bridging::getParameterCount(&T::setChannel) == 2,
134
+ "Expected setChannel(...) to have 2 parameters");
135
+
136
+ return bridging::callFromJs<jsi::Value>(
137
+ rt, &T::setChannel, jsInvoker_, instance_, std::move(channel));
138
+ }
139
+ void addListener(jsi::Runtime &rt, jsi::String eventName) override {
140
+ static_assert(
141
+ bridging::getParameterCount(&T::addListener) == 2,
142
+ "Expected addListener(...) to have 2 parameters");
143
+
144
+ return bridging::callFromJs<void>(
145
+ rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
146
+ }
147
+ void removeListeners(jsi::Runtime &rt, double count) override {
148
+ static_assert(
149
+ bridging::getParameterCount(&T::removeListeners) == 2,
150
+ "Expected removeListeners(...) to have 2 parameters");
151
+
152
+ return bridging::callFromJs<void>(
153
+ rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
154
+ }
155
+ jsi::Object getConstants(jsi::Runtime &rt) override {
156
+ static_assert(
157
+ bridging::getParameterCount(&T::getConstants) == 1,
158
+ "Expected getConstants(...) to have 1 parameters");
159
+
160
+ return bridging::callFromJs<jsi::Object>(
161
+ rt, &T::getConstants, jsInvoker_, instance_);
162
+ }
163
+
164
+ private:
165
+ friend class NativeHotUpdaterCxxSpec;
166
+ T *instance_;
167
+ };
168
+
169
+ Delegate delegate_;
170
+ };
171
+
172
+ } // namespace facebook::react
@@ -0,0 +1,15 @@
1
+ {
2
+ "originHash" : "11a19903c341bf413adfdb15a6fb5dff9a819b0557a6cfe9e5fe00f32a0ff74e",
3
+ "pins" : [
4
+ {
5
+ "identity" : "ziparchive",
6
+ "kind" : "remoteSourceControl",
7
+ "location" : "https://github.com/ZipArchive/ZipArchive.git",
8
+ "state" : {
9
+ "revision" : "df35718ea19a94e015b91dc4881dee028ce4cdba",
10
+ "version" : "2.6.0"
11
+ }
12
+ }
13
+ ],
14
+ "version" : 3
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hot-updater/react-native",
3
- "version": "0.19.0",
3
+ "version": "0.19.1-rc.0",
4
4
  "description": "React Native OTA solution for self-hosted",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -107,7 +107,7 @@
107
107
  "expo": ">=50.0.0",
108
108
  "react": "*",
109
109
  "react-native": "*",
110
- "hot-updater": "*"
110
+ "hot-updater": "0.19.1-rc.0"
111
111
  },
112
112
  "devDependencies": {
113
113
  "@react-native-community/cli": "18.0.0",
@@ -119,12 +119,12 @@
119
119
  "react-native": "0.79.1",
120
120
  "react-native-builder-bob": "^0.40.10",
121
121
  "typescript": "^5.8.3",
122
- "hot-updater": "0.19.0"
122
+ "hot-updater": "0.19.1-rc.0"
123
123
  },
124
124
  "dependencies": {
125
125
  "use-sync-external-store": "1.5.0",
126
- "@hot-updater/core": "0.19.0",
127
- "@hot-updater/js": "0.19.0"
126
+ "@hot-updater/core": "0.19.1-rc.0",
127
+ "@hot-updater/js": "0.19.1-rc.0"
128
128
  },
129
129
  "scripts": {
130
130
  "build": "bob build && tsc -p plugin/tsconfig.json",