Skip to content

Commit

Permalink
fix: get android to compile
Browse files Browse the repository at this point in the history
  • Loading branch information
gtokman committed Aug 30, 2024
1 parent a4714d6 commit de4bbce
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 32 deletions.
30 changes: 22 additions & 8 deletions packages/npm/send/android/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
)
2 changes: 2 additions & 0 deletions packages/npm/send/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<SendResult> {
TODO("Not yet implemented")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, ReactModuleInfo> = 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
}
}
Expand Down

0 comments on commit de4bbce

Please sign in to comment.