@onekeyfe/react-native-device-utils 1.1.11

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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/ReactNativeDeviceUtils.podspec +29 -0
  4. package/android/CMakeLists.txt +24 -0
  5. package/android/build.gradle +132 -0
  6. package/android/gradle.properties +4 -0
  7. package/android/src/main/AndroidManifest.xml +1 -0
  8. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  9. package/android/src/main/java/com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtils.kt +343 -0
  10. package/android/src/main/java/com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtilsPackage.kt +26 -0
  11. package/ios/ReactNativeDeviceUtils.swift +41 -0
  12. package/lib/module/ReactNativeDeviceUtils.nitro.js +4 -0
  13. package/lib/module/ReactNativeDeviceUtils.nitro.js.map +1 -0
  14. package/lib/module/index.js +6 -0
  15. package/lib/module/index.js.map +1 -0
  16. package/lib/module/package.json +1 -0
  17. package/lib/typescript/package.json +1 -0
  18. package/lib/typescript/src/ReactNativeDeviceUtils.nitro.d.ts +21 -0
  19. package/lib/typescript/src/ReactNativeDeviceUtils.nitro.d.ts.map +1 -0
  20. package/lib/typescript/src/index.d.ts +4 -0
  21. package/lib/typescript/src/index.d.ts.map +1 -0
  22. package/nitro.json +17 -0
  23. package/nitrogen/generated/android/c++/JDualScreenInfoRect.hpp +69 -0
  24. package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +75 -0
  25. package/nitrogen/generated/android/c++/JHybridReactNativeDeviceUtilsSpec.cpp +123 -0
  26. package/nitrogen/generated/android/c++/JHybridReactNativeDeviceUtilsSpec.hpp +72 -0
  27. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/DualScreenInfoRect.kt +47 -0
  28. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/Func_void_bool.kt +80 -0
  29. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/HybridReactNativeDeviceUtilsSpec.kt +91 -0
  30. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/reactnativedeviceutilsOnLoad.kt +35 -0
  31. package/nitrogen/generated/android/reactnativedeviceutils+autolinking.cmake +81 -0
  32. package/nitrogen/generated/android/reactnativedeviceutils+autolinking.gradle +27 -0
  33. package/nitrogen/generated/android/reactnativedeviceutilsOnLoad.cpp +46 -0
  34. package/nitrogen/generated/android/reactnativedeviceutilsOnLoad.hpp +25 -0
  35. package/nitrogen/generated/ios/ReactNativeDeviceUtils+autolinking.rb +60 -0
  36. package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Bridge.cpp +65 -0
  37. package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Bridge.hpp +217 -0
  38. package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Umbrella.hpp +49 -0
  39. package/nitrogen/generated/ios/ReactNativeDeviceUtilsAutolinking.mm +33 -0
  40. package/nitrogen/generated/ios/ReactNativeDeviceUtilsAutolinking.swift +25 -0
  41. package/nitrogen/generated/ios/c++/HybridReactNativeDeviceUtilsSpecSwift.cpp +11 -0
  42. package/nitrogen/generated/ios/c++/HybridReactNativeDeviceUtilsSpecSwift.hpp +130 -0
  43. package/nitrogen/generated/ios/swift/DualScreenInfoRect.swift +69 -0
  44. package/nitrogen/generated/ios/swift/Func_void_DualScreenInfoRect.swift +47 -0
  45. package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
  46. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
  47. package/nitrogen/generated/ios/swift/Func_void_std__vector_DualScreenInfoRect_.swift +47 -0
  48. package/nitrogen/generated/ios/swift/HybridReactNativeDeviceUtilsSpec.swift +63 -0
  49. package/nitrogen/generated/ios/swift/HybridReactNativeDeviceUtilsSpec_cxx.swift +237 -0
  50. package/nitrogen/generated/shared/c++/DualScreenInfoRect.hpp +87 -0
  51. package/nitrogen/generated/shared/c++/HybridReactNativeDeviceUtilsSpec.cpp +28 -0
  52. package/nitrogen/generated/shared/c++/HybridReactNativeDeviceUtilsSpec.hpp +73 -0
  53. package/package.json +170 -0
  54. package/src/ReactNativeDeviceUtils.nitro.ts +21 -0
  55. package/src/index.tsx +8 -0
