mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-05 13:46:59 +00:00
57 lines
1.8 KiB
C++
Generated
57 lines
1.8 KiB
C++
Generated
///
|
|
/// OmniOnLoad.cpp
|
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
/// https://github.com/mrousavy/nitro
|
|
/// Copyright © Marc Rousavy @ Margelo
|
|
///
|
|
|
|
#ifndef BUILDING_OMNI_WITH_GENERATED_CMAKE_PROJECT
|
|
#error OmniOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
|
|
#endif
|
|
|
|
#include "OmniOnLoad.hpp"
|
|
|
|
#include <jni.h>
|
|
#include <fbjni/fbjni.h>
|
|
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
|
|
#include "JHybridOmniSpec.hpp"
|
|
#include "views/JHybridOmniStateUpdater.hpp"
|
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
|
|
namespace margelo::nitro::omni {
|
|
|
|
int initialize(JavaVM* vm) {
|
|
return facebook::jni::initialize(vm, []() {
|
|
::margelo::nitro::omni::registerAllNatives();
|
|
});
|
|
}
|
|
|
|
struct JHybridOmniSpecImpl: public jni::JavaClass<JHybridOmniSpecImpl, JHybridOmniSpec::JavaPart> {
|
|
static constexpr auto kJavaDescriptor = "Ldev/zoriya/omni/HybridOmni;";
|
|
static std::shared_ptr<JHybridOmniSpec> create() {
|
|
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridOmniSpecImpl::javaobject()>();
|
|
jni::local_ref<JHybridOmniSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
return javaPart->getJHybridOmniSpec();
|
|
}
|
|
};
|
|
|
|
void registerAllNatives() {
|
|
using namespace margelo::nitro;
|
|
using namespace margelo::nitro::omni;
|
|
|
|
// Register native JNI methods
|
|
margelo::nitro::omni::JHybridOmniSpec::CxxPart::registerNatives();
|
|
margelo::nitro::omni::views::JHybridOmniStateUpdater::registerNatives();
|
|
|
|
// Register Nitro Hybrid Objects
|
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
"Omni",
|
|
[]() -> std::shared_ptr<HybridObject> {
|
|
return JHybridOmniSpecImpl::create();
|
|
}
|
|
);
|
|
}
|
|
|
|
} // namespace margelo::nitro::omni
|