diff --git a/packages/npm/send/android/CMakeLists.txt b/packages/npm/send/android/CMakeLists.txt index 501b954..8fe12f7 100644 --- a/packages/npm/send/android/CMakeLists.txt +++ b/packages/npm/send/android/CMakeLists.txt @@ -1,15 +1,29 @@ -cmake_minimum_required(VERSION 3.4.1) -project(Send) +project(send) +cmake_minimum_required(VERSION 3.9.0) +set (PACKAGE_NAME send) set (CMAKE_VERBOSE_MAKEFILE ON) -set (CMAKE_CXX_STANDARD 14) +set (CMAKE_CXX_STANDARD 20) -add_library(candlefinance-send SHARED - ../cpp/candlefinance-send.cpp - cpp-adapter.cpp +# Define C++ library and add all sources +add_library(${PACKAGE_NAME} SHARED + src/main/cpp/cpp-adapter.cpp ) -# Specifies a path to native header files. +# Add Nitrogen specs :) +include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/send+autolinking.cmake) + +# Set up local includes include_directories( - ../cpp + "src/main/cpp" + "../cpp" ) + +find_library(LOG_LIB log) + +# Link all libraries together +target_link_libraries( + ${PACKAGE_NAME} + ${LOG_LIB} + android # <-- Android core +) \ No newline at end of file diff --git a/packages/npm/send/android/build.gradle b/packages/npm/send/android/build.gradle index 9c2be94..34656ee 100644 --- a/packages/npm/send/android/build.gradle +++ b/packages/npm/send/android/build.gradle @@ -25,6 +25,7 @@ def isNewArchitectureEnabled() { apply plugin: "com.android.library" apply plugin: "kotlin-android" +apply from: '../nitrogen/generated/android/send+autolinking.gradle' if (isNewArchitectureEnabled()) { apply plugin: "com.facebook.react" @@ -124,6 +125,7 @@ dependencies { //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation project(":react-native-nitro-modules") } if (isNewArchitectureEnabled()) { diff --git a/packages/npm/send/android/src/main/java/com/candlefinance/send/SendModule.kt b/packages/npm/send/android/src/main/java/com/candlefinance/send/SendModule.kt index 5d70e24..d8b8ef0 100644 --- a/packages/npm/send/android/src/main/java/com/candlefinance/send/SendModule.kt +++ b/packages/npm/send/android/src/main/java/com/candlefinance/send/SendModule.kt @@ -1,18 +1,15 @@ package com.candlefinance.send -import com.facebook.react.bridge.Promise -import com.facebook.react.bridge.ReactApplicationContext -import com.facebook.react.module.annotations.ReactModule +import com.margelo.nitro.candlefinance_send.HybridSendSpec +import com.margelo.nitro.candlefinance_send.Request +import com.margelo.nitro.candlefinance_send.SendResult -@ReactModule(name = SendModule.NAME) -class SendModule(reactContext: ReactApplicationContext) : - NativeSendSpec(reactContext) { +class SendModule(): HybridSendSpec() { - override fun getName(): String { - return NAME - } + override val memorySize: Long + get() = 0 - override fun send(request: String?, promise: Promise?) { + override fun send(request: Request): com.margelo.nitro.core.Promise { TODO("Not yet implemented") } diff --git a/packages/npm/send/android/src/main/java/com/candlefinance/send/SendPackage.kt b/packages/npm/send/android/src/main/java/com/candlefinance/send/SendPackage.kt index a12ccea..92fd9e0 100644 --- a/packages/npm/send/android/src/main/java/com/candlefinance/send/SendPackage.kt +++ b/packages/npm/send/android/src/main/java/com/candlefinance/send/SendPackage.kt @@ -9,25 +9,21 @@ import java.util.HashMap class SendPackage : TurboReactPackage() { override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? { - return if (name == SendModule.NAME) { - SendModule(reactContext) - } else { - null - } + return null } override fun getReactModuleInfoProvider(): ReactModuleInfoProvider { return ReactModuleInfoProvider { val moduleInfos: MutableMap = HashMap() - moduleInfos[SendModule.NAME] = ReactModuleInfo( - SendModule.NAME, - SendModule.NAME, - false, // canOverrideExistingModule - false, // needsEagerInit - true, // hasConstants - false, // isCxxModule - true // isTurboModule - ) +// moduleInfos[SendModule.NAME] = ReactModuleInfo( +// SendModule.NAME, +// SendModule.NAME, +// false, // canOverrideExistingModule +// false, // needsEagerInit +// true, // hasConstants +// false, // isCxxModule +// true // isTurboModule +// ) moduleInfos } }