-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathcpp-adapter.cpp
More file actions
43 lines (37 loc) · 1.6 KB
/
cpp-adapter.cpp
File metadata and controls
43 lines (37 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Generated by uniffi-bindgen-react-native
#include <jni.h>
#include <jsi/jsi.h>
#include <ReactCommon/CallInvokerHolder.h>
#include "unomed-react-native-matrix-sdk.h"
namespace jsi = facebook::jsi;
namespace react = facebook::react;
// Automated testing checks Java_com_unomed_reactnativematrixsdk_ReactNativeMatrixSdkModule and unomed_reactnativematrixsdk
// by comparing the whole line here.
/*
Java_com_unomed_reactnativematrixsdk_ReactNativeMatrixSdkModule_nativeMultiply(JNIEnv *env, jclass type, jdouble a, jdouble b) {
return unomed_reactnativematrixsdk::multiply(a, b);
}
*/
// Installer coming from ReactNativeMatrixSdkModule
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_unomed_reactnativematrixsdk_ReactNativeMatrixSdkModule_nativeInstallRustCrate(
JNIEnv *env,
jclass type,
jlong rtPtr,
jobject callInvokerHolderJavaObj
) {
using JCallInvokerHolder = facebook::react::CallInvokerHolder;
auto holderLocal = facebook::jni::make_local(callInvokerHolderJavaObj);
auto holderRef = facebook::jni::static_ref_cast<JCallInvokerHolder::javaobject>(holderLocal);
auto* holderCxx = holderRef->cthis();
auto jsCallInvoker = holderCxx->getCallInvoker();
auto runtime = reinterpret_cast<jsi::Runtime *>(rtPtr);
return unomed_reactnativematrixsdk::installRustCrate(*runtime, jsCallInvoker);
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_com_unomed_reactnativematrixsdk_ReactNativeMatrixSdkModule_nativeCleanupRustCrate(JNIEnv *env, jclass type, jlong rtPtr) {
auto runtime = reinterpret_cast<jsi::Runtime *>(rtPtr);
return unomed_reactnativematrixsdk::cleanupRustCrate(*runtime);
}