forked from margelo/react-native-quick-crypto
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
44 additions
and
35 deletions.
There are no files selected for viewing
38 changes: 27 additions & 11 deletions
38
packages/react-native-quick-crypto/android/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,44 @@ | ||
project(QuickCrypto) | ||
cmake_minimum_required(VERSION 3.9.0) | ||
|
||
project(QuickCrypto) | ||
set(PACKAGE_NAME QuickCrypto) | ||
|
||
set(CMAKE_VERBOSE_MAKEFILE ON) | ||
set(CMAKE_CXX_STANDARD 20) | ||
|
||
# Add Nitrogen specs :) | ||
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/QuickCrypto+autolinking.cmake) | ||
|
||
# Third party libraries (Prefabs) | ||
find_library(LOG_LIB log) | ||
find_library(REACT_NATIVE_SCREENS_LIB rnscreens) | ||
|
||
# Define C++ library and add all sources | ||
add_library( | ||
${PACKAGE_NAME} SHARED | ||
src/main/cpp/cpp-adapter.cpp | ||
../cpp/HybridRandom.cpp | ||
../cpp/random/HybridRandom.cpp | ||
) | ||
|
||
include_directories(../cpp) | ||
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/QuickCrypto+autolinking.cmake) | ||
|
||
# Third party libraries (Prefabs) | ||
find_library(LOG_LIB log) | ||
|
||
find_package(ReactAndroid REQUIRED CONFIG) | ||
find_package(fbjni REQUIRED CONFIG) | ||
find_package(openssl REQUIRED CONFIG) | ||
|
||
# Link all libraries together | ||
target_link_libraries( | ||
${PACKAGE_NAME} | ||
${LOG_LIB} # <-- Logcat logger | ||
${REACT_NATIVE_SCREENS_LIB} # <-- React Native Screens | ||
android # <-- Android core | ||
) | ||
fbjni::fbjni # <-- Facebook C++ JNI helpers | ||
openssl::crypto # <-- OpenSSL (Crypto) | ||
ReactAndroid::jsi | ||
ReactAndroid::turbomodulejsijni | ||
ReactAndroid::react_nativemodule_core | ||
ReactAndroid::react_render_core | ||
ReactAndroid::runtimeexecutor | ||
ReactAndroid::fabricjni | ||
ReactAndroid::react_debug | ||
ReactAndroid::react_render_core | ||
ReactAndroid::react_render_componentregistry | ||
ReactAndroid::rrc_view | ||
ReactAndroid::folly_runtime | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
packages/react-native-quick-crypto/android/src/main/cpp/cpp-adapter.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 13 additions & 14 deletions
27
...o/quickcrypto/QuickCryptoPackage.not-used → ...nitro/quickcrypto/QuickCryptoPackage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,38 @@ | ||
package com.margelo.nitro.quickcrypto; | ||
|
||
import android.util.Log; | ||
|
||
import androidx.annotation.Nullable; | ||
|
||
import com.facebook.react.bridge.NativeModule; | ||
import com.facebook.react.bridge.ReactApplicationContext; | ||
import com.facebook.react.module.model.ReactModuleInfoProvider; | ||
import com.facebook.react.TurboReactPackage; | ||
import com.margelo.nitro.HybridObject; | ||
import com.margelo.nitro.HybridObjectRegistry; | ||
|
||
import java.util.HashMap; | ||
import java.util.function.Supplier; | ||
|
||
public class QuickCryptoPackage extends TurboReactPackage { | ||
private static final String TAG = "QuickCrypto"; | ||
static { | ||
try { | ||
Log.i(TAG, "Loading C++ library..."); | ||
System.loadLibrary(TAG); | ||
Log.i(TAG, "Successfully loaded C++ library!"); | ||
} catch (Throwable e) { | ||
Log.e(TAG, "Failed to load C++ library! Is it properly installed and linked?", e); | ||
throw e; | ||
} | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public NativeModule getModule(String name, ReactApplicationContext reactContext) { | ||
return null; | ||
} | ||
|
||
public QuickCryptoPackage() { | ||
HybridObjectRegistry.registerHybridObjectConstructor("HybridRandom", () -> { | ||
Log.i("YEET", "initializing Random..."); | ||
HybridObject obj = new HybridObject(new Random()); | ||
Log.i("YEET", "done Random!"); | ||
return f; | ||
}); | ||
} | ||
|
||
@Override | ||
public ReactModuleInfoProvider getReactModuleInfoProvider() { | ||
return () -> { | ||
return new HashMap<>(); | ||
return new HashMap<>(); | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters