1 // Copyright © 2021-present 650 Industries, Inc. (aka Expo) 2 3 #pragma once 4 5 #include <fbjni/fbjni.h> 6 #include <react/jni/ReadableNativeArray.h> 7 8 namespace jni = facebook::jni; 9 namespace react = facebook::react; 10 11 namespace expo { 12 /** 13 * A CPP part of the expo.modules.kotlin.jni.JNIFunctionBody class. 14 * It represents the Kotlin's promise-less function. 15 */ 16 class JNIFunctionBody : public jni::JavaClass<JNIFunctionBody> { 17 public: 18 static auto constexpr kJavaDescriptor = "Lexpo/modules/kotlin/jni/JNIFunctionBody;"; 19 20 /** 21 * Invokes a Kotlin's implementation of this function. 22 * 23 * @param args 24 * @return result of the Kotlin function 25 */ 26 jni::local_ref<jni::JObject> invoke( 27 jobjectArray args 28 ); 29 }; 30 31 /** 32 * A CPP part of the expo.modules.kotlin.jni.JNIAsyncFunctionBody class. 33 * It represents the Kotlin's promise function. 34 */ 35 class JNIAsyncFunctionBody : public jni::JavaClass<JNIAsyncFunctionBody> { 36 public: 37 static auto constexpr kJavaDescriptor = "Lexpo/modules/kotlin/jni/JNIAsyncFunctionBody;"; 38 39 /** 40 * Invokes a Kotlin's implementation of this async function. 41 * 42 * @param args 43 * @param promise that will be resolve or rejected in the Kotlin's implementation 44 */ 45 void invoke( 46 jobjectArray args, 47 jobject promise 48 ); 49 }; 50 } // namespace expo 51