@@ -0,0 +1,81 @@
1
+ #
2
+ # reactnativedeviceutils+autolinking.cmake
3
+ # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ # https://github.com/mrousavy/nitro
5
+ # Copyright © 2025 Marc Rousavy @ Margelo
6
+ #
7
+
8
+ # This is a CMake file that adds all files generated by Nitrogen
9
+ # to the current CMake project.
10
+ #
11
+ # To use it, add this to your CMakeLists.txt:
12
+ # ```cmake
13
+ # include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/reactnativedeviceutils+autolinking.cmake)
14
+ # ```
15
+
16
+ # Define a flag to check if we are building properly
17
+ add_definitions(-DBUILDING_REACTNATIVEDEVICEUTILS_WITH_GENERATED_CMAKE_PROJECT)
18
+
19
+ # Enable Raw Props parsing in react-native (for Nitro Views)
20
+ add_definitions(-DRN_SERIALIZABLE_STATE)
21
+
22
+ # Add all headers that were generated by Nitrogen
23
+ include_directories(
24
+ "../nitrogen/generated/shared/c++"
25
+ "../nitrogen/generated/android/c++"
26
+ "../nitrogen/generated/android/"
27
+ )
28
+
29
+ # Add all .cpp sources that were generated by Nitrogen
30
+ target_sources(
31
+ # CMake project name (Android C++ library name)
32
+ reactnativedeviceutils PRIVATE
33
+ # Autolinking Setup
34
+ ../nitrogen/generated/android/reactnativedeviceutilsOnLoad.cpp
35
+ # Shared Nitrogen C++ sources
36
+ ../nitrogen/generated/shared/c++/HybridReactNativeDeviceUtilsSpec.cpp
37
+ # Android-specific Nitrogen C++ sources
38
+ ../nitrogen/generated/android/c++/JHybridReactNativeDeviceUtilsSpec.cpp
39
+ )
40
+
41
+ # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
42
+ # Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
43
+ target_compile_definitions(
44
+ reactnativedeviceutils PRIVATE
45
+ -DFOLLY_NO_CONFIG=1
46
+ -DFOLLY_HAVE_CLOCK_GETTIME=1
47
+ -DFOLLY_USE_LIBCPP=1
48
+ -DFOLLY_CFG_NO_COROUTINES=1
49
+ -DFOLLY_MOBILE=1
50
+ -DFOLLY_HAVE_RECVMMSG=1
51
+ -DFOLLY_HAVE_PTHREAD=1
52
+ # Once we target android-23 above, we can comment
53
+ # the following line. NDK uses GNU style stderror_r() after API 23.
54
+ -DFOLLY_HAVE_XSI_STRERROR_R=1
55
+ )
56
+
57
+ # Add all libraries required by the generated specs
58
+ find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
59
+ find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
60
+ find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
61
+
62
+ # Link all libraries together
63
+ target_link_libraries(
64
+ reactnativedeviceutils
65
+ fbjni::fbjni # <-- Facebook C++ JNI helpers
66
+ ReactAndroid::jsi # <-- RN: JSI
67
+ react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
68
+ )
69
+
70
+ # Link react-native (different prefab between RN 0.75 and RN 0.76)
71
+ if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
72
+ target_link_libraries(
73
+ reactnativedeviceutils
74
+ ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
75
+ )
76
+ else()
77
+ target_link_libraries(
78
+ reactnativedeviceutils
79
+ ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
80
+ )
81
+ endif()
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// reactnativedeviceutils+autolinking.gradle
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ /// This is a Gradle file that adds all files generated by Nitrogen
9
+ /// to the current Gradle project.
10
+ ///
11
+ /// To use it, add this to your build.gradle:
12
+ /// ```gradle
13
+ /// apply from: '../nitrogen/generated/android/reactnativedeviceutils+autolinking.gradle'
14
+ /// ```
15
+
16
+ logger.warn("[NitroModules] 🔥 reactnativedeviceutils is boosted by nitro!")
17
+
18
+ android {
19
+ sourceSets {
20
+ main {
21
+ java.srcDirs += [
22
+ // Nitrogen files
23
+ "${project.projectDir}/../nitrogen/generated/android/kotlin"
24
+ ]
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// reactnativedeviceutilsOnLoad.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #ifndef BUILDING_REACTNATIVEDEVICEUTILS_WITH_GENERATED_CMAKE_PROJECT
9
+ #error reactnativedeviceutilsOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
10
+ #endif
11
+
12
+ #include "reactnativedeviceutilsOnLoad.hpp"
13
+
14
+ #include <jni.h>
15
+ #include <fbjni/fbjni.h>
16
+ #include <NitroModules/HybridObjectRegistry.hpp>
17
+
18
+ #include "JHybridReactNativeDeviceUtilsSpec.hpp"
19
+ #include "JFunc_void_bool.hpp"
20
+ #include <NitroModules/DefaultConstructableObject.hpp>
21
+
22
+ namespace margelo::nitro::reactnativedeviceutils {
23
+
24
+ int initialize(JavaVM* vm) {
25
+ using namespace margelo::nitro;
26
+ using namespace margelo::nitro::reactnativedeviceutils;
27
+ using namespace facebook;
28
+
29
+ return facebook::jni::initialize(vm, [] {
30
+ // Register native JNI methods
31
+ margelo::nitro::reactnativedeviceutils::JHybridReactNativeDeviceUtilsSpec::registerNatives();
32
+ margelo::nitro::reactnativedeviceutils::JFunc_void_bool_cxx::registerNatives();
33
+
34
+ // Register Nitro Hybrid Objects
35
+ HybridObjectRegistry::registerHybridObjectConstructor(
36
+ "ReactNativeDeviceUtils",
37
+ []() -> std::shared_ptr<HybridObject> {
38
+ static DefaultConstructableObject<JHybridReactNativeDeviceUtilsSpec::javaobject> object("com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtils");
39
+ auto instance = object.create();
40
+ return instance->cthis()->shared();
41
+ }
42
+ );
43
+ });
44
+ }
45
+
46
+ } // namespace margelo::nitro::reactnativedeviceutils
@@ -0,0 +1,25 @@
1
+ ///
2
+ /// reactnativedeviceutilsOnLoad.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include <jni.h>
9
+ #include <NitroModules/NitroDefines.hpp>
10
+
11
+ namespace margelo::nitro::reactnativedeviceutils {
12
+
13
+ /**
14
+ * Initializes the native (C++) part of reactnativedeviceutils, and autolinks all Hybrid Objects.
15
+ * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
16
+ * Example:
17
+ * ```cpp (cpp-adapter.cpp)
18
+ * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
19
+ * return margelo::nitro::reactnativedeviceutils::initialize(vm);
20
+ * }
21
+ * ```
22
+ */
23
+ int initialize(JavaVM* vm);
24
+
25
+ } // namespace margelo::nitro::reactnativedeviceutils
@@ -0,0 +1,60 @@
1
+ #
2
+ # ReactNativeDeviceUtils+autolinking.rb
3
+ # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ # https://github.com/mrousavy/nitro
5
+ # Copyright © 2025 Marc Rousavy @ Margelo
6
+ #
7
+
8
+ # This is a Ruby script that adds all files generated by Nitrogen
9
+ # to the given podspec.
10
+ #
11
+ # To use it, add this to your .podspec:
12
+ # ```ruby
13
+ # Pod::Spec.new do |spec|
14
+ # # ...
15
+ #
16
+ # # Add all files generated by Nitrogen
17
+ # load 'nitrogen/generated/ios/ReactNativeDeviceUtils+autolinking.rb'
18
+ # add_nitrogen_files(spec)
19
+ # end
20
+ # ```
21
+
22
+ def add_nitrogen_files(spec)
23
+ Pod::UI.puts "[NitroModules] 🔥 ReactNativeDeviceUtils is boosted by nitro!"
24
+
25
+ spec.dependency "NitroModules"
26
+
27
+ current_source_files = Array(spec.attributes_hash['source_files'])
28
+ spec.source_files = current_source_files + [
29
+ # Generated cross-platform specs
30
+ "nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
31
+ # Generated bridges for the cross-platform specs
32
+ "nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
33
+ ]
34
+
35
+ current_public_header_files = Array(spec.attributes_hash['public_header_files'])
36
+ spec.public_header_files = current_public_header_files + [
37
+ # Generated specs
38
+ "nitrogen/generated/shared/**/*.{h,hpp}",
39
+ # Swift to C++ bridging helpers
40
+ "nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Bridge.hpp"
41
+ ]
42
+
43
+ current_private_header_files = Array(spec.attributes_hash['private_header_files'])
44
+ spec.private_header_files = current_private_header_files + [
45
+ # iOS specific specs
46
+ "nitrogen/generated/ios/c++/**/*.{h,hpp}",
47
+ # Views are framework-specific and should be private
48
+ "nitrogen/generated/shared/**/views/**/*"
49
+ ]
50
+
51
+ current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
52
+ spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
53
+ # Use C++ 20
54
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
55
+ # Enables C++ <-> Swift interop (by default it's only C)
56
+ "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
57
+ # Enables stricter modular headers
58
+ "DEFINES_MODULE" => "YES",
59
+ })
60
+ end
@@ -0,0 +1,65 @@
1
+ ///
2
+ /// ReactNativeDeviceUtils-Swift-Cxx-Bridge.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "ReactNativeDeviceUtils-Swift-Cxx-Bridge.hpp"
9
+
10
+ // Include C++ implementation defined types
11
+ #include "HybridReactNativeDeviceUtilsSpecSwift.hpp"
12
+ #include "ReactNativeDeviceUtils-Swift-Cxx-Umbrella.hpp"
13
+ #include <NitroModules/NitroDefines.hpp>
14
+
15
+ namespace margelo::nitro::reactnativedeviceutils::bridge::swift {
16
+
17
+ // pragma MARK: std::function<void(const std::vector<DualScreenInfoRect>& /* result */)>
18
+ Func_void_std__vector_DualScreenInfoRect_ create_Func_void_std__vector_DualScreenInfoRect_(void* NON_NULL swiftClosureWrapper) noexcept {
19
+ auto swiftClosure = ReactNativeDeviceUtils::Func_void_std__vector_DualScreenInfoRect_::fromUnsafe(swiftClosureWrapper);
20
+ return [swiftClosure = std::move(swiftClosure)](const std::vector<DualScreenInfoRect>& result) mutable -> void {
21
+ swiftClosure.call(result);
22
+ };
23
+ }
24
+
25
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
26
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
27
+ auto swiftClosure = ReactNativeDeviceUtils::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
28
+ return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
29
+ swiftClosure.call(error);
30
+ };
31
+ }
32
+
33
+ // pragma MARK: std::function<void(const DualScreenInfoRect& /* result */)>
34
+ Func_void_DualScreenInfoRect create_Func_void_DualScreenInfoRect(void* NON_NULL swiftClosureWrapper) noexcept {
35
+ auto swiftClosure = ReactNativeDeviceUtils::Func_void_DualScreenInfoRect::fromUnsafe(swiftClosureWrapper);
36
+ return [swiftClosure = std::move(swiftClosure)](const DualScreenInfoRect& result) mutable -> void {
37
+ swiftClosure.call(result);
38
+ };
39
+ }
40
+
41
+ // pragma MARK: std::function<void(bool /* isSpanning */)>
42
+ Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
43
+ auto swiftClosure = ReactNativeDeviceUtils::Func_void_bool::fromUnsafe(swiftClosureWrapper);
44
+ return [swiftClosure = std::move(swiftClosure)](bool isSpanning) mutable -> void {
45
+ swiftClosure.call(isSpanning);
46
+ };
47
+ }
48
+
49
+ // pragma MARK: std::shared_ptr<HybridReactNativeDeviceUtilsSpec>
50
+ std::shared_ptr<HybridReactNativeDeviceUtilsSpec> create_std__shared_ptr_HybridReactNativeDeviceUtilsSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
51
+ ReactNativeDeviceUtils::HybridReactNativeDeviceUtilsSpec_cxx swiftPart = ReactNativeDeviceUtils::HybridReactNativeDeviceUtilsSpec_cxx::fromUnsafe(swiftUnsafePointer);
52
+ return std::make_shared<margelo::nitro::reactnativedeviceutils::HybridReactNativeDeviceUtilsSpecSwift>(swiftPart);
53
+ }
54
+ void* NON_NULL get_std__shared_ptr_HybridReactNativeDeviceUtilsSpec_(std__shared_ptr_HybridReactNativeDeviceUtilsSpec_ cppType) {
55
+ std::shared_ptr<margelo::nitro::reactnativedeviceutils::HybridReactNativeDeviceUtilsSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::reactnativedeviceutils::HybridReactNativeDeviceUtilsSpecSwift>(cppType);
56
+ #ifdef NITRO_DEBUG
57
+ if (swiftWrapper == nullptr) [[unlikely]] {
58
+ throw std::runtime_error("Class \"HybridReactNativeDeviceUtilsSpec\" is not implemented in Swift!");
59
+ }
60
+ #endif
61
+ ReactNativeDeviceUtils::HybridReactNativeDeviceUtilsSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
62
+ return swiftPart.toUnsafe();
63
+ }
64
+
65
+ } // namespace margelo::nitro::reactnativedeviceutils::bridge::swift
@@ -0,0 +1,217 @@
1
+ ///
2
+ /// ReactNativeDeviceUtils-Swift-Cxx-Bridge.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `DualScreenInfoRect` to properly resolve imports.
12
+ namespace margelo::nitro::reactnativedeviceutils { struct DualScreenInfoRect; }
13
+ // Forward declaration of `HybridReactNativeDeviceUtilsSpec` to properly resolve imports.
14
+ namespace margelo::nitro::reactnativedeviceutils { class HybridReactNativeDeviceUtilsSpec; }
15
+
16
+ // Forward declarations of Swift defined types
17
+ // Forward declaration of `HybridReactNativeDeviceUtilsSpec_cxx` to properly resolve imports.
18
+ namespace ReactNativeDeviceUtils { class HybridReactNativeDeviceUtilsSpec_cxx; }
19
+
20
+ // Include C++ defined types
21
+ #include "DualScreenInfoRect.hpp"
22
+ #include "HybridReactNativeDeviceUtilsSpec.hpp"
23
+ #include <NitroModules/Promise.hpp>
24
+ #include <NitroModules/PromiseHolder.hpp>
25
+ #include <NitroModules/Result.hpp>
26
+ #include <exception>
27
+ #include <functional>
28
+ #include <memory>
29
+ #include <vector>
30
+
31
+ /**
32
+ * Contains specialized versions of C++ templated types so they can be accessed from Swift,
33
+ * as well as helper functions to interact with those C++ types from Swift.
34
+ */
35
+ namespace margelo::nitro::reactnativedeviceutils::bridge::swift {
36
+
37
+ // pragma MARK: std::vector<DualScreenInfoRect>
38
+ /**
39
+ * Specialized version of `std::vector<DualScreenInfoRect>`.
40
+ */
41
+ using std__vector_DualScreenInfoRect_ = std::vector<DualScreenInfoRect>;
42
+ inline std::vector<DualScreenInfoRect> create_std__vector_DualScreenInfoRect_(size_t size) noexcept {
43
+ std::vector<DualScreenInfoRect> vector;
44
+ vector.reserve(size);
45
+ return vector;
46
+ }
47
+
48
+ // pragma MARK: std::shared_ptr<Promise<std::vector<DualScreenInfoRect>>>
49
+ /**
50
+ * Specialized version of `std::shared_ptr<Promise<std::vector<DualScreenInfoRect>>>`.
51
+ */
52
+ using std__shared_ptr_Promise_std__vector_DualScreenInfoRect___ = std::shared_ptr<Promise<std::vector<DualScreenInfoRect>>>;
53
+ inline std::shared_ptr<Promise<std::vector<DualScreenInfoRect>>> create_std__shared_ptr_Promise_std__vector_DualScreenInfoRect___() noexcept {
54
+ return Promise<std::vector<DualScreenInfoRect>>::create();
55
+ }
56
+ inline PromiseHolder<std::vector<DualScreenInfoRect>> wrap_std__shared_ptr_Promise_std__vector_DualScreenInfoRect___(std::shared_ptr<Promise<std::vector<DualScreenInfoRect>>> promise) noexcept {
57
+ return PromiseHolder<std::vector<DualScreenInfoRect>>(std::move(promise));
58
+ }
59
+
60
+ // pragma MARK: std::function<void(const std::vector<DualScreenInfoRect>& /* result */)>
61
+ /**
62
+ * Specialized version of `std::function<void(const std::vector<DualScreenInfoRect>&)>`.
63
+ */
64
+ using Func_void_std__vector_DualScreenInfoRect_ = std::function<void(const std::vector<DualScreenInfoRect>& /* result */)>;
65
+ /**
66
+ * Wrapper class for a `std::function<void(const std::vector<DualScreenInfoRect>& / * result * /)>`, this can be used from Swift.
67
+ */
68
+ class Func_void_std__vector_DualScreenInfoRect__Wrapper final {
69
+ public:
70
+ explicit Func_void_std__vector_DualScreenInfoRect__Wrapper(std::function<void(const std::vector<DualScreenInfoRect>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::vector<DualScreenInfoRect>& /* result */)>>(std::move(func))) {}
71
+ inline void call(std::vector<DualScreenInfoRect> result) const noexcept {
72
+ _function->operator()(result);
73
+ }
74
+ private:
75
+ std::unique_ptr<std::function<void(const std::vector<DualScreenInfoRect>& /* result */)>> _function;
76
+ } SWIFT_NONCOPYABLE;
77
+ Func_void_std__vector_DualScreenInfoRect_ create_Func_void_std__vector_DualScreenInfoRect_(void* NON_NULL swiftClosureWrapper) noexcept;
78
+ inline Func_void_std__vector_DualScreenInfoRect__Wrapper wrap_Func_void_std__vector_DualScreenInfoRect_(Func_void_std__vector_DualScreenInfoRect_ value) noexcept {
79
+ return Func_void_std__vector_DualScreenInfoRect__Wrapper(std::move(value));
80
+ }
81
+
82
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
83
+ /**
84
+ * Specialized version of `std::function<void(const std::exception_ptr&)>`.
85
+ */
86
+ using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
87
+ /**
88
+ * Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
89
+ */
90
+ class Func_void_std__exception_ptr_Wrapper final {
91
+ public:
92
+ explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
93
+ inline void call(std::exception_ptr error) const noexcept {
94
+ _function->operator()(error);
95
+ }
96
+ private:
97
+ std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
98
+ } SWIFT_NONCOPYABLE;
99
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
100
+ inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
101
+ return Func_void_std__exception_ptr_Wrapper(std::move(value));
102
+ }
103
+
104
+ // pragma MARK: std::shared_ptr<Promise<DualScreenInfoRect>>
105
+ /**
106
+ * Specialized version of `std::shared_ptr<Promise<DualScreenInfoRect>>`.
107
+ */
108
+ using std__shared_ptr_Promise_DualScreenInfoRect__ = std::shared_ptr<Promise<DualScreenInfoRect>>;
109
+ inline std::shared_ptr<Promise<DualScreenInfoRect>> create_std__shared_ptr_Promise_DualScreenInfoRect__() noexcept {
110
+ return Promise<DualScreenInfoRect>::create();
111
+ }
112
+ inline PromiseHolder<DualScreenInfoRect> wrap_std__shared_ptr_Promise_DualScreenInfoRect__(std::shared_ptr<Promise<DualScreenInfoRect>> promise) noexcept {
113
+ return PromiseHolder<DualScreenInfoRect>(std::move(promise));
114
+ }
115
+
116
+ // pragma MARK: std::function<void(const DualScreenInfoRect& /* result */)>
117
+ /**
118
+ * Specialized version of `std::function<void(const DualScreenInfoRect&)>`.
119
+ */
120
+ using Func_void_DualScreenInfoRect = std::function<void(const DualScreenInfoRect& /* result */)>;
121
+ /**
122
+ * Wrapper class for a `std::function<void(const DualScreenInfoRect& / * result * /)>`, this can be used from Swift.
123
+ */
124
+ class Func_void_DualScreenInfoRect_Wrapper final {
125
+ public:
126
+ explicit Func_void_DualScreenInfoRect_Wrapper(std::function<void(const DualScreenInfoRect& /* result */)>&& func): _function(std::make_unique<std::function<void(const DualScreenInfoRect& /* result */)>>(std::move(func))) {}
127
+ inline void call(DualScreenInfoRect result) const noexcept {
128
+ _function->operator()(result);
129
+ }
130
+ private:
131
+ std::unique_ptr<std::function<void(const DualScreenInfoRect& /* result */)>> _function;
132
+ } SWIFT_NONCOPYABLE;
133
+ Func_void_DualScreenInfoRect create_Func_void_DualScreenInfoRect(void* NON_NULL swiftClosureWrapper) noexcept;
134
+ inline Func_void_DualScreenInfoRect_Wrapper wrap_Func_void_DualScreenInfoRect(Func_void_DualScreenInfoRect value) noexcept {
135
+ return Func_void_DualScreenInfoRect_Wrapper(std::move(value));
136
+ }
137
+
138
+ // pragma MARK: std::function<void(bool /* isSpanning */)>
139
+ /**
140
+ * Specialized version of `std::function<void(bool)>`.
141
+ */
142
+ using Func_void_bool = std::function<void(bool /* isSpanning */)>;
143
+ /**
144
+ * Wrapper class for a `std::function<void(bool / * isSpanning * /)>`, this can be used from Swift.
145
+ */
146
+ class Func_void_bool_Wrapper final {
147
+ public:
148
+ explicit Func_void_bool_Wrapper(std::function<void(bool /* isSpanning */)>&& func): _function(std::make_unique<std::function<void(bool /* isSpanning */)>>(std::move(func))) {}
149
+ inline void call(bool isSpanning) const noexcept {
150
+ _function->operator()(isSpanning);
151
+ }
152
+ private:
153
+ std::unique_ptr<std::function<void(bool /* isSpanning */)>> _function;
154
+ } SWIFT_NONCOPYABLE;
155
+ Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept;
156
+ inline Func_void_bool_Wrapper wrap_Func_void_bool(Func_void_bool value) noexcept {
157
+ return Func_void_bool_Wrapper(std::move(value));
158
+ }
159
+
160
+ // pragma MARK: std::shared_ptr<HybridReactNativeDeviceUtilsSpec>
161
+ /**
162
+ * Specialized version of `std::shared_ptr<HybridReactNativeDeviceUtilsSpec>`.
163
+ */
164
+ using std__shared_ptr_HybridReactNativeDeviceUtilsSpec_ = std::shared_ptr<HybridReactNativeDeviceUtilsSpec>;
165
+ std::shared_ptr<HybridReactNativeDeviceUtilsSpec> create_std__shared_ptr_HybridReactNativeDeviceUtilsSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
166
+ void* NON_NULL get_std__shared_ptr_HybridReactNativeDeviceUtilsSpec_(std__shared_ptr_HybridReactNativeDeviceUtilsSpec_ cppType);
167
+
168
+ // pragma MARK: std::weak_ptr<HybridReactNativeDeviceUtilsSpec>
169
+ using std__weak_ptr_HybridReactNativeDeviceUtilsSpec_ = std::weak_ptr<HybridReactNativeDeviceUtilsSpec>;
170
+ inline std__weak_ptr_HybridReactNativeDeviceUtilsSpec_ weakify_std__shared_ptr_HybridReactNativeDeviceUtilsSpec_(const std::shared_ptr<HybridReactNativeDeviceUtilsSpec>& strong) noexcept { return strong; }
171
+
172
+ // pragma MARK: Result<void>
173
+ using Result_void_ = Result<void>;
174
+ inline Result_void_ create_Result_void_() noexcept {
175
+ return Result<void>::withValue();
176
+ }
177
+ inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
178
+ return Result<void>::withError(error);
179
+ }
180
+
181
+ // pragma MARK: Result<bool>
182
+ using Result_bool_ = Result<bool>;
183
+ inline Result_bool_ create_Result_bool_(bool value) noexcept {
184
+ return Result<bool>::withValue(std::move(value));
185
+ }
186
+ inline Result_bool_ create_Result_bool_(const std::exception_ptr& error) noexcept {
187
+ return Result<bool>::withError(error);
188
+ }
189
+
190
+ // pragma MARK: Result<std::shared_ptr<Promise<std::vector<DualScreenInfoRect>>>>
191
+ using Result_std__shared_ptr_Promise_std__vector_DualScreenInfoRect____ = Result<std::shared_ptr<Promise<std::vector<DualScreenInfoRect>>>>;
192
+ inline Result_std__shared_ptr_Promise_std__vector_DualScreenInfoRect____ create_Result_std__shared_ptr_Promise_std__vector_DualScreenInfoRect____(const std::shared_ptr<Promise<std::vector<DualScreenInfoRect>>>& value) noexcept {
193
+ return Result<std::shared_ptr<Promise<std::vector<DualScreenInfoRect>>>>::withValue(value);
194
+ }
195
+ inline Result_std__shared_ptr_Promise_std__vector_DualScreenInfoRect____ create_Result_std__shared_ptr_Promise_std__vector_DualScreenInfoRect____(const std::exception_ptr& error) noexcept {
196
+ return Result<std::shared_ptr<Promise<std::vector<DualScreenInfoRect>>>>::withError(error);
197
+ }
198
+
199
+ // pragma MARK: Result<std::shared_ptr<Promise<DualScreenInfoRect>>>
200
+ using Result_std__shared_ptr_Promise_DualScreenInfoRect___ = Result<std::shared_ptr<Promise<DualScreenInfoRect>>>;
201
+ inline Result_std__shared_ptr_Promise_DualScreenInfoRect___ create_Result_std__shared_ptr_Promise_DualScreenInfoRect___(const std::shared_ptr<Promise<DualScreenInfoRect>>& value) noexcept {
202
+ return Result<std::shared_ptr<Promise<DualScreenInfoRect>>>::withValue(value);
203
+ }
204
+ inline Result_std__shared_ptr_Promise_DualScreenInfoRect___ create_Result_std__shared_ptr_Promise_DualScreenInfoRect___(const std::exception_ptr& error) noexcept {
205
+ return Result<std::shared_ptr<Promise<DualScreenInfoRect>>>::withError(error);
206
+ }
207
+
208
+ // pragma MARK: Result<double>
209
+ using Result_double_ = Result<double>;
210
+ inline Result_double_ create_Result_double_(double value) noexcept {
211
+ return Result<double>::withValue(std::move(value));
212
+ }
213
+ inline Result_double_ create_Result_double_(const std::exception_ptr& error) noexcept {
214
+ return Result<double>::withError(error);
215
+ }
216
+
217
+ } // namespace margelo::nitro::reactnativedeviceutils::bridge::swift
@@ -0,0 +1,49 @@
1
+ ///
2
+ /// ReactNativeDeviceUtils-Swift-Cxx-Umbrella.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ // Forward declarations of C++ defined types
11
+ // Forward declaration of `DualScreenInfoRect` to properly resolve imports.
12
+ namespace margelo::nitro::reactnativedeviceutils { struct DualScreenInfoRect; }
13
+ // Forward declaration of `HybridReactNativeDeviceUtilsSpec` to properly resolve imports.
14
+ namespace margelo::nitro::reactnativedeviceutils { class HybridReactNativeDeviceUtilsSpec; }
15
+
16
+ // Include C++ defined types
17
+ #include "DualScreenInfoRect.hpp"
18
+ #include "HybridReactNativeDeviceUtilsSpec.hpp"
19
+ #include <NitroModules/Promise.hpp>
20
+ #include <NitroModules/Result.hpp>
21
+ #include <exception>
22
+ #include <functional>
23
+ #include <memory>
24
+ #include <vector>
25
+
26
+ // C++ helpers for Swift
27
+ #include "ReactNativeDeviceUtils-Swift-Cxx-Bridge.hpp"
28
+
29
+ // Common C++ types used in Swift
30
+ #include <NitroModules/ArrayBufferHolder.hpp>
31
+ #include <NitroModules/AnyMapUtils.hpp>
32
+ #include <NitroModules/RuntimeError.hpp>
33
+ #include <NitroModules/DateToChronoDate.hpp>
34
+
35
+ // Forward declarations of Swift defined types
36
+ // Forward declaration of `HybridReactNativeDeviceUtilsSpec_cxx` to properly resolve imports.
37
+ namespace ReactNativeDeviceUtils { class HybridReactNativeDeviceUtilsSpec_cxx; }
38
+
39
+ // Include Swift defined types
40
+ #if __has_include("ReactNativeDeviceUtils-Swift.h")
41
+ // This header is generated by Xcode/Swift on every app build.
42
+ // If it cannot be found, make sure the Swift module's name (= podspec name) is actually "ReactNativeDeviceUtils".
43
+ #include "ReactNativeDeviceUtils-Swift.h"
44
+ // Same as above, but used when building with frameworks (`use_frameworks`)
45
+ #elif __has_include(<ReactNativeDeviceUtils/ReactNativeDeviceUtils-Swift.h>)
46
+ #include <ReactNativeDeviceUtils/ReactNativeDeviceUtils-Swift.h>
47
+ #else
48
+ #error ReactNativeDeviceUtils's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "ReactNativeDeviceUtils", and try building the app first.
49
+ #endif
@@ -0,0 +1,33 @@
1
+ ///
2
+ /// ReactNativeDeviceUtilsAutolinking.mm
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <NitroModules/HybridObjectRegistry.hpp>
10
+ #import "ReactNativeDeviceUtils-Swift-Cxx-Umbrella.hpp"
11
+ #import <type_traits>
12
+
13
+ #include "HybridReactNativeDeviceUtilsSpecSwift.hpp"
14
+
15
+ @interface ReactNativeDeviceUtilsAutolinking : NSObject
16
+ @end
17
+
18
+ @implementation ReactNativeDeviceUtilsAutolinking
19
+
20
+ + (void) load {
21
+ using namespace margelo::nitro;
22
+ using namespace margelo::nitro::reactnativedeviceutils;
23
+
24
+ HybridObjectRegistry::registerHybridObjectConstructor(
25
+ "ReactNativeDeviceUtils",
26
+ []() -> std::shared_ptr<HybridObject> {
27
+ std::shared_ptr<HybridReactNativeDeviceUtilsSpec> hybridObject = ReactNativeDeviceUtils::ReactNativeDeviceUtilsAutolinking::createReactNativeDeviceUtils();
28
+ return hybridObject;
29
+ }
30
+ );
31
+ }
32
+
33
+ @end
@@ -0,0 +1,25 @@
1
+ ///
2
+ /// ReactNativeDeviceUtilsAutolinking.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ public final class ReactNativeDeviceUtilsAutolinking {
9
+ public typealias bridge = margelo.nitro.reactnativedeviceutils.bridge.swift
10
+
11
+ /**
12
+ * Creates an instance of a Swift class that implements `HybridReactNativeDeviceUtilsSpec`,
13
+ * and wraps it in a Swift class that can directly interop with C++ (`HybridReactNativeDeviceUtilsSpec_cxx`)
14
+ *
15
+ * This is generated by Nitrogen and will initialize the class specified
16
+ * in the `"autolinking"` property of `nitro.json` (in this case, `ReactNativeDeviceUtils`).
17
+ */
18
+ public static func createReactNativeDeviceUtils() -> bridge.std__shared_ptr_HybridReactNativeDeviceUtilsSpec_ {
19
+ let hybridObject = ReactNativeDeviceUtils()
20
+ return { () -> bridge.std__shared_ptr_HybridReactNativeDeviceUtilsSpec_ in
21
+ let __cxxWrapped = hybridObject.getCxxWrapper()
22
+ return __cxxWrapped.getCxxPart()
23
+ }()
24
+ }
25
+ }
@@ -0,0 +1,11 @@
1
+ ///
2
+ /// HybridReactNativeDeviceUtilsSpecSwift.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "HybridReactNativeDeviceUtilsSpecSwift.hpp"
9
+
10
+ namespace margelo::nitro::reactnativedeviceutils {
11
+ } // namespace margelo::nitro::reactnativedeviceutils