@hot-updater/react-native 0.18.0 → 0.18.2
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/android/src/main/java/com/hotupdater/HotUpdaterFactory.kt +2 -1
- package/android/src/main/java/com/hotupdater/HotUpdaterImpl.kt +9 -0
- package/android/src/main/java/com/hotupdater/VersionedPreferencesService.kt +2 -1
- package/ios/HotUpdater/Internal/BundleFileStorageService.swift +5 -7
- package/ios/HotUpdater/Internal/HotUpdaterImpl.swift +17 -6
- package/ios/HotUpdater/Internal/VersionedPreferencesService.swift +2 -2
- package/package.json +3 -3
- package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeHotUpdaterSpec.java +0 -94
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -36
- package/android/app/build/generated/source/codegen/jni/HotUpdater-generated.cpp +0 -68
- package/android/app/build/generated/source/codegen/jni/HotUpdater.h +0 -31
- package/android/app/build/generated/source/codegen/jni/HotUpdaterSpec-generated.cpp +0 -68
- package/android/app/build/generated/source/codegen/jni/HotUpdaterSpec.h +0 -31
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/HotUpdater/HotUpdaterJSI-generated.cpp +0 -69
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/HotUpdater/HotUpdaterJSI.h +0 -168
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/HotUpdaterSpec/HotUpdaterSpecJSI-generated.cpp +0 -69
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/HotUpdaterSpec/HotUpdaterSpecJSI.h +0 -172
- package/ios/HotUpdater/Package.resolved +0 -15
|
@@ -27,10 +27,11 @@ object HotUpdaterFactory {
|
|
|
27
27
|
private fun createHotUpdaterImpl(context: Context): HotUpdaterImpl {
|
|
28
28
|
val appContext = context.applicationContext
|
|
29
29
|
val appVersion = HotUpdaterImpl.getAppVersion(appContext) ?: "unknown"
|
|
30
|
+
val appChannel = HotUpdaterImpl.getChannel(appContext)
|
|
30
31
|
|
|
31
32
|
// Create services
|
|
32
33
|
val fileSystem = FileManagerService(appContext)
|
|
33
|
-
val preferences = VersionedPreferencesService(appContext, appVersion)
|
|
34
|
+
val preferences = VersionedPreferencesService(appContext, appVersion, appChannel)
|
|
34
35
|
val downloadService = HttpDownloadService()
|
|
35
36
|
val unzipService = ZipFileUnzipService()
|
|
36
37
|
|
|
@@ -57,6 +57,15 @@ class HotUpdaterImpl(
|
|
|
57
57
|
} catch (e: Exception) {
|
|
58
58
|
null
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
fun getChannel(context: Context): String {
|
|
62
|
+
val id = context.resources.getIdentifier("hot_updater_channel", "string", context.packageName)
|
|
63
|
+
return if (id != 0) {
|
|
64
|
+
context.getString(id).takeIf { it.isNotEmpty() } ?: DEFAULT_CHANNEL
|
|
65
|
+
} else {
|
|
66
|
+
DEFAULT_CHANNEL
|
|
67
|
+
}
|
|
68
|
+
}
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
/**
|
|
@@ -33,11 +33,12 @@ interface PreferencesService {
|
|
|
33
33
|
class VersionedPreferencesService(
|
|
34
34
|
private val context: Context,
|
|
35
35
|
private val appVersion: String,
|
|
36
|
+
private val appChannel: String,
|
|
36
37
|
) : PreferencesService {
|
|
37
38
|
private val prefs: SharedPreferences
|
|
38
39
|
|
|
39
40
|
init {
|
|
40
|
-
val prefsName = "HotUpdaterPrefs_$appVersion"
|
|
41
|
+
val prefsName = "HotUpdaterPrefs_${appVersion}_$appChannel"
|
|
41
42
|
|
|
42
43
|
val sharedPrefsDir = File(context.applicationInfo.dataDir, "shared_prefs")
|
|
43
44
|
if (sharedPrefsDir.exists() && sharedPrefsDir.isDirectory) {
|
|
@@ -503,20 +503,19 @@ class BundleFileStorageService: BundleStorageService {
|
|
|
503
503
|
))))
|
|
504
504
|
return
|
|
505
505
|
}
|
|
506
|
-
|
|
506
|
+
|
|
507
507
|
// 2. Create target directory
|
|
508
508
|
do {
|
|
509
509
|
let tempZipFileURL = URL(fileURLWithPath: tempZipFile)
|
|
510
510
|
let tempZipFileDirectory = tempZipFileURL.deletingLastPathComponent()
|
|
511
|
-
|
|
511
|
+
|
|
512
512
|
if !self.fileSystem.fileExists(atPath: tempZipFileDirectory.path) {
|
|
513
513
|
try self.fileSystem.createDirectory(atPath: tempZipFileDirectory.path)
|
|
514
514
|
NSLog("[BundleStorage] Created directory atPath: \(tempZipFileDirectory.path)")
|
|
515
515
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
516
|
+
NSLog("[BundleStorage] Successfully downloaded file to: \(tempZipFile)")
|
|
517
|
+
|
|
518
|
+
// 3. Unzip the file
|
|
520
519
|
try self.unzipService.unzip(file: tempZipFile, to: extractedDir)
|
|
521
520
|
NSLog("[BundleStorage] Successfully extracted to: \(extractedDir)")
|
|
522
521
|
|
|
@@ -549,7 +548,6 @@ class BundleFileStorageService: BundleStorageService {
|
|
|
549
548
|
let setResult = self.setBundleURL(localPath: finalBundlePath)
|
|
550
549
|
switch setResult {
|
|
551
550
|
case .success:
|
|
552
|
-
// 10. Cleanup
|
|
553
551
|
self.cleanupTemporaryFiles([tempDirectory])
|
|
554
552
|
completion(.success(true))
|
|
555
553
|
case .failure(let error):
|
|
@@ -4,7 +4,9 @@ import React
|
|
|
4
4
|
@objcMembers public class HotUpdaterImpl: NSObject {
|
|
5
5
|
private let bundleStorage: BundleStorageService
|
|
6
6
|
private let preferences: PreferencesService
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
private static let DEFAULT_CHANNEL = "production"
|
|
9
|
+
|
|
8
10
|
// MARK: - Initialization
|
|
9
11
|
|
|
10
12
|
/**
|
|
@@ -35,10 +37,13 @@ import React
|
|
|
35
37
|
self.bundleStorage = bundleStorage
|
|
36
38
|
self.preferences = preferences
|
|
37
39
|
super.init()
|
|
38
|
-
|
|
40
|
+
|
|
39
41
|
// Configure preferences with app version
|
|
40
42
|
if let appVersion = HotUpdaterImpl.appVersion {
|
|
41
|
-
(preferences as? VersionedPreferencesService)?.configure(
|
|
43
|
+
(preferences as? VersionedPreferencesService)?.configure(
|
|
44
|
+
appVersion: appVersion,
|
|
45
|
+
appChannel: HotUpdaterImpl.appChannel
|
|
46
|
+
)
|
|
42
47
|
}
|
|
43
48
|
}
|
|
44
49
|
|
|
@@ -50,15 +55,21 @@ import React
|
|
|
50
55
|
public static var appVersion: String? {
|
|
51
56
|
return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
|
|
52
57
|
}
|
|
53
|
-
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Returns the app version from main bundle info.
|
|
61
|
+
*/
|
|
62
|
+
public static var appChannel: String {
|
|
63
|
+
return Bundle.main.object(forInfoDictionaryKey: "HOT_UPDATER_CHANNEL") as? String ?? Self.DEFAULT_CHANNEL
|
|
64
|
+
}
|
|
65
|
+
|
|
54
66
|
// MARK: - Channel Management
|
|
55
67
|
|
|
56
68
|
/**
|
|
57
69
|
* Gets the current update channel.
|
|
58
70
|
* @return The channel name or nil if not set
|
|
59
71
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
72
|
+
|
|
62
73
|
public func getChannel() -> String {
|
|
63
74
|
return Bundle.main.object(forInfoDictionaryKey: "HOT_UPDATER_CHANNEL") as? String ?? Self.DEFAULT_CHANNEL
|
|
64
75
|
}
|
|
@@ -23,8 +23,8 @@ class VersionedPreferencesService: PreferencesService {
|
|
|
23
23
|
* Configures the service with app version for key prefixing.
|
|
24
24
|
* @param appVersion The app version to use for key prefixing
|
|
25
25
|
*/
|
|
26
|
-
func configure(appVersion: String
|
|
27
|
-
self.keyPrefix = "hotupdater_\(appVersion ?? "unknown")_"
|
|
26
|
+
func configure(appVersion: String?, appChannel: String) {
|
|
27
|
+
self.keyPrefix = "hotupdater_\(appVersion ?? "unknown")_\(appChannel)_"
|
|
28
28
|
NSLog("[PreferencesService] Configured with appVersion: \(appVersion ?? "nil"). Key prefix: \(self.keyPrefix)")
|
|
29
29
|
}
|
|
30
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/react-native",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.2",
|
|
4
4
|
"description": "React Native OTA solution for self-hosted",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -118,8 +118,8 @@
|
|
|
118
118
|
},
|
|
119
119
|
"dependencies": {
|
|
120
120
|
"use-sync-external-store": "1.5.0",
|
|
121
|
-
"@hot-updater/core": "0.18.
|
|
122
|
-
"@hot-updater/js": "0.18.
|
|
121
|
+
"@hot-updater/core": "0.18.2",
|
|
122
|
+
"@hot-updater/js": "0.18.2"
|
|
123
123
|
},
|
|
124
124
|
"scripts": {
|
|
125
125
|
"build": "bob build && tsc -p plugin/tsconfig.json",
|
|
@@ -1,94 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
)
|
|
@@ -1,68 +0,0 @@
|
|
|
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 ¶ms)
|
|
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 ¶ms) {
|
|
62
|
-
if (moduleName == "HotUpdater") {
|
|
63
|
-
return std::make_shared<NativeHotUpdaterSpecJSI>(params);
|
|
64
|
-
}
|
|
65
|
-
return nullptr;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
} // namespace facebook::react
|
|
@@ -1,31 +0,0 @@
|
|
|
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 ¶ms);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
JSI_EXPORT
|
|
29
|
-
std::shared_ptr<TurboModule> HotUpdater_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
30
|
-
|
|
31
|
-
} // namespace facebook::react
|
|
@@ -1,68 +0,0 @@
|
|
|
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 ¶ms)
|
|
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 ¶ms) {
|
|
62
|
-
if (moduleName == "HotUpdater") {
|
|
63
|
-
return std::make_shared<NativeHotUpdaterSpecJSI>(params);
|
|
64
|
-
}
|
|
65
|
-
return nullptr;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
} // namespace facebook::react
|
|
@@ -1,31 +0,0 @@
|
|
|
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 ¶ms);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
JSI_EXPORT
|
|
29
|
-
std::shared_ptr<TurboModule> HotUpdaterSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
30
|
-
|
|
31
|
-
} // namespace facebook::react
|
|
@@ -1,69 +0,0 @@
|
|
|
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
|
|
@@ -1,168 +0,0 @@
|
|
|
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
|
|
@@ -1,69 +0,0 @@
|
|
|
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
|
|
@@ -1,172 +0,0 @@
|
|
|
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
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
}
|