@revrag-ai/embed-react-native 1.0.6 → 1.0.8
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 -1
- package/README.md +253 -274
- package/android/CMakeLists.txt +15 -0
- package/android/build.gradle +77 -25
- package/android/cpp-adapter.cpp +8 -0
- package/android/generated/java/com/revragai/embedreactnative/NativeEmbedReactNativeSpec.java +37 -0
- package/android/generated/jni/CMakeLists.txt +49 -0
- package/android/generated/jni/RNEmbedReactNativeSpec-generated.cpp +32 -0
- package/android/generated/jni/RNEmbedReactNativeSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNEmbedReactNativeSpec/RNEmbedReactNativeSpecJSI-generated.cpp +28 -0
- package/android/generated/jni/react/renderer/components/RNEmbedReactNativeSpec/RNEmbedReactNativeSpecJSI.h +67 -0
- package/android/gradle.properties +5 -5
- package/cpp/revrag-ai-embed-react-native.cpp +7 -0
- package/cpp/revrag-ai-embed-react-native.h +8 -0
- package/ios/EmbedReactNative.h +9 -0
- package/ios/{Onwid.mm → EmbedReactNative.mm} +4 -4
- package/ios/generated/RNEmbedReactNativeSpec/RNEmbedReactNativeSpec-generated.mm +29 -0
- package/ios/generated/RNEmbedReactNativeSpec/RNEmbedReactNativeSpec.h +50 -0
- package/ios/generated/RNEmbedReactNativeSpecJSI-generated.cpp +28 -0
- package/ios/generated/RNEmbedReactNativeSpecJSI.h +67 -0
- package/lib/commonjs/NativeEmbedReactNative.js +9 -0
- package/{dist/commonjs/onwidApi → lib/commonjs/api}/api.js +86 -15
- package/lib/commonjs/api/types/embed.api.types.js +2 -0
- package/{dist/module/component/audiowave.js → lib/commonjs/components/Embed/EmbedAudioWave.js} +21 -17
- package/{dist/module/component/OnwidButton.js → lib/commonjs/components/Embed/EmbedButton.js} +65 -61
- package/{dist/module/component/voice.js → lib/commonjs/components/Embed/EmbedVoice.js} +18 -14
- package/{dist/commonjs/style/onwidButton.style.js → lib/commonjs/components/styles/EmbedButton.style.js} +14 -9
- package/{dist/module/Event/onwid.js → lib/commonjs/events/embed.event.js} +14 -10
- package/{dist → lib}/commonjs/hooks/initialize.js +22 -22
- package/{dist/commonjs/hooks/initializelivekit.js → lib/commonjs/hooks/initialize.livekit.js} +8 -5
- package/lib/commonjs/hooks/types/voiceAgent.types.js +6 -0
- package/{dist/module/hooks/voiceAgent.js → lib/commonjs/hooks/voiceagent.js} +36 -31
- package/lib/commonjs/index.js +34 -0
- package/{dist/module/index.d.js → lib/commonjs/index.types.js} +7 -7
- package/lib/commonjs/store/store.key.js +46 -0
- package/{dist/module/utils/reanimatedHelpers.js → lib/commonjs/utils/reanimated.helper.js} +23 -17
- package/lib/module/NativeEmbedReactNative.js +5 -0
- package/{dist/module/onwidApi → lib/module/api}/api.js +69 -6
- package/lib/module/api/types/embed.api.types.js +2 -0
- package/{dist/commonjs/component/audiowave.js → lib/module/components/Embed/EmbedAudioWave.js} +2 -3
- package/{dist/commonjs/component/OnwidButton.js → lib/module/components/Embed/EmbedButton.js} +10 -11
- package/{dist/commonjs/component/voice.js → lib/module/components/Embed/EmbedVoice.js} +1 -1
- package/{dist/module/style/onwidButton.style.js → lib/module/components/styles/EmbedButton.style.js} +3 -3
- package/{dist/commonjs/Event/onwid.js → lib/module/events/embed.event.js} +6 -6
- package/{dist → lib}/module/hooks/initialize.js +7 -13
- package/{dist/module/hooks/initializelivekit.js → lib/module/hooks/initialize.livekit.js} +1 -1
- package/{dist/commonjs/hooks/voiceAgent.js → lib/module/hooks/voiceagent.js} +4 -4
- package/lib/module/index.js +7 -0
- package/{dist/commonjs/index.d.js → lib/module/index.types.js} +2 -1
- package/{dist/commonjs/utils/reanimatedHelpers.js → lib/module/utils/reanimated.helper.js} +14 -14
- package/lib/typescript/module/package.json +1 -0
- package/package.json +71 -35
- package/react-native.config.js +8 -14
- package/revrag-ai-embed-react-native.podspec +41 -0
- package/Onwid.podspec +0 -20
- package/dist/commonjs/NativeOnwid.js +0 -5
- package/dist/commonjs/button.json +0 -1
- package/dist/commonjs/index.js +0 -34
- package/dist/commonjs/onwidApi/api.types.js +0 -2
- package/dist/commonjs/utils/utils.js +0 -2
- package/dist/module/NativeOnwid.js +0 -5
- package/dist/module/button.json +0 -1
- package/dist/module/hooks/voiceAgent.types.js +0 -4
- package/dist/module/index.js +0 -34
- package/dist/module/onwidApi/api.types.js +0 -2
- package/dist/module/store.key.js +0 -38
- package/dist/module/utils/utils.js +0 -2
- package/dist/typescript/Event/onwid.d.ts +0 -14
- package/dist/typescript/NativeOnwid.d.ts +0 -7
- package/dist/typescript/component/OnwidButton.d.ts +0 -29
- package/dist/typescript/component/audiowave.d.ts +0 -7
- package/dist/typescript/component/voice.d.ts +0 -16
- package/dist/typescript/hooks/initialize.d.ts +0 -3
- package/dist/typescript/hooks/initialize.types.d.ts +0 -6
- package/dist/typescript/hooks/initializelivekit.d.ts +0 -4
- package/dist/typescript/hooks/voiceAgent.d.ts +0 -3
- package/dist/typescript/hooks/voiceAgent.types.d.ts +0 -17
- package/dist/typescript/index.d.ts +0 -27
- package/dist/typescript/onwidApi/api.d.ts +0 -54
- package/dist/typescript/onwidApi/api.types.d.ts +0 -22
- package/dist/typescript/store.key.d.ts +0 -4
- package/dist/typescript/style/onwidButton.style.d.ts +0 -99
- package/dist/typescript/utils/reanimatedHelpers.d.ts +0 -30
- package/dist/typescript/utils/utils.d.ts +0 -1
- package/ios/Onwid.h +0 -5
- package/scripts/verify-setup.js +0 -90
- /package/{dist/commonjs/hooks → lib/commonjs/hooks/types}/initialize.types.js +0 -0
- /package/{dist/module/hooks → lib/module/hooks/types}/initialize.types.js +0 -0
- /package/{dist/commonjs/hooks → lib/module/hooks/types}/voiceAgent.types.js +0 -0
- /package/{dist/commonjs → lib/module/store}/store.key.js +0 -0
- /package/{dist → lib/typescript}/commonjs/package.json +0 -0
package/android/build.gradle
CHANGED
|
@@ -1,38 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
1
|
+
buildscript {
|
|
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["EmbedReactNative_kotlinVersion"]
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
mavenCentral()
|
|
8
|
+
}
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
10
|
+
dependencies {
|
|
11
|
+
classpath "com.android.tools.build:gradle:7.2.1"
|
|
12
|
+
// noinspection DifferentKotlinGradleVersion
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
16
14
|
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def reactNativeArchitectures() {
|
|
18
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
19
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
20
|
+
}
|
|
17
21
|
|
|
22
|
+
def isNewArchitectureEnabled() {
|
|
23
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
24
|
+
}
|
|
18
25
|
|
|
19
26
|
apply plugin: "com.android.library"
|
|
20
27
|
apply plugin: "kotlin-android"
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
if (isNewArchitectureEnabled()) {
|
|
30
|
+
apply plugin: "com.facebook.react"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
def getExtOrDefault(name) {
|
|
34
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["EmbedReactNative_" + name]
|
|
35
|
+
}
|
|
23
36
|
|
|
24
37
|
def getExtOrIntegerDefault(name) {
|
|
25
|
-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["
|
|
38
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["EmbedReactNative_" + name]).toInteger()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
def supportsNamespace() {
|
|
42
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
43
|
+
def major = parsed[0].toInteger()
|
|
44
|
+
def minor = parsed[1].toInteger()
|
|
45
|
+
|
|
46
|
+
// Namespace support was added in 7.3.0
|
|
47
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
26
48
|
}
|
|
27
49
|
|
|
28
50
|
android {
|
|
29
|
-
|
|
51
|
+
if (supportsNamespace()) {
|
|
52
|
+
namespace "com.revragai.embedreactnative"
|
|
53
|
+
|
|
54
|
+
sourceSets {
|
|
55
|
+
main {
|
|
56
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
30
60
|
|
|
61
|
+
ndkVersion getExtOrDefault("ndkVersion")
|
|
31
62
|
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
32
63
|
|
|
33
64
|
defaultConfig {
|
|
34
65
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
35
66
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
67
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
68
|
+
|
|
69
|
+
externalNativeBuild {
|
|
70
|
+
cmake {
|
|
71
|
+
cppFlags "-O2 -frtti -fexceptions -Wall -fstack-protector-all"
|
|
72
|
+
abiFilters (*reactNativeArchitectures())
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
externalNativeBuild {
|
|
78
|
+
cmake {
|
|
79
|
+
path "CMakeLists.txt"
|
|
80
|
+
}
|
|
36
81
|
}
|
|
37
82
|
|
|
38
83
|
buildFeatures {
|
|
@@ -56,10 +101,12 @@ android {
|
|
|
56
101
|
|
|
57
102
|
sourceSets {
|
|
58
103
|
main {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
104
|
+
if (isNewArchitectureEnabled()) {
|
|
105
|
+
java.srcDirs += [
|
|
106
|
+
"generated/java",
|
|
107
|
+
"generated/jni"
|
|
108
|
+
]
|
|
109
|
+
}
|
|
63
110
|
}
|
|
64
111
|
}
|
|
65
112
|
}
|
|
@@ -72,12 +119,17 @@ repositories {
|
|
|
72
119
|
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
73
120
|
|
|
74
121
|
dependencies {
|
|
75
|
-
|
|
122
|
+
// For < 0.71, this will be from the local maven repo
|
|
123
|
+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
124
|
+
//noinspection GradleDynamicVersion
|
|
125
|
+
implementation "com.facebook.react:react-native:+"
|
|
76
126
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
77
127
|
}
|
|
78
128
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
129
|
+
if (isNewArchitectureEnabled()) {
|
|
130
|
+
react {
|
|
131
|
+
jsRootDir = file("../src/")
|
|
132
|
+
libraryName = "EmbedReactNative"
|
|
133
|
+
codegenJavaPackageName = "com.revragai.embedreactnative"
|
|
134
|
+
}
|
|
83
135
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#include <jni.h>
|
|
2
|
+
#include "revrag-ai-embed-react-native.h"
|
|
3
|
+
|
|
4
|
+
extern "C"
|
|
5
|
+
JNIEXPORT jdouble JNICALL
|
|
6
|
+
Java_com_revragai_embedreactnative_EmbedReactNativeModule_nativeMultiply(JNIEnv *env, jclass type, jdouble a, jdouble b) {
|
|
7
|
+
return revragai_embedreactnative::multiply(a, b);
|
|
8
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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.revragai.embedreactnative;
|
|
14
|
+
|
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
18
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
19
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
20
|
+
import javax.annotation.Nonnull;
|
|
21
|
+
|
|
22
|
+
public abstract class NativeEmbedReactNativeSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
23
|
+
public static final String NAME = "EmbedReactNative";
|
|
24
|
+
|
|
25
|
+
public NativeEmbedReactNativeSpec(ReactApplicationContext reactContext) {
|
|
26
|
+
super(reactContext);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Override
|
|
30
|
+
public @Nonnull String getName() {
|
|
31
|
+
return NAME;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
35
|
+
@DoNotStrip
|
|
36
|
+
public abstract double multiply(double a, double b);
|
|
37
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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/RNEmbedReactNativeSpec/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_RNEmbedReactNativeSpec
|
|
13
|
+
SHARED
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_RNEmbedReactNativeSpec PUBLIC . react/renderer/components/RNEmbedReactNativeSpec)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_RNEmbedReactNativeSpec
|
|
21
|
+
fbjni
|
|
22
|
+
folly_runtime
|
|
23
|
+
glog
|
|
24
|
+
jsi
|
|
25
|
+
react_codegen_rncore
|
|
26
|
+
react_debug
|
|
27
|
+
react_nativemodule_core
|
|
28
|
+
react_render_componentregistry
|
|
29
|
+
react_render_core
|
|
30
|
+
react_render_debug
|
|
31
|
+
react_render_graphics
|
|
32
|
+
react_render_imagemanager
|
|
33
|
+
react_render_mapbuffer
|
|
34
|
+
react_utils
|
|
35
|
+
rrc_image
|
|
36
|
+
rrc_view
|
|
37
|
+
turbomodulejsijni
|
|
38
|
+
yoga
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
target_compile_options(
|
|
42
|
+
react_codegen_RNEmbedReactNativeSpec
|
|
43
|
+
PRIVATE
|
|
44
|
+
-DLOG_TAG=\"ReactNative\"
|
|
45
|
+
-fexceptions
|
|
46
|
+
-frtti
|
|
47
|
+
-std=c++20
|
|
48
|
+
-Wall
|
|
49
|
+
)
|
|
@@ -0,0 +1,32 @@
|
|
|
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 "RNEmbedReactNativeSpec.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
static facebook::jsi::Value __hostFunction_NativeEmbedReactNativeSpecJSI_multiply(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, NumberKind, "multiply", "(DD)D", args, count, cachedMethodId);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
NativeEmbedReactNativeSpecJSI::NativeEmbedReactNativeSpecJSI(const JavaTurboModule::InitParams ¶ms)
|
|
21
|
+
: JavaTurboModule(params) {
|
|
22
|
+
methodMap_["multiply"] = MethodMetadata {2, __hostFunction_NativeEmbedReactNativeSpecJSI_multiply};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
std::shared_ptr<TurboModule> RNEmbedReactNativeSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
26
|
+
if (moduleName == "EmbedReactNative") {
|
|
27
|
+
return std::make_shared<NativeEmbedReactNativeSpecJSI>(params);
|
|
28
|
+
}
|
|
29
|
+
return nullptr;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
} // 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 'NativeEmbedReactNative'
|
|
21
|
+
*/
|
|
22
|
+
class JSI_EXPORT NativeEmbedReactNativeSpecJSI : public JavaTurboModule {
|
|
23
|
+
public:
|
|
24
|
+
NativeEmbedReactNativeSpecJSI(const JavaTurboModule::InitParams ¶ms);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
JSI_EXPORT
|
|
29
|
+
std::shared_ptr<TurboModule> RNEmbedReactNativeSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
30
|
+
|
|
31
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,28 @@
|
|
|
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 "RNEmbedReactNativeSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
static jsi::Value __hostFunction_NativeEmbedReactNativeCxxSpecJSI_multiply(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
+
return static_cast<NativeEmbedReactNativeCxxSpecJSI *>(&turboModule)->multiply(
|
|
16
|
+
rt,
|
|
17
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber(),
|
|
18
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asNumber()
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
NativeEmbedReactNativeCxxSpecJSI::NativeEmbedReactNativeCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
23
|
+
: TurboModule("EmbedReactNative", jsInvoker) {
|
|
24
|
+
methodMap_["multiply"] = MethodMetadata {2, __hostFunction_NativeEmbedReactNativeCxxSpecJSI_multiply};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,67 @@
|
|
|
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 NativeEmbedReactNativeCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeEmbedReactNativeCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual double multiply(jsi::Runtime &rt, double a, double b) = 0;
|
|
24
|
+
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
template <typename T>
|
|
28
|
+
class JSI_EXPORT NativeEmbedReactNativeCxxSpec : public TurboModule {
|
|
29
|
+
public:
|
|
30
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
31
|
+
return delegate_.get(rt, propName);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static constexpr std::string_view kModuleName = "EmbedReactNative";
|
|
35
|
+
|
|
36
|
+
protected:
|
|
37
|
+
NativeEmbedReactNativeCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
38
|
+
: TurboModule(std::string{NativeEmbedReactNativeCxxSpec::kModuleName}, jsInvoker),
|
|
39
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
private:
|
|
43
|
+
class Delegate : public NativeEmbedReactNativeCxxSpecJSI {
|
|
44
|
+
public:
|
|
45
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
46
|
+
NativeEmbedReactNativeCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
double multiply(jsi::Runtime &rt, double a, double b) override {
|
|
51
|
+
static_assert(
|
|
52
|
+
bridging::getParameterCount(&T::multiply) == 3,
|
|
53
|
+
"Expected multiply(...) to have 3 parameters");
|
|
54
|
+
|
|
55
|
+
return bridging::callFromJs<double>(
|
|
56
|
+
rt, &T::multiply, jsInvoker_, instance_, std::move(a), std::move(b));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
friend class NativeEmbedReactNativeCxxSpec;
|
|
61
|
+
T *instance_;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
Delegate delegate_;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
} // namespace facebook::react
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
EmbedReactNative_kotlinVersion=1.7.0
|
|
2
|
+
EmbedReactNative_minSdkVersion=21
|
|
3
|
+
EmbedReactNative_targetSdkVersion=31
|
|
4
|
+
EmbedReactNative_compileSdkVersion=31
|
|
5
|
+
EmbedReactNative_ndkversion=21.4.7075529
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
#import "
|
|
1
|
+
#import "EmbedReactNative.h"
|
|
2
2
|
|
|
3
|
-
@implementation
|
|
3
|
+
@implementation EmbedReactNative
|
|
4
4
|
RCT_EXPORT_MODULE()
|
|
5
5
|
|
|
6
6
|
- (NSNumber *)multiply:(double)a b:(double)b {
|
|
7
|
-
NSNumber *result = @(a
|
|
7
|
+
NSNumber *result = @(revragai_embedreactnative::multiply(a, b));
|
|
8
8
|
|
|
9
9
|
return result;
|
|
10
10
|
}
|
|
@@ -12,7 +12,7 @@ RCT_EXPORT_MODULE()
|
|
|
12
12
|
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
13
13
|
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
14
14
|
{
|
|
15
|
-
return std::make_shared<facebook::react::
|
|
15
|
+
return std::make_shared<facebook::react::NativeEmbedReactNativeSpecJSI>(params);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
@end
|
|
@@ -0,0 +1,29 @@
|
|
|
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: GenerateModuleObjCpp
|
|
8
|
+
*
|
|
9
|
+
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
+
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
+
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#import "RNEmbedReactNativeSpec.h"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
static facebook::jsi::Value __hostFunction_NativeEmbedReactNativeSpecJSI_multiply(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
20
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, NumberKind, "multiply", @selector(multiply:b:), args, count);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
NativeEmbedReactNativeSpecJSI::NativeEmbedReactNativeSpecJSI(const ObjCTurboModule::InitParams ¶ms)
|
|
24
|
+
: ObjCTurboModule(params) {
|
|
25
|
+
|
|
26
|
+
methodMap_["multiply"] = MethodMetadata {2, __hostFunction_NativeEmbedReactNativeSpecJSI_multiply};
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,50 @@
|
|
|
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: GenerateModuleObjCpp
|
|
8
|
+
*
|
|
9
|
+
* We create an umbrella header (and corresponding implementation) here since
|
|
10
|
+
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
|
11
|
+
* must have a single output. More files => more genrule()s => slower builds.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#ifndef __cplusplus
|
|
15
|
+
#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
// Avoid multiple includes of RNEmbedReactNativeSpec symbols
|
|
19
|
+
#ifndef RNEmbedReactNativeSpec_H
|
|
20
|
+
#define RNEmbedReactNativeSpec_H
|
|
21
|
+
|
|
22
|
+
#import <Foundation/Foundation.h>
|
|
23
|
+
#import <RCTRequired/RCTRequired.h>
|
|
24
|
+
#import <RCTTypeSafety/RCTConvertHelpers.h>
|
|
25
|
+
#import <RCTTypeSafety/RCTTypedModuleConstants.h>
|
|
26
|
+
#import <React/RCTBridgeModule.h>
|
|
27
|
+
#import <React/RCTCxxConvert.h>
|
|
28
|
+
#import <React/RCTManagedPointer.h>
|
|
29
|
+
#import <ReactCommon/RCTTurboModule.h>
|
|
30
|
+
#import <optional>
|
|
31
|
+
#import <vector>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@protocol NativeEmbedReactNativeSpec <RCTBridgeModule, RCTTurboModule>
|
|
35
|
+
|
|
36
|
+
- (NSNumber *)multiply:(double)a
|
|
37
|
+
b:(double)b;
|
|
38
|
+
|
|
39
|
+
@end
|
|
40
|
+
namespace facebook::react {
|
|
41
|
+
/**
|
|
42
|
+
* ObjC++ class for module 'NativeEmbedReactNative'
|
|
43
|
+
*/
|
|
44
|
+
class JSI_EXPORT NativeEmbedReactNativeSpecJSI : public ObjCTurboModule {
|
|
45
|
+
public:
|
|
46
|
+
NativeEmbedReactNativeSpecJSI(const ObjCTurboModule::InitParams ¶ms);
|
|
47
|
+
};
|
|
48
|
+
} // namespace facebook::react
|
|
49
|
+
|
|
50
|
+
#endif // RNEmbedReactNativeSpec_H
|
|
@@ -0,0 +1,28 @@
|
|
|
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 "RNEmbedReactNativeSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
static jsi::Value __hostFunction_NativeEmbedReactNativeCxxSpecJSI_multiply(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
+
return static_cast<NativeEmbedReactNativeCxxSpecJSI *>(&turboModule)->multiply(
|
|
16
|
+
rt,
|
|
17
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber(),
|
|
18
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asNumber()
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
NativeEmbedReactNativeCxxSpecJSI::NativeEmbedReactNativeCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
23
|
+
: TurboModule("EmbedReactNative", jsInvoker) {
|
|
24
|
+
methodMap_["multiply"] = MethodMetadata {2, __hostFunction_NativeEmbedReactNativeCxxSpecJSI_multiply};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,67 @@
|
|
|
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 NativeEmbedReactNativeCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeEmbedReactNativeCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual double multiply(jsi::Runtime &rt, double a, double b) = 0;
|
|
24
|
+
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
template <typename T>
|
|
28
|
+
class JSI_EXPORT NativeEmbedReactNativeCxxSpec : public TurboModule {
|
|
29
|
+
public:
|
|
30
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
31
|
+
return delegate_.get(rt, propName);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static constexpr std::string_view kModuleName = "EmbedReactNative";
|
|
35
|
+
|
|
36
|
+
protected:
|
|
37
|
+
NativeEmbedReactNativeCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
38
|
+
: TurboModule(std::string{NativeEmbedReactNativeCxxSpec::kModuleName}, jsInvoker),
|
|
39
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
private:
|
|
43
|
+
class Delegate : public NativeEmbedReactNativeCxxSpecJSI {
|
|
44
|
+
public:
|
|
45
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
46
|
+
NativeEmbedReactNativeCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
double multiply(jsi::Runtime &rt, double a, double b) override {
|
|
51
|
+
static_assert(
|
|
52
|
+
bridging::getParameterCount(&T::multiply) == 3,
|
|
53
|
+
"Expected multiply(...) to have 3 parameters");
|
|
54
|
+
|
|
55
|
+
return bridging::callFromJs<double>(
|
|
56
|
+
rt, &T::multiply, jsInvoker_, instance_, std::move(a), std::move(b));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
friend class NativeEmbedReactNativeCxxSpec;
|
|
61
|
+
T *instance_;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
Delegate delegate_;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _default = exports.default = _reactNative.TurboModuleRegistry.getEnforcing('EmbedReactNative');
|
|
9
|
+
//# sourceMappingURL=NativeEmbedReactNative.js.map
|