cactus-react-native 1.5.0 → 1.10.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 +347 -241
- 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 +197 -117
- package/cpp/HybridCactus.hpp +18 -9
- package/cpp/cactus_ffi.h +66 -42
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus.h +0 -1
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_cloud.h +48 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_ffi.h +66 -42
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_utils.h +568 -135
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/engine.h +148 -17
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/graph.h +145 -36
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel.h +187 -6
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel_utils.h +49 -149
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Info.plist +0 -0
- 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_cloud.h +48 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_ffi.h +66 -42
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_utils.h +568 -135
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/engine.h +148 -17
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/graph.h +145 -36
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel.h +187 -6
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel_utils.h +49 -149
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/_CodeSignature/CodeResources +1 -1
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/cactus +0 -0
- package/lib/module/classes/CactusLM.js +16 -49
- package/lib/module/classes/CactusLM.js.map +1 -1
- package/lib/module/classes/CactusSTT.js +41 -75
- 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 +10 -11
- package/lib/module/hooks/useCactusLM.js.map +1 -1
- package/lib/module/hooks/useCactusSTT.js +23 -62
- 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 +103 -23
- 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/CactusVAD.js +4 -0
- package/lib/module/{specs/CactusUtil.nitro.js.map → types/CactusVAD.js.map} +1 -1
- package/lib/typescript/src/classes/CactusLM.d.ts +5 -7
- package/lib/typescript/src/classes/CactusLM.d.ts.map +1 -1
- package/lib/typescript/src/classes/CactusSTT.d.ts +9 -12
- 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 +2 -2
- package/lib/typescript/src/hooks/useCactusLM.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useCactusSTT.d.ts +6 -8
- 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 -5
- 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 +13 -11
- 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 +7 -6
- 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 -11
- package/lib/typescript/src/types/CactusLM.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusSTT.d.ts +44 -12
- 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 +1 -6
- package/lib/typescript/src/types/common.d.ts.map +1 -1
- 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 -4
- package/nitrogen/generated/shared/c++/HybridCactusSpec.hpp +7 -6
- package/package.json +3 -3
- package/src/classes/CactusLM.ts +18 -65
- package/src/classes/CactusSTT.ts +52 -90
- package/src/classes/CactusVAD.ts +129 -0
- package/src/hooks/useCactusLM.ts +14 -17
- package/src/hooks/useCactusSTT.ts +47 -98
- package/src/hooks/useCactusVAD.ts +215 -0
- package/src/index.tsx +21 -12
- package/src/modelRegistry.ts +65 -0
- package/src/native/Cactus.ts +131 -38
- package/src/native/CactusIndex.ts +2 -2
- package/src/native/index.ts +0 -3
- package/src/specs/Cactus.nitro.ts +16 -7
- package/src/types/CactusIndex.ts +2 -2
- package/src/types/CactusLM.ts +19 -11
- package/src/types/CactusSTT.ts +47 -13
- package/src/types/CactusVAD.ts +39 -0
- package/src/types/common.ts +1 -6
- 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 -45
- 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/models.js +0 -336
- package/lib/module/models.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/telemetry/Telemetry.js +0 -154
- package/lib/module/telemetry/Telemetry.js.map +0 -1
- package/lib/typescript/src/api/Database.d.ts +0 -12
- 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/models.d.ts +0 -6
- package/lib/typescript/src/models.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/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 -55
- package/src/api/RemoteLM.ts +0 -273
- package/src/config/CactusConfig.ts +0 -11
- package/src/models.ts +0 -344
- 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/cpp/HybridCactusUtil.cpp
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
#include "HybridCactusUtil.hpp"
|
|
2
|
-
|
|
3
|
-
namespace margelo::nitro::cactus {
|
|
4
|
-
|
|
5
|
-
HybridCactusUtil::HybridCactusUtil() : HybridObject(TAG) {}
|
|
6
|
-
|
|
7
|
-
std::shared_ptr<Promise<std::string>>
|
|
8
|
-
HybridCactusUtil::registerApp(const std::string &encryptedData) {
|
|
9
|
-
return Promise<std::string>::async([this, encryptedData]() -> std::string {
|
|
10
|
-
std::lock_guard<std::mutex> lock(this->_mutex);
|
|
11
|
-
|
|
12
|
-
const char *raw = register_app(encryptedData.c_str());
|
|
13
|
-
|
|
14
|
-
if (raw == nullptr) {
|
|
15
|
-
throw std::runtime_error("Failed to register app");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
std::string registerAppStr(raw);
|
|
19
|
-
free_string(raw);
|
|
20
|
-
|
|
21
|
-
return registerAppStr;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
std::shared_ptr<Promise<std::optional<std::string>>>
|
|
26
|
-
HybridCactusUtil::getDeviceId(const std::optional<std::string> &token) {
|
|
27
|
-
return Promise<std::optional<std::string>>::async(
|
|
28
|
-
[this, token]() -> std::optional<std::string> {
|
|
29
|
-
std::lock_guard<std::mutex> lock(this->_mutex);
|
|
30
|
-
|
|
31
|
-
const char *deviceId = get_device_id(token ? token->c_str() : nullptr);
|
|
32
|
-
return deviceId ? std::optional<std::string>(deviceId) : std::nullopt;
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
std::shared_ptr<Promise<void>>
|
|
37
|
-
HybridCactusUtil::setAndroidDataDirectory(const std::string &dataDir) {
|
|
38
|
-
return Promise<void>::async([this, dataDir]() -> void {
|
|
39
|
-
std::lock_guard<std::mutex> lock(this->_mutex);
|
|
40
|
-
|
|
41
|
-
#ifdef __ANDROID__
|
|
42
|
-
set_android_data_directory(dataDir.c_str());
|
|
43
|
-
#endif
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
} // namespace margelo::nitro::cactus
|
package/cpp/HybridCactusUtil.hpp
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
#include "HybridCactusUtilSpec.hpp"
|
|
3
|
-
|
|
4
|
-
#include "cactus_util.h"
|
|
5
|
-
|
|
6
|
-
#include <mutex>
|
|
7
|
-
|
|
8
|
-
namespace margelo::nitro::cactus {
|
|
9
|
-
|
|
10
|
-
class HybridCactusUtil : public HybridCactusUtilSpec {
|
|
11
|
-
public:
|
|
12
|
-
HybridCactusUtil();
|
|
13
|
-
|
|
14
|
-
std::shared_ptr<Promise<std::string>>
|
|
15
|
-
registerApp(const std::string &encryptedData) override;
|
|
16
|
-
|
|
17
|
-
std::shared_ptr<Promise<std::optional<std::string>>>
|
|
18
|
-
getDeviceId(const std::optional<std::string> &token) override;
|
|
19
|
-
|
|
20
|
-
std::shared_ptr<Promise<void>>
|
|
21
|
-
setAndroidDataDirectory(const std::string &dataDir) override;
|
|
22
|
-
|
|
23
|
-
private:
|
|
24
|
-
std::mutex _mutex;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
} // namespace margelo::nitro::cactus
|
package/cpp/cactus_util.h
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#ifndef cactus_util_H
|
|
2
|
-
#define cactus_util_H
|
|
3
|
-
|
|
4
|
-
#ifdef __cplusplus
|
|
5
|
-
extern "C" {
|
|
6
|
-
#endif
|
|
7
|
-
|
|
8
|
-
const char* register_app(const char* encrypted_data);
|
|
9
|
-
|
|
10
|
-
const char* get_device_id(const char* current_token);
|
|
11
|
-
|
|
12
|
-
// Helper function to free memory allocated by register_app
|
|
13
|
-
void free_string(const char* str);
|
|
14
|
-
|
|
15
|
-
#ifdef __ANDROID__
|
|
16
|
-
// Function to set the Android app data directory
|
|
17
|
-
// This should be called from Flutter/Java side before any other functions
|
|
18
|
-
void set_android_data_directory(const char* data_dir);
|
|
19
|
-
#endif
|
|
20
|
-
|
|
21
|
-
#ifdef __cplusplus
|
|
22
|
-
}
|
|
23
|
-
#endif
|
|
24
|
-
|
|
25
|
-
#endif
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import CryptoKit
|
|
2
|
-
import NitroModules
|
|
3
|
-
|
|
4
|
-
class HybridCactusCrypto: HybridCactusCryptoSpec {
|
|
5
|
-
func uuidv5(namespaceUuid: String, name: String) throws -> Promise<String> {
|
|
6
|
-
return Promise.async {
|
|
7
|
-
guard let ns = UUID(uuidString: namespaceUuid) else {
|
|
8
|
-
throw RuntimeError.error(withMessage: "Invalid namespace UUID")
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
var nsBytes = ns.uuid
|
|
12
|
-
var data = withUnsafeBytes(of: &nsBytes) { Data($0) }
|
|
13
|
-
data.append(Data(name.utf8))
|
|
14
|
-
|
|
15
|
-
let digest = Insecure.SHA1.hash(data: data)
|
|
16
|
-
var bytes = Data(digest.prefix(16))
|
|
17
|
-
bytes.withUnsafeMutableBytes { raw in
|
|
18
|
-
let b = raw.bindMemory(to: UInt8.self)
|
|
19
|
-
b[6] = (b[6] & 0x0F) | 0x50
|
|
20
|
-
b[8] = (b[8] & 0x3F) | 0x80
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
let tuple = bytes.withUnsafeBytes { ptr -> uuid_t in
|
|
24
|
-
let b = ptr.bindMemory(to: UInt8.self)
|
|
25
|
-
return uuid_t(
|
|
26
|
-
b[0], b[1], b[2], b[3],
|
|
27
|
-
b[4], b[5], b[6], b[7],
|
|
28
|
-
b[8], b[9], b[10], b[11],
|
|
29
|
-
b[12], b[13], b[14], b[15])
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
let uuid = UUID(uuid: tuple)
|
|
33
|
-
|
|
34
|
-
return uuid.uuidString.lowercased()
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import NitroModules
|
|
2
|
-
import UIKit
|
|
3
|
-
|
|
4
|
-
class HybridCactusDeviceInfo: HybridCactusDeviceInfoSpec {
|
|
5
|
-
func getAppIdentifier() throws -> Promise<String?> {
|
|
6
|
-
return Promise.async { Bundle.main.bundleIdentifier }
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
func getDeviceInfo() throws -> Promise<DeviceInfo> {
|
|
10
|
-
return Promise.async {
|
|
11
|
-
let device = await MainActor.run { UIDevice.current }
|
|
12
|
-
return await DeviceInfo(
|
|
13
|
-
brand: "Apple",
|
|
14
|
-
model: self.deviceModelIdentifier(),
|
|
15
|
-
device_id: device.identifierForVendor?.uuidString,
|
|
16
|
-
os: device.systemName,
|
|
17
|
-
os_version: device.systemVersion
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
private func deviceModelIdentifier() -> String {
|
|
23
|
-
var systemInfo = utsname()
|
|
24
|
-
uname(&systemInfo)
|
|
25
|
-
let machineMirror = Mirror(reflecting: systemInfo.machine)
|
|
26
|
-
let identifier = machineMirror.children.reduce("") { identifier, element in
|
|
27
|
-
guard let value = element.value as? Int8, value != 0 else { return identifier }
|
|
28
|
-
return identifier + String(UnicodeScalar(UInt8(value)))
|
|
29
|
-
}
|
|
30
|
-
return identifier
|
|
31
|
-
}
|
|
32
|
-
}
|