cactus-react-native 1.4.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cactus.podspec +1 -1
- package/README.md +465 -174
- package/android/CMakeLists.txt +24 -5
- package/android/src/main/jniLibs/arm64-v8a/libcactus.a +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcurl.a +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libmbedcrypto.a +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libmbedtls.a +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libmbedx509.a +0 -0
- package/cpp/HybridCactus.cpp +157 -6
- package/cpp/HybridCactus.hpp +20 -3
- package/cpp/cactus_ffi.h +65 -30
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus.h +0 -1
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_ffi.h +65 -30
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_utils.h +357 -122
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/engine.h +184 -63
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/gemma_tools.h +549 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/graph.h +153 -27
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel.h +90 -178
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel_utils.h +276 -151
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus.h +0 -1
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_ffi.h +65 -30
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_utils.h +357 -122
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/engine.h +184 -63
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/gemma_tools.h +549 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/graph.h +153 -27
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel.h +90 -178
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel_utils.h +276 -151
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/cactus +0 -0
- package/lib/module/classes/CactusLM.js +43 -58
- package/lib/module/classes/CactusLM.js.map +1 -1
- package/lib/module/classes/CactusSTT.js +64 -38
- package/lib/module/classes/CactusSTT.js.map +1 -1
- package/lib/module/classes/CactusVAD.js +95 -0
- package/lib/module/classes/CactusVAD.js.map +1 -0
- package/lib/module/hooks/useCactusLM.js +23 -15
- package/lib/module/hooks/useCactusLM.js.map +1 -1
- package/lib/module/hooks/useCactusSTT.js +85 -28
- package/lib/module/hooks/useCactusSTT.js.map +1 -1
- package/lib/module/hooks/useCactusVAD.js +171 -0
- package/lib/module/hooks/useCactusVAD.js.map +1 -0
- package/lib/module/index.js +2 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/modelRegistry.js +52 -0
- package/lib/module/modelRegistry.js.map +1 -0
- package/lib/module/native/Cactus.js +107 -8
- package/lib/module/native/Cactus.js.map +1 -1
- package/lib/module/native/CactusIndex.js.map +1 -1
- package/lib/module/native/index.js +0 -3
- package/lib/module/native/index.js.map +1 -1
- package/lib/module/types/CactusLM.js +2 -0
- package/lib/module/types/CactusSTT.js +2 -0
- package/lib/module/types/CactusVAD.js +4 -0
- package/lib/module/types/{CactusModel.js.map → CactusVAD.js.map} +1 -1
- package/lib/module/types/common.js +2 -0
- package/lib/module/types/{CactusSTTModel.js.map → common.js.map} +1 -1
- package/lib/typescript/src/classes/CactusLM.d.ts +8 -6
- package/lib/typescript/src/classes/CactusLM.d.ts.map +1 -1
- package/lib/typescript/src/classes/CactusSTT.d.ts +11 -6
- package/lib/typescript/src/classes/CactusSTT.d.ts.map +1 -1
- package/lib/typescript/src/classes/CactusVAD.d.ts +20 -0
- package/lib/typescript/src/classes/CactusVAD.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCactusLM.d.ts +3 -3
- package/lib/typescript/src/hooks/useCactusLM.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useCactusSTT.d.ts +11 -5
- package/lib/typescript/src/hooks/useCactusSTT.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useCactusVAD.d.ts +15 -0
- package/lib/typescript/src/hooks/useCactusVAD.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +7 -6
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/modelRegistry.d.ts +5 -0
- package/lib/typescript/src/modelRegistry.d.ts.map +1 -0
- package/lib/typescript/src/native/Cactus.d.ts +12 -6
- package/lib/typescript/src/native/Cactus.d.ts.map +1 -1
- package/lib/typescript/src/native/CactusIndex.d.ts +2 -2
- package/lib/typescript/src/native/CactusIndex.d.ts.map +1 -1
- package/lib/typescript/src/native/index.d.ts +0 -3
- package/lib/typescript/src/native/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/Cactus.nitro.d.ts +6 -1
- package/lib/typescript/src/specs/Cactus.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusIndex.d.ts +2 -2
- package/lib/typescript/src/types/CactusIndex.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusLM.d.ts +19 -9
- package/lib/typescript/src/types/CactusLM.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusSTT.d.ts +45 -4
- package/lib/typescript/src/types/CactusSTT.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusVAD.d.ts +34 -0
- package/lib/typescript/src/types/CactusVAD.d.ts.map +1 -0
- package/lib/typescript/src/types/common.d.ts +23 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -0
- package/nitro.json +0 -11
- package/nitrogen/generated/android/cactus+autolinking.cmake +0 -5
- package/nitrogen/generated/android/cactusOnLoad.cpp +0 -30
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.cpp +0 -50
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.hpp +9 -147
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Umbrella.hpp +0 -13
- package/nitrogen/generated/ios/CactusAutolinking.mm +0 -26
- package/nitrogen/generated/ios/CactusAutolinking.swift +0 -30
- package/nitrogen/generated/shared/c++/HybridCactusSpec.cpp +5 -0
- package/nitrogen/generated/shared/c++/HybridCactusSpec.hpp +6 -1
- package/package.json +3 -3
- package/src/classes/CactusLM.ts +59 -74
- package/src/classes/CactusSTT.ts +92 -49
- package/src/classes/CactusVAD.ts +129 -0
- package/src/hooks/useCactusLM.ts +26 -9
- package/src/hooks/useCactusSTT.ts +105 -44
- package/src/hooks/useCactusVAD.ts +215 -0
- package/src/index.tsx +20 -10
- package/src/modelRegistry.ts +65 -0
- package/src/native/Cactus.ts +130 -14
- package/src/native/CactusIndex.ts +2 -2
- package/src/native/index.ts +0 -3
- package/src/specs/Cactus.nitro.ts +11 -2
- package/src/types/CactusIndex.ts +2 -2
- package/src/types/CactusLM.ts +20 -9
- package/src/types/CactusSTT.ts +50 -4
- package/src/types/CactusVAD.ts +39 -0
- package/src/types/common.ts +23 -0
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusCrypto.kt +0 -46
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusDeviceInfo.kt +0 -27
- package/android/src/main/jniLibs/arm64-v8a/libcactus_util.a +0 -0
- package/cpp/HybridCactusUtil.cpp +0 -47
- package/cpp/HybridCactusUtil.hpp +0 -27
- package/cpp/cactus_util.h +0 -25
- package/ios/HybridCactusCrypto.swift +0 -37
- package/ios/HybridCactusDeviceInfo.swift +0 -32
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_telemetry.h +0 -656
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_telemetry.h +0 -656
- package/ios/cactus_util.xcframework/Info.plist +0 -39
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/cactus_util.h +0 -25
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/database.h +0 -27
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/ios_utils.h +0 -10
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/logging.h +0 -25
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Info.plist +0 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/cactus_util +0 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/cactus_util.h +0 -25
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/database.h +0 -27
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/ios_utils.h +0 -10
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/logging.h +0 -25
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Info.plist +0 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/_CodeSignature/CodeResources +0 -135
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/cactus_util +0 -0
- package/lib/module/api/Database.js +0 -137
- package/lib/module/api/Database.js.map +0 -1
- package/lib/module/api/RemoteLM.js +0 -201
- package/lib/module/api/RemoteLM.js.map +0 -1
- package/lib/module/config/CactusConfig.js +0 -12
- package/lib/module/config/CactusConfig.js.map +0 -1
- package/lib/module/native/CactusCrypto.js +0 -10
- package/lib/module/native/CactusCrypto.js.map +0 -1
- package/lib/module/native/CactusDeviceInfo.js +0 -13
- package/lib/module/native/CactusDeviceInfo.js.map +0 -1
- package/lib/module/native/CactusUtil.js +0 -36
- package/lib/module/native/CactusUtil.js.map +0 -1
- package/lib/module/specs/CactusCrypto.nitro.js +0 -4
- package/lib/module/specs/CactusCrypto.nitro.js.map +0 -1
- package/lib/module/specs/CactusDeviceInfo.nitro.js +0 -4
- package/lib/module/specs/CactusDeviceInfo.nitro.js.map +0 -1
- package/lib/module/specs/CactusUtil.nitro.js +0 -4
- package/lib/module/specs/CactusUtil.nitro.js.map +0 -1
- package/lib/module/telemetry/Telemetry.js +0 -154
- package/lib/module/telemetry/Telemetry.js.map +0 -1
- package/lib/module/types/CactusModel.js +0 -2
- package/lib/module/types/CactusSTTModel.js +0 -2
- package/lib/typescript/src/api/Database.d.ts +0 -18
- package/lib/typescript/src/api/Database.d.ts.map +0 -1
- package/lib/typescript/src/api/RemoteLM.d.ts +0 -14
- package/lib/typescript/src/api/RemoteLM.d.ts.map +0 -1
- package/lib/typescript/src/config/CactusConfig.d.ts +0 -7
- package/lib/typescript/src/config/CactusConfig.d.ts.map +0 -1
- package/lib/typescript/src/native/CactusCrypto.d.ts +0 -5
- package/lib/typescript/src/native/CactusCrypto.d.ts.map +0 -1
- package/lib/typescript/src/native/CactusDeviceInfo.d.ts +0 -7
- package/lib/typescript/src/native/CactusDeviceInfo.d.ts.map +0 -1
- package/lib/typescript/src/native/CactusUtil.d.ts +0 -6
- package/lib/typescript/src/native/CactusUtil.d.ts.map +0 -1
- package/lib/typescript/src/specs/CactusCrypto.nitro.d.ts +0 -8
- package/lib/typescript/src/specs/CactusCrypto.nitro.d.ts.map +0 -1
- package/lib/typescript/src/specs/CactusDeviceInfo.nitro.d.ts +0 -16
- package/lib/typescript/src/specs/CactusDeviceInfo.nitro.d.ts.map +0 -1
- package/lib/typescript/src/specs/CactusUtil.nitro.d.ts +0 -10
- package/lib/typescript/src/specs/CactusUtil.nitro.d.ts.map +0 -1
- package/lib/typescript/src/telemetry/Telemetry.d.ts +0 -34
- package/lib/typescript/src/telemetry/Telemetry.d.ts.map +0 -1
- package/lib/typescript/src/types/CactusModel.d.ts +0 -13
- package/lib/typescript/src/types/CactusModel.d.ts.map +0 -1
- package/lib/typescript/src/types/CactusSTTModel.d.ts +0 -8
- package/lib/typescript/src/types/CactusSTTModel.d.ts.map +0 -1
- package/nitrogen/generated/android/c++/JDeviceInfo.hpp +0 -74
- package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.cpp +0 -65
- package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.hpp +0 -65
- package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.cpp +0 -85
- package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.hpp +0 -66
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/DeviceInfo.kt +0 -50
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusCryptoSpec.kt +0 -58
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusDeviceInfoSpec.kt +0 -62
- package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.hpp +0 -77
- package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.hpp +0 -88
- package/nitrogen/generated/ios/swift/DeviceInfo.swift +0 -98
- package/nitrogen/generated/ios/swift/Func_void_DeviceInfo.swift +0 -47
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +0 -54
- package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec.swift +0 -57
- package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec_cxx.swift +0 -139
- package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec.swift +0 -58
- package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec_cxx.swift +0 -164
- package/nitrogen/generated/shared/c++/DeviceInfo.hpp +0 -92
- package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.cpp +0 -21
- package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.hpp +0 -63
- package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.cpp +0 -22
- package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.hpp +0 -67
- package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.cpp +0 -23
- package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.hpp +0 -66
- package/src/api/Database.ts +0 -188
- package/src/api/RemoteLM.ts +0 -273
- package/src/config/CactusConfig.ts +0 -11
- package/src/native/CactusCrypto.ts +0 -11
- package/src/native/CactusDeviceInfo.ts +0 -18
- package/src/native/CactusUtil.ts +0 -43
- package/src/specs/CactusCrypto.nitro.ts +0 -6
- package/src/specs/CactusDeviceInfo.nitro.ts +0 -15
- package/src/specs/CactusUtil.nitro.ts +0 -8
- package/src/telemetry/Telemetry.ts +0 -236
- package/src/types/CactusModel.ts +0 -15
- package/src/types/CactusSTTModel.ts +0 -10
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JHybridCactusCryptoSpec.cpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#include "JHybridCactusCryptoSpec.hpp"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
#include <string>
|
|
13
|
-
#include <NitroModules/Promise.hpp>
|
|
14
|
-
#include <NitroModules/JPromise.hpp>
|
|
15
|
-
|
|
16
|
-
namespace margelo::nitro::cactus {
|
|
17
|
-
|
|
18
|
-
jni::local_ref<JHybridCactusCryptoSpec::jhybriddata> JHybridCactusCryptoSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
19
|
-
return makeCxxInstance(jThis);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
void JHybridCactusCryptoSpec::registerNatives() {
|
|
23
|
-
registerHybrid({
|
|
24
|
-
makeNativeMethod("initHybrid", JHybridCactusCryptoSpec::initHybrid),
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
size_t JHybridCactusCryptoSpec::getExternalMemorySize() noexcept {
|
|
29
|
-
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
|
|
30
|
-
return method(_javaPart);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
void JHybridCactusCryptoSpec::dispose() noexcept {
|
|
34
|
-
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
35
|
-
method(_javaPart);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
std::string JHybridCactusCryptoSpec::toString() {
|
|
39
|
-
static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
|
|
40
|
-
auto javaString = method(_javaPart);
|
|
41
|
-
return javaString->toStdString();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Properties
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// Methods
|
|
48
|
-
std::shared_ptr<Promise<std::string>> JHybridCactusCryptoSpec::uuidv5(const std::string& namespaceUuid, const std::string& name) {
|
|
49
|
-
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* namespaceUuid */, jni::alias_ref<jni::JString> /* name */)>("uuidv5");
|
|
50
|
-
auto __result = method(_javaPart, jni::make_jstring(namespaceUuid), jni::make_jstring(name));
|
|
51
|
-
return [&]() {
|
|
52
|
-
auto __promise = Promise<std::string>::create();
|
|
53
|
-
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
54
|
-
auto __result = jni::static_ref_cast<jni::JString>(__boxedResult);
|
|
55
|
-
__promise->resolve(__result->toStdString());
|
|
56
|
-
});
|
|
57
|
-
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
58
|
-
jni::JniException __jniError(__throwable);
|
|
59
|
-
__promise->reject(std::make_exception_ptr(__jniError));
|
|
60
|
-
});
|
|
61
|
-
return __promise;
|
|
62
|
-
}();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
} // namespace margelo::nitro::cactus
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridCactusCryptoSpec.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#include <NitroModules/JHybridObject.hpp>
|
|
11
|
-
#include <fbjni/fbjni.h>
|
|
12
|
-
#include "HybridCactusCryptoSpec.hpp"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
namespace margelo::nitro::cactus {
|
|
18
|
-
|
|
19
|
-
using namespace facebook;
|
|
20
|
-
|
|
21
|
-
class JHybridCactusCryptoSpec: public jni::HybridClass<JHybridCactusCryptoSpec, JHybridObject>,
|
|
22
|
-
public virtual HybridCactusCryptoSpec {
|
|
23
|
-
public:
|
|
24
|
-
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/cactus/HybridCactusCryptoSpec;";
|
|
25
|
-
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
26
|
-
static void registerNatives();
|
|
27
|
-
|
|
28
|
-
protected:
|
|
29
|
-
// C++ constructor (called from Java via `initHybrid()`)
|
|
30
|
-
explicit JHybridCactusCryptoSpec(jni::alias_ref<jhybridobject> jThis) :
|
|
31
|
-
HybridObject(HybridCactusCryptoSpec::TAG),
|
|
32
|
-
HybridBase(jThis),
|
|
33
|
-
_javaPart(jni::make_global(jThis)) {}
|
|
34
|
-
|
|
35
|
-
public:
|
|
36
|
-
~JHybridCactusCryptoSpec() override {
|
|
37
|
-
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
38
|
-
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public:
|
|
42
|
-
size_t getExternalMemorySize() noexcept override;
|
|
43
|
-
void dispose() noexcept override;
|
|
44
|
-
std::string toString() override;
|
|
45
|
-
|
|
46
|
-
public:
|
|
47
|
-
inline const jni::global_ref<JHybridCactusCryptoSpec::javaobject>& getJavaPart() const noexcept {
|
|
48
|
-
return _javaPart;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public:
|
|
52
|
-
// Properties
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
public:
|
|
56
|
-
// Methods
|
|
57
|
-
std::shared_ptr<Promise<std::string>> uuidv5(const std::string& namespaceUuid, const std::string& name) override;
|
|
58
|
-
|
|
59
|
-
private:
|
|
60
|
-
friend HybridBase;
|
|
61
|
-
using HybridBase::HybridBase;
|
|
62
|
-
jni::global_ref<JHybridCactusCryptoSpec::javaobject> _javaPart;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
} // namespace margelo::nitro::cactus
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JHybridCactusDeviceInfoSpec.cpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#include "JHybridCactusDeviceInfoSpec.hpp"
|
|
9
|
-
|
|
10
|
-
// Forward declaration of `DeviceInfo` to properly resolve imports.
|
|
11
|
-
namespace margelo::nitro::cactus { struct DeviceInfo; }
|
|
12
|
-
|
|
13
|
-
#include <string>
|
|
14
|
-
#include <optional>
|
|
15
|
-
#include <NitroModules/Promise.hpp>
|
|
16
|
-
#include <NitroModules/JPromise.hpp>
|
|
17
|
-
#include "DeviceInfo.hpp"
|
|
18
|
-
#include "JDeviceInfo.hpp"
|
|
19
|
-
|
|
20
|
-
namespace margelo::nitro::cactus {
|
|
21
|
-
|
|
22
|
-
jni::local_ref<JHybridCactusDeviceInfoSpec::jhybriddata> JHybridCactusDeviceInfoSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
23
|
-
return makeCxxInstance(jThis);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
void JHybridCactusDeviceInfoSpec::registerNatives() {
|
|
27
|
-
registerHybrid({
|
|
28
|
-
makeNativeMethod("initHybrid", JHybridCactusDeviceInfoSpec::initHybrid),
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
size_t JHybridCactusDeviceInfoSpec::getExternalMemorySize() noexcept {
|
|
33
|
-
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
|
|
34
|
-
return method(_javaPart);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
void JHybridCactusDeviceInfoSpec::dispose() noexcept {
|
|
38
|
-
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
39
|
-
method(_javaPart);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
std::string JHybridCactusDeviceInfoSpec::toString() {
|
|
43
|
-
static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
|
|
44
|
-
auto javaString = method(_javaPart);
|
|
45
|
-
return javaString->toStdString();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Properties
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// Methods
|
|
52
|
-
std::shared_ptr<Promise<std::optional<std::string>>> JHybridCactusDeviceInfoSpec::getAppIdentifier() {
|
|
53
|
-
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getAppIdentifier");
|
|
54
|
-
auto __result = method(_javaPart);
|
|
55
|
-
return [&]() {
|
|
56
|
-
auto __promise = Promise<std::optional<std::string>>::create();
|
|
57
|
-
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
58
|
-
auto __result = jni::static_ref_cast<jni::JString>(__boxedResult);
|
|
59
|
-
__promise->resolve(__result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt);
|
|
60
|
-
});
|
|
61
|
-
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
62
|
-
jni::JniException __jniError(__throwable);
|
|
63
|
-
__promise->reject(std::make_exception_ptr(__jniError));
|
|
64
|
-
});
|
|
65
|
-
return __promise;
|
|
66
|
-
}();
|
|
67
|
-
}
|
|
68
|
-
std::shared_ptr<Promise<DeviceInfo>> JHybridCactusDeviceInfoSpec::getDeviceInfo() {
|
|
69
|
-
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getDeviceInfo");
|
|
70
|
-
auto __result = method(_javaPart);
|
|
71
|
-
return [&]() {
|
|
72
|
-
auto __promise = Promise<DeviceInfo>::create();
|
|
73
|
-
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
74
|
-
auto __result = jni::static_ref_cast<JDeviceInfo>(__boxedResult);
|
|
75
|
-
__promise->resolve(__result->toCpp());
|
|
76
|
-
});
|
|
77
|
-
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
78
|
-
jni::JniException __jniError(__throwable);
|
|
79
|
-
__promise->reject(std::make_exception_ptr(__jniError));
|
|
80
|
-
});
|
|
81
|
-
return __promise;
|
|
82
|
-
}();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
} // namespace margelo::nitro::cactus
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridCactusDeviceInfoSpec.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#include <NitroModules/JHybridObject.hpp>
|
|
11
|
-
#include <fbjni/fbjni.h>
|
|
12
|
-
#include "HybridCactusDeviceInfoSpec.hpp"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
namespace margelo::nitro::cactus {
|
|
18
|
-
|
|
19
|
-
using namespace facebook;
|
|
20
|
-
|
|
21
|
-
class JHybridCactusDeviceInfoSpec: public jni::HybridClass<JHybridCactusDeviceInfoSpec, JHybridObject>,
|
|
22
|
-
public virtual HybridCactusDeviceInfoSpec {
|
|
23
|
-
public:
|
|
24
|
-
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/cactus/HybridCactusDeviceInfoSpec;";
|
|
25
|
-
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
26
|
-
static void registerNatives();
|
|
27
|
-
|
|
28
|
-
protected:
|
|
29
|
-
// C++ constructor (called from Java via `initHybrid()`)
|
|
30
|
-
explicit JHybridCactusDeviceInfoSpec(jni::alias_ref<jhybridobject> jThis) :
|
|
31
|
-
HybridObject(HybridCactusDeviceInfoSpec::TAG),
|
|
32
|
-
HybridBase(jThis),
|
|
33
|
-
_javaPart(jni::make_global(jThis)) {}
|
|
34
|
-
|
|
35
|
-
public:
|
|
36
|
-
~JHybridCactusDeviceInfoSpec() override {
|
|
37
|
-
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
38
|
-
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public:
|
|
42
|
-
size_t getExternalMemorySize() noexcept override;
|
|
43
|
-
void dispose() noexcept override;
|
|
44
|
-
std::string toString() override;
|
|
45
|
-
|
|
46
|
-
public:
|
|
47
|
-
inline const jni::global_ref<JHybridCactusDeviceInfoSpec::javaobject>& getJavaPart() const noexcept {
|
|
48
|
-
return _javaPart;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public:
|
|
52
|
-
// Properties
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
public:
|
|
56
|
-
// Methods
|
|
57
|
-
std::shared_ptr<Promise<std::optional<std::string>>> getAppIdentifier() override;
|
|
58
|
-
std::shared_ptr<Promise<DeviceInfo>> getDeviceInfo() override;
|
|
59
|
-
|
|
60
|
-
private:
|
|
61
|
-
friend HybridBase;
|
|
62
|
-
using HybridBase::HybridBase;
|
|
63
|
-
jni::global_ref<JHybridCactusDeviceInfoSpec::javaobject> _javaPart;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
} // namespace margelo::nitro::cactus
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// DeviceInfo.kt
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
package com.margelo.nitro.cactus
|
|
9
|
-
|
|
10
|
-
import androidx.annotation.Keep
|
|
11
|
-
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Represents the JavaScript object/struct "DeviceInfo".
|
|
16
|
-
*/
|
|
17
|
-
@DoNotStrip
|
|
18
|
-
@Keep
|
|
19
|
-
data class DeviceInfo(
|
|
20
|
-
@DoNotStrip
|
|
21
|
-
@Keep
|
|
22
|
-
val brand: String,
|
|
23
|
-
@DoNotStrip
|
|
24
|
-
@Keep
|
|
25
|
-
val model: String,
|
|
26
|
-
@DoNotStrip
|
|
27
|
-
@Keep
|
|
28
|
-
val device_id: String?,
|
|
29
|
-
@DoNotStrip
|
|
30
|
-
@Keep
|
|
31
|
-
val os: String,
|
|
32
|
-
@DoNotStrip
|
|
33
|
-
@Keep
|
|
34
|
-
val os_version: String
|
|
35
|
-
) {
|
|
36
|
-
/* primary constructor */
|
|
37
|
-
|
|
38
|
-
private companion object {
|
|
39
|
-
/**
|
|
40
|
-
* Constructor called from C++
|
|
41
|
-
*/
|
|
42
|
-
@DoNotStrip
|
|
43
|
-
@Keep
|
|
44
|
-
@Suppress("unused")
|
|
45
|
-
@JvmStatic
|
|
46
|
-
private fun fromCpp(brand: String, model: String, device_id: String?, os: String, os_version: String): DeviceInfo {
|
|
47
|
-
return DeviceInfo(brand, model, device_id, os, os_version)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusCryptoSpec.kt
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridCactusCryptoSpec.kt
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
package com.margelo.nitro.cactus
|
|
9
|
-
|
|
10
|
-
import androidx.annotation.Keep
|
|
11
|
-
import com.facebook.jni.HybridData
|
|
12
|
-
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import com.margelo.nitro.core.Promise
|
|
14
|
-
import com.margelo.nitro.core.HybridObject
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* A Kotlin class representing the CactusCrypto HybridObject.
|
|
18
|
-
* Implement this abstract class to create Kotlin-based instances of CactusCrypto.
|
|
19
|
-
*/
|
|
20
|
-
@DoNotStrip
|
|
21
|
-
@Keep
|
|
22
|
-
@Suppress(
|
|
23
|
-
"KotlinJniMissingFunction", "unused",
|
|
24
|
-
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
25
|
-
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
26
|
-
)
|
|
27
|
-
abstract class HybridCactusCryptoSpec: HybridObject() {
|
|
28
|
-
@DoNotStrip
|
|
29
|
-
private var mHybridData: HybridData = initHybrid()
|
|
30
|
-
|
|
31
|
-
init {
|
|
32
|
-
super.updateNative(mHybridData)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
override fun updateNative(hybridData: HybridData) {
|
|
36
|
-
mHybridData = hybridData
|
|
37
|
-
super.updateNative(hybridData)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Default implementation of `HybridObject.toString()`
|
|
41
|
-
override fun toString(): String {
|
|
42
|
-
return "[HybridObject CactusCrypto]"
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Properties
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// Methods
|
|
49
|
-
@DoNotStrip
|
|
50
|
-
@Keep
|
|
51
|
-
abstract fun uuidv5(namespaceUuid: String, name: String): Promise<String>
|
|
52
|
-
|
|
53
|
-
private external fun initHybrid(): HybridData
|
|
54
|
-
|
|
55
|
-
companion object {
|
|
56
|
-
protected const val TAG = "HybridCactusCryptoSpec"
|
|
57
|
-
}
|
|
58
|
-
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusDeviceInfoSpec.kt
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridCactusDeviceInfoSpec.kt
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
package com.margelo.nitro.cactus
|
|
9
|
-
|
|
10
|
-
import androidx.annotation.Keep
|
|
11
|
-
import com.facebook.jni.HybridData
|
|
12
|
-
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import com.margelo.nitro.core.Promise
|
|
14
|
-
import com.margelo.nitro.core.HybridObject
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* A Kotlin class representing the CactusDeviceInfo HybridObject.
|
|
18
|
-
* Implement this abstract class to create Kotlin-based instances of CactusDeviceInfo.
|
|
19
|
-
*/
|
|
20
|
-
@DoNotStrip
|
|
21
|
-
@Keep
|
|
22
|
-
@Suppress(
|
|
23
|
-
"KotlinJniMissingFunction", "unused",
|
|
24
|
-
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
25
|
-
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
26
|
-
)
|
|
27
|
-
abstract class HybridCactusDeviceInfoSpec: HybridObject() {
|
|
28
|
-
@DoNotStrip
|
|
29
|
-
private var mHybridData: HybridData = initHybrid()
|
|
30
|
-
|
|
31
|
-
init {
|
|
32
|
-
super.updateNative(mHybridData)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
override fun updateNative(hybridData: HybridData) {
|
|
36
|
-
mHybridData = hybridData
|
|
37
|
-
super.updateNative(hybridData)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Default implementation of `HybridObject.toString()`
|
|
41
|
-
override fun toString(): String {
|
|
42
|
-
return "[HybridObject CactusDeviceInfo]"
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Properties
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// Methods
|
|
49
|
-
@DoNotStrip
|
|
50
|
-
@Keep
|
|
51
|
-
abstract fun getAppIdentifier(): Promise<String?>
|
|
52
|
-
|
|
53
|
-
@DoNotStrip
|
|
54
|
-
@Keep
|
|
55
|
-
abstract fun getDeviceInfo(): Promise<DeviceInfo>
|
|
56
|
-
|
|
57
|
-
private external fun initHybrid(): HybridData
|
|
58
|
-
|
|
59
|
-
companion object {
|
|
60
|
-
protected const val TAG = "HybridCactusDeviceInfoSpec"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridCactusCryptoSpecSwift.cpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#include "HybridCactusCryptoSpecSwift.hpp"
|
|
9
|
-
|
|
10
|
-
namespace margelo::nitro::cactus {
|
|
11
|
-
} // namespace margelo::nitro::cactus
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridCactusCryptoSpecSwift.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#include "HybridCactusCryptoSpec.hpp"
|
|
11
|
-
|
|
12
|
-
// Forward declaration of `HybridCactusCryptoSpec_cxx` to properly resolve imports.
|
|
13
|
-
namespace Cactus { class HybridCactusCryptoSpec_cxx; }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
#include <string>
|
|
18
|
-
#include <NitroModules/Promise.hpp>
|
|
19
|
-
|
|
20
|
-
#include "Cactus-Swift-Cxx-Umbrella.hpp"
|
|
21
|
-
|
|
22
|
-
namespace margelo::nitro::cactus {
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The C++ part of HybridCactusCryptoSpec_cxx.swift.
|
|
26
|
-
*
|
|
27
|
-
* HybridCactusCryptoSpecSwift (C++) accesses HybridCactusCryptoSpec_cxx (Swift), and might
|
|
28
|
-
* contain some additional bridging code for C++ <> Swift interop.
|
|
29
|
-
*
|
|
30
|
-
* Since this obviously introduces an overhead, I hope at some point in
|
|
31
|
-
* the future, HybridCactusCryptoSpec_cxx can directly inherit from the C++ class HybridCactusCryptoSpec
|
|
32
|
-
* to simplify the whole structure and memory management.
|
|
33
|
-
*/
|
|
34
|
-
class HybridCactusCryptoSpecSwift: public virtual HybridCactusCryptoSpec {
|
|
35
|
-
public:
|
|
36
|
-
// Constructor from a Swift instance
|
|
37
|
-
explicit HybridCactusCryptoSpecSwift(const Cactus::HybridCactusCryptoSpec_cxx& swiftPart):
|
|
38
|
-
HybridObject(HybridCactusCryptoSpec::TAG),
|
|
39
|
-
_swiftPart(swiftPart) { }
|
|
40
|
-
|
|
41
|
-
public:
|
|
42
|
-
// Get the Swift part
|
|
43
|
-
inline Cactus::HybridCactusCryptoSpec_cxx& getSwiftPart() noexcept {
|
|
44
|
-
return _swiftPart;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public:
|
|
48
|
-
inline size_t getExternalMemorySize() noexcept override {
|
|
49
|
-
return _swiftPart.getMemorySize();
|
|
50
|
-
}
|
|
51
|
-
void dispose() noexcept override {
|
|
52
|
-
_swiftPart.dispose();
|
|
53
|
-
}
|
|
54
|
-
std::string toString() override {
|
|
55
|
-
return _swiftPart.toString();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public:
|
|
59
|
-
// Properties
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
public:
|
|
63
|
-
// Methods
|
|
64
|
-
inline std::shared_ptr<Promise<std::string>> uuidv5(const std::string& namespaceUuid, const std::string& name) override {
|
|
65
|
-
auto __result = _swiftPart.uuidv5(namespaceUuid, name);
|
|
66
|
-
if (__result.hasError()) [[unlikely]] {
|
|
67
|
-
std::rethrow_exception(__result.error());
|
|
68
|
-
}
|
|
69
|
-
auto __value = std::move(__result.value());
|
|
70
|
-
return __value;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
private:
|
|
74
|
-
Cactus::HybridCactusCryptoSpec_cxx _swiftPart;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
} // namespace margelo::nitro::cactus
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridCactusDeviceInfoSpecSwift.cpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#include "HybridCactusDeviceInfoSpecSwift.hpp"
|
|
9
|
-
|
|
10
|
-
namespace margelo::nitro::cactus {
|
|
11
|
-
} // namespace margelo::nitro::cactus
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridCactusDeviceInfoSpecSwift.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#include "HybridCactusDeviceInfoSpec.hpp"
|
|
11
|
-
|
|
12
|
-
// Forward declaration of `HybridCactusDeviceInfoSpec_cxx` to properly resolve imports.
|
|
13
|
-
namespace Cactus { class HybridCactusDeviceInfoSpec_cxx; }
|
|
14
|
-
|
|
15
|
-
// Forward declaration of `DeviceInfo` to properly resolve imports.
|
|
16
|
-
namespace margelo::nitro::cactus { struct DeviceInfo; }
|
|
17
|
-
|
|
18
|
-
#include <string>
|
|
19
|
-
#include <optional>
|
|
20
|
-
#include <NitroModules/Promise.hpp>
|
|
21
|
-
#include "DeviceInfo.hpp"
|
|
22
|
-
|
|
23
|
-
#include "Cactus-Swift-Cxx-Umbrella.hpp"
|
|
24
|
-
|
|
25
|
-
namespace margelo::nitro::cactus {
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* The C++ part of HybridCactusDeviceInfoSpec_cxx.swift.
|
|
29
|
-
*
|
|
30
|
-
* HybridCactusDeviceInfoSpecSwift (C++) accesses HybridCactusDeviceInfoSpec_cxx (Swift), and might
|
|
31
|
-
* contain some additional bridging code for C++ <> Swift interop.
|
|
32
|
-
*
|
|
33
|
-
* Since this obviously introduces an overhead, I hope at some point in
|
|
34
|
-
* the future, HybridCactusDeviceInfoSpec_cxx can directly inherit from the C++ class HybridCactusDeviceInfoSpec
|
|
35
|
-
* to simplify the whole structure and memory management.
|
|
36
|
-
*/
|
|
37
|
-
class HybridCactusDeviceInfoSpecSwift: public virtual HybridCactusDeviceInfoSpec {
|
|
38
|
-
public:
|
|
39
|
-
// Constructor from a Swift instance
|
|
40
|
-
explicit HybridCactusDeviceInfoSpecSwift(const Cactus::HybridCactusDeviceInfoSpec_cxx& swiftPart):
|
|
41
|
-
HybridObject(HybridCactusDeviceInfoSpec::TAG),
|
|
42
|
-
_swiftPart(swiftPart) { }
|
|
43
|
-
|
|
44
|
-
public:
|
|
45
|
-
// Get the Swift part
|
|
46
|
-
inline Cactus::HybridCactusDeviceInfoSpec_cxx& getSwiftPart() noexcept {
|
|
47
|
-
return _swiftPart;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public:
|
|
51
|
-
inline size_t getExternalMemorySize() noexcept override {
|
|
52
|
-
return _swiftPart.getMemorySize();
|
|
53
|
-
}
|
|
54
|
-
void dispose() noexcept override {
|
|
55
|
-
_swiftPart.dispose();
|
|
56
|
-
}
|
|
57
|
-
std::string toString() override {
|
|
58
|
-
return _swiftPart.toString();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public:
|
|
62
|
-
// Properties
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
public:
|
|
66
|
-
// Methods
|
|
67
|
-
inline std::shared_ptr<Promise<std::optional<std::string>>> getAppIdentifier() override {
|
|
68
|
-
auto __result = _swiftPart.getAppIdentifier();
|
|
69
|
-
if (__result.hasError()) [[unlikely]] {
|
|
70
|
-
std::rethrow_exception(__result.error());
|
|
71
|
-
}
|
|
72
|
-
auto __value = std::move(__result.value());
|
|
73
|
-
return __value;
|
|
74
|
-
}
|
|
75
|
-
inline std::shared_ptr<Promise<DeviceInfo>> getDeviceInfo() override {
|
|
76
|
-
auto __result = _swiftPart.getDeviceInfo();
|
|
77
|
-
if (__result.hasError()) [[unlikely]] {
|
|
78
|
-
std::rethrow_exception(__result.error());
|
|
79
|
-
}
|
|
80
|
-
auto __value = std::move(__result.value());
|
|
81
|
-
return __value;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
private:
|
|
85
|
-
Cactus::HybridCactusDeviceInfoSpec_cxx _swiftPart;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
} // namespace margelo::nitro::cactus
|