-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* perf: Only enable `-O2` in release, use `-O0` in debug * Also disable for Image and Template * Switch flags around * fix: Disable minification * fix: Slap a good 'ol `mutex` on `Promise` * fix: Use `emplace_back` on Android * feat: Add `JUnit` to pass instead of nullptr * fix: Use `java.lang.Object` for `JUnit` * fix: Use `java.lang.Object?` for param * fix: It builds now. * fix: Fix lambda now * Restructure
- Loading branch information
Showing
8 changed files
with
116 additions
and
31 deletions.
There are no files selected for viewing
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 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 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 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 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
38 changes: 38 additions & 0 deletions
38
packages/react-native-nitro-modules/android/src/main/cpp/utils/JUnit.hpp
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// JUnit.hpp | ||
// react-native-nitro | ||
// | ||
// Created by Marc Rousavy on 19.11.24. | ||
// | ||
|
||
#pragma once | ||
|
||
#include "NitroLogger.hpp" | ||
#include <fbjni/fbjni.h> | ||
|
||
namespace margelo::nitro { | ||
|
||
using namespace facebook; | ||
|
||
/** | ||
* Represents a `Unit` from Kotlin. | ||
* This is similar to `void` for Java, but is actually an `Object`. | ||
*/ | ||
class JUnit final { | ||
public: | ||
/** | ||
* Gets the shared instance to `Unit`. This is always a static global. | ||
*/ | ||
static jni::alias_ref<jni::JObject> instance() { | ||
static jni::global_ref<jni::JObject> sharedInstance = nullptr; | ||
if (sharedInstance == nullptr) { | ||
jni::alias_ref<jni::JClass> clazz = jni::findClassStatic("java/lang/Object"); | ||
jni::JConstructor<jobject()> constructor = clazz->getConstructor<jobject()>(); | ||
jni::local_ref<jobject> instance = clazz->newObject(constructor); | ||
sharedInstance = jni::make_global(instance); | ||
} | ||
return sharedInstance; | ||
} | ||
}; | ||
|
||
} // namespace margelo::nitro |
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 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