@onekeyfe/react-native-device-utils 6.7.0-6 → 6.7.0-60
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/README.md +117 -87
- package/android/src/main/java/com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtils.kt +156 -35
- package/ios/DualScreenDetector.swift +170 -0
- package/ios/MainMenuController.swift +170 -0
- package/ios/ReactNativeDeviceUtils.swift +29 -4
- package/ios/WindowControlsInsetsObserver.swift +151 -0
- package/lib/typescript/src/ReactNativeDeviceUtils.nitro.d.ts +46 -0
- package/nitrogen/generated/android/c++/JFunc_void_MainMenuCommand.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_WindowControlsInsets.hpp +77 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeDeviceUtilsSpec.cpp +45 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeDeviceUtilsSpec.hpp +6 -0
- package/nitrogen/generated/android/c++/JMainMenuCommand.hpp +61 -0
- package/nitrogen/generated/android/c++/JMainMenuConfig.hpp +90 -0
- package/nitrogen/generated/android/c++/JMainMenuLink.hpp +61 -0
- package/nitrogen/generated/android/c++/JWindowControlsInsets.hpp +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/Func_void_MainMenuCommand.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/Func_void_WindowControlsInsets.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/HybridReactNativeDeviceUtilsSpec.kt +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/MainMenuCommand.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/MainMenuConfig.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/MainMenuLink.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/WindowControlsInsets.kt +66 -0
- package/nitrogen/generated/android/reactnativedeviceutilsOnLoad.cpp +4 -0
- package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Bridge.cpp +16 -0
- package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Bridge.hpp +73 -0
- package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Umbrella.hpp +12 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeDeviceUtilsSpecSwift.hpp +55 -1
- package/nitrogen/generated/ios/swift/Func_void_MainMenuCommand.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_WindowControlsInsets.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeDeviceUtilsSpec.swift +6 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeDeviceUtilsSpec_cxx.swift +79 -0
- package/nitrogen/generated/ios/swift/MainMenuCommand.swift +44 -0
- package/nitrogen/generated/ios/swift/MainMenuConfig.swift +50 -0
- package/nitrogen/generated/ios/swift/MainMenuLink.swift +34 -0
- package/nitrogen/generated/ios/swift/WindowControlsInsets.swift +44 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeDeviceUtilsSpec.cpp +6 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeDeviceUtilsSpec.hpp +15 -0
- package/nitrogen/generated/shared/c++/MainMenuCommand.hpp +80 -0
- package/nitrogen/generated/shared/c++/MainMenuConfig.hpp +98 -0
- package/nitrogen/generated/shared/c++/MainMenuLink.hpp +87 -0
- package/nitrogen/generated/shared/c++/WindowControlsInsets.hpp +95 -0
- package/package.json +8 -7
- package/src/ReactNativeDeviceUtils.nitro.ts +54 -0
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
#include "JHybridReactNativeDeviceUtilsSpec.hpp"
|
|
19
19
|
#include "JFunc_void_bool.hpp"
|
|
20
|
+
#include "JFunc_void_WindowControlsInsets.hpp"
|
|
21
|
+
#include "JFunc_void_MainMenuCommand.hpp"
|
|
20
22
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
21
23
|
|
|
22
24
|
namespace margelo::nitro::reactnativedeviceutils {
|
|
@@ -43,6 +45,8 @@ void registerAllNatives() {
|
|
|
43
45
|
// Register native JNI methods
|
|
44
46
|
margelo::nitro::reactnativedeviceutils::JHybridReactNativeDeviceUtilsSpec::CxxPart::registerNatives();
|
|
45
47
|
margelo::nitro::reactnativedeviceutils::JFunc_void_bool_cxx::registerNatives();
|
|
48
|
+
margelo::nitro::reactnativedeviceutils::JFunc_void_WindowControlsInsets_cxx::registerNatives();
|
|
49
|
+
margelo::nitro::reactnativedeviceutils::JFunc_void_MainMenuCommand_cxx::registerNatives();
|
|
46
50
|
|
|
47
51
|
// Register Nitro Hybrid Objects
|
|
48
52
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
@@ -46,6 +46,22 @@ namespace margelo::nitro::reactnativedeviceutils::bridge::swift {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
// pragma MARK: std::function<void(const WindowControlsInsets& /* insets */)>
|
|
50
|
+
Func_void_WindowControlsInsets create_Func_void_WindowControlsInsets(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
51
|
+
auto swiftClosure = ReactNativeDeviceUtils::Func_void_WindowControlsInsets::fromUnsafe(swiftClosureWrapper);
|
|
52
|
+
return [swiftClosure = std::move(swiftClosure)](const WindowControlsInsets& insets) mutable -> void {
|
|
53
|
+
swiftClosure.call(insets);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// pragma MARK: std::function<void(MainMenuCommand /* command */)>
|
|
58
|
+
Func_void_MainMenuCommand create_Func_void_MainMenuCommand(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
59
|
+
auto swiftClosure = ReactNativeDeviceUtils::Func_void_MainMenuCommand::fromUnsafe(swiftClosureWrapper);
|
|
60
|
+
return [swiftClosure = std::move(swiftClosure)](MainMenuCommand command) mutable -> void {
|
|
61
|
+
swiftClosure.call(static_cast<int>(command));
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
49
65
|
// pragma MARK: std::function<void(const LaunchOptions& /* result */)>
|
|
50
66
|
Func_void_LaunchOptions create_Func_void_LaunchOptions(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
51
67
|
auto swiftClosure = ReactNativeDeviceUtils::Func_void_LaunchOptions::fromUnsafe(swiftClosureWrapper);
|
|
@@ -20,8 +20,14 @@ namespace margelo::nitro::reactnativedeviceutils { class HybridReactNativeDevice
|
|
|
20
20
|
namespace margelo::nitro::reactnativedeviceutils { enum class InstallerPackageName; }
|
|
21
21
|
// Forward declaration of `LaunchOptions` to properly resolve imports.
|
|
22
22
|
namespace margelo::nitro::reactnativedeviceutils { struct LaunchOptions; }
|
|
23
|
+
// Forward declaration of `MainMenuCommand` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::reactnativedeviceutils { enum class MainMenuCommand; }
|
|
25
|
+
// Forward declaration of `MainMenuLink` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::reactnativedeviceutils { struct MainMenuLink; }
|
|
23
27
|
// Forward declaration of `WebViewPackageInfo` to properly resolve imports.
|
|
24
28
|
namespace margelo::nitro::reactnativedeviceutils { struct WebViewPackageInfo; }
|
|
29
|
+
// Forward declaration of `WindowControlsInsets` to properly resolve imports.
|
|
30
|
+
namespace margelo::nitro::reactnativedeviceutils { struct WindowControlsInsets; }
|
|
25
31
|
|
|
26
32
|
// Forward declarations of Swift defined types
|
|
27
33
|
// Forward declaration of `HybridReactNativeDeviceUtilsSpec_cxx` to properly resolve imports.
|
|
@@ -34,7 +40,10 @@ namespace ReactNativeDeviceUtils { class HybridReactNativeDeviceUtilsSpec_cxx; }
|
|
|
34
40
|
#include "HybridReactNativeDeviceUtilsSpec.hpp"
|
|
35
41
|
#include "InstallerPackageName.hpp"
|
|
36
42
|
#include "LaunchOptions.hpp"
|
|
43
|
+
#include "MainMenuCommand.hpp"
|
|
44
|
+
#include "MainMenuLink.hpp"
|
|
37
45
|
#include "WebViewPackageInfo.hpp"
|
|
46
|
+
#include "WindowControlsInsets.hpp"
|
|
38
47
|
#include <NitroModules/Promise.hpp>
|
|
39
48
|
#include <NitroModules/PromiseHolder.hpp>
|
|
40
49
|
#include <NitroModules/Result.hpp>
|
|
@@ -175,6 +184,61 @@ namespace margelo::nitro::reactnativedeviceutils::bridge::swift {
|
|
|
175
184
|
return Func_void_bool_Wrapper(std::move(value));
|
|
176
185
|
}
|
|
177
186
|
|
|
187
|
+
// pragma MARK: std::function<void(const WindowControlsInsets& /* insets */)>
|
|
188
|
+
/**
|
|
189
|
+
* Specialized version of `std::function<void(const WindowControlsInsets&)>`.
|
|
190
|
+
*/
|
|
191
|
+
using Func_void_WindowControlsInsets = std::function<void(const WindowControlsInsets& /* insets */)>;
|
|
192
|
+
/**
|
|
193
|
+
* Wrapper class for a `std::function<void(const WindowControlsInsets& / * insets * /)>`, this can be used from Swift.
|
|
194
|
+
*/
|
|
195
|
+
class Func_void_WindowControlsInsets_Wrapper final {
|
|
196
|
+
public:
|
|
197
|
+
explicit Func_void_WindowControlsInsets_Wrapper(std::function<void(const WindowControlsInsets& /* insets */)>&& func): _function(std::make_unique<std::function<void(const WindowControlsInsets& /* insets */)>>(std::move(func))) {}
|
|
198
|
+
inline void call(WindowControlsInsets insets) const noexcept {
|
|
199
|
+
_function->operator()(insets);
|
|
200
|
+
}
|
|
201
|
+
private:
|
|
202
|
+
std::unique_ptr<std::function<void(const WindowControlsInsets& /* insets */)>> _function;
|
|
203
|
+
} SWIFT_NONCOPYABLE;
|
|
204
|
+
Func_void_WindowControlsInsets create_Func_void_WindowControlsInsets(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
205
|
+
inline Func_void_WindowControlsInsets_Wrapper wrap_Func_void_WindowControlsInsets(Func_void_WindowControlsInsets value) noexcept {
|
|
206
|
+
return Func_void_WindowControlsInsets_Wrapper(std::move(value));
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// pragma MARK: std::vector<MainMenuLink>
|
|
210
|
+
/**
|
|
211
|
+
* Specialized version of `std::vector<MainMenuLink>`.
|
|
212
|
+
*/
|
|
213
|
+
using std__vector_MainMenuLink_ = std::vector<MainMenuLink>;
|
|
214
|
+
inline std::vector<MainMenuLink> create_std__vector_MainMenuLink_(size_t size) noexcept {
|
|
215
|
+
std::vector<MainMenuLink> vector;
|
|
216
|
+
vector.reserve(size);
|
|
217
|
+
return vector;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// pragma MARK: std::function<void(MainMenuCommand /* command */)>
|
|
221
|
+
/**
|
|
222
|
+
* Specialized version of `std::function<void(MainMenuCommand)>`.
|
|
223
|
+
*/
|
|
224
|
+
using Func_void_MainMenuCommand = std::function<void(MainMenuCommand /* command */)>;
|
|
225
|
+
/**
|
|
226
|
+
* Wrapper class for a `std::function<void(MainMenuCommand / * command * /)>`, this can be used from Swift.
|
|
227
|
+
*/
|
|
228
|
+
class Func_void_MainMenuCommand_Wrapper final {
|
|
229
|
+
public:
|
|
230
|
+
explicit Func_void_MainMenuCommand_Wrapper(std::function<void(MainMenuCommand /* command */)>&& func): _function(std::make_unique<std::function<void(MainMenuCommand /* command */)>>(std::move(func))) {}
|
|
231
|
+
inline void call(int command) const noexcept {
|
|
232
|
+
_function->operator()(static_cast<MainMenuCommand>(command));
|
|
233
|
+
}
|
|
234
|
+
private:
|
|
235
|
+
std::unique_ptr<std::function<void(MainMenuCommand /* command */)>> _function;
|
|
236
|
+
} SWIFT_NONCOPYABLE;
|
|
237
|
+
Func_void_MainMenuCommand create_Func_void_MainMenuCommand(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
238
|
+
inline Func_void_MainMenuCommand_Wrapper wrap_Func_void_MainMenuCommand(Func_void_MainMenuCommand value) noexcept {
|
|
239
|
+
return Func_void_MainMenuCommand_Wrapper(std::move(value));
|
|
240
|
+
}
|
|
241
|
+
|
|
178
242
|
// pragma MARK: std::optional<std::string>
|
|
179
243
|
/**
|
|
180
244
|
* Specialized version of `std::optional<std::string>`.
|
|
@@ -513,6 +577,15 @@ namespace margelo::nitro::reactnativedeviceutils::bridge::swift {
|
|
|
513
577
|
return Result<double>::withError(error);
|
|
514
578
|
}
|
|
515
579
|
|
|
580
|
+
// pragma MARK: Result<WindowControlsInsets>
|
|
581
|
+
using Result_WindowControlsInsets_ = Result<WindowControlsInsets>;
|
|
582
|
+
inline Result_WindowControlsInsets_ create_Result_WindowControlsInsets_(const WindowControlsInsets& value) noexcept {
|
|
583
|
+
return Result<WindowControlsInsets>::withValue(value);
|
|
584
|
+
}
|
|
585
|
+
inline Result_WindowControlsInsets_ create_Result_WindowControlsInsets_(const std::exception_ptr& error) noexcept {
|
|
586
|
+
return Result<WindowControlsInsets>::withError(error);
|
|
587
|
+
}
|
|
588
|
+
|
|
516
589
|
// pragma MARK: Result<std::shared_ptr<Promise<LaunchOptions>>>
|
|
517
590
|
using Result_std__shared_ptr_Promise_LaunchOptions___ = Result<std::shared_ptr<Promise<LaunchOptions>>>;
|
|
518
591
|
inline Result_std__shared_ptr_Promise_LaunchOptions___ create_Result_std__shared_ptr_Promise_LaunchOptions___(const std::shared_ptr<Promise<LaunchOptions>>& value) noexcept {
|
|
@@ -20,10 +20,18 @@ namespace margelo::nitro::reactnativedeviceutils { class HybridReactNativeDevice
|
|
|
20
20
|
namespace margelo::nitro::reactnativedeviceutils { enum class InstallerPackageName; }
|
|
21
21
|
// Forward declaration of `LaunchOptions` to properly resolve imports.
|
|
22
22
|
namespace margelo::nitro::reactnativedeviceutils { struct LaunchOptions; }
|
|
23
|
+
// Forward declaration of `MainMenuCommand` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::reactnativedeviceutils { enum class MainMenuCommand; }
|
|
25
|
+
// Forward declaration of `MainMenuConfig` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::reactnativedeviceutils { struct MainMenuConfig; }
|
|
27
|
+
// Forward declaration of `MainMenuLink` to properly resolve imports.
|
|
28
|
+
namespace margelo::nitro::reactnativedeviceutils { struct MainMenuLink; }
|
|
23
29
|
// Forward declaration of `UserInterfaceStyle` to properly resolve imports.
|
|
24
30
|
namespace margelo::nitro::reactnativedeviceutils { enum class UserInterfaceStyle; }
|
|
25
31
|
// Forward declaration of `WebViewPackageInfo` to properly resolve imports.
|
|
26
32
|
namespace margelo::nitro::reactnativedeviceutils { struct WebViewPackageInfo; }
|
|
33
|
+
// Forward declaration of `WindowControlsInsets` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::reactnativedeviceutils { struct WindowControlsInsets; }
|
|
27
35
|
|
|
28
36
|
// Include C++ defined types
|
|
29
37
|
#include "AndroidChannel.hpp"
|
|
@@ -32,8 +40,12 @@ namespace margelo::nitro::reactnativedeviceutils { struct WebViewPackageInfo; }
|
|
|
32
40
|
#include "HybridReactNativeDeviceUtilsSpec.hpp"
|
|
33
41
|
#include "InstallerPackageName.hpp"
|
|
34
42
|
#include "LaunchOptions.hpp"
|
|
43
|
+
#include "MainMenuCommand.hpp"
|
|
44
|
+
#include "MainMenuConfig.hpp"
|
|
45
|
+
#include "MainMenuLink.hpp"
|
|
35
46
|
#include "UserInterfaceStyle.hpp"
|
|
36
47
|
#include "WebViewPackageInfo.hpp"
|
|
48
|
+
#include "WindowControlsInsets.hpp"
|
|
37
49
|
#include <NitroModules/Promise.hpp>
|
|
38
50
|
#include <NitroModules/Result.hpp>
|
|
39
51
|
#include <exception>
|
|
@@ -16,6 +16,14 @@ namespace ReactNativeDeviceUtils { class HybridReactNativeDeviceUtilsSpec_cxx; }
|
|
|
16
16
|
namespace margelo::nitro::reactnativedeviceutils { struct DualScreenInfoRect; }
|
|
17
17
|
// Forward declaration of `UserInterfaceStyle` to properly resolve imports.
|
|
18
18
|
namespace margelo::nitro::reactnativedeviceutils { enum class UserInterfaceStyle; }
|
|
19
|
+
// Forward declaration of `WindowControlsInsets` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::reactnativedeviceutils { struct WindowControlsInsets; }
|
|
21
|
+
// Forward declaration of `MainMenuConfig` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::reactnativedeviceutils { struct MainMenuConfig; }
|
|
23
|
+
// Forward declaration of `MainMenuLink` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::reactnativedeviceutils { struct MainMenuLink; }
|
|
25
|
+
// Forward declaration of `MainMenuCommand` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::reactnativedeviceutils { enum class MainMenuCommand; }
|
|
19
27
|
// Forward declaration of `LaunchOptions` to properly resolve imports.
|
|
20
28
|
namespace margelo::nitro::reactnativedeviceutils { struct LaunchOptions; }
|
|
21
29
|
// Forward declaration of `WebViewPackageInfo` to properly resolve imports.
|
|
@@ -32,8 +40,12 @@ namespace margelo::nitro::reactnativedeviceutils { enum class InstallerPackageNa
|
|
|
32
40
|
#include <NitroModules/Promise.hpp>
|
|
33
41
|
#include <functional>
|
|
34
42
|
#include "UserInterfaceStyle.hpp"
|
|
35
|
-
#include "
|
|
43
|
+
#include "WindowControlsInsets.hpp"
|
|
44
|
+
#include "MainMenuConfig.hpp"
|
|
36
45
|
#include <string>
|
|
46
|
+
#include "MainMenuLink.hpp"
|
|
47
|
+
#include "MainMenuCommand.hpp"
|
|
48
|
+
#include "LaunchOptions.hpp"
|
|
37
49
|
#include <optional>
|
|
38
50
|
#include <variant>
|
|
39
51
|
#include "WebViewPackageInfo.hpp"
|
|
@@ -161,6 +173,48 @@ namespace margelo::nitro::reactnativedeviceutils {
|
|
|
161
173
|
std::rethrow_exception(__result.error());
|
|
162
174
|
}
|
|
163
175
|
}
|
|
176
|
+
inline WindowControlsInsets getWindowControlsInsets() override {
|
|
177
|
+
auto __result = _swiftPart.getWindowControlsInsets();
|
|
178
|
+
if (__result.hasError()) [[unlikely]] {
|
|
179
|
+
std::rethrow_exception(__result.error());
|
|
180
|
+
}
|
|
181
|
+
auto __value = std::move(__result.value());
|
|
182
|
+
return __value;
|
|
183
|
+
}
|
|
184
|
+
inline double addWindowControlsInsetsChangedListener(const std::function<void(const WindowControlsInsets& /* insets */)>& callback) override {
|
|
185
|
+
auto __result = _swiftPart.addWindowControlsInsetsChangedListener(callback);
|
|
186
|
+
if (__result.hasError()) [[unlikely]] {
|
|
187
|
+
std::rethrow_exception(__result.error());
|
|
188
|
+
}
|
|
189
|
+
auto __value = std::move(__result.value());
|
|
190
|
+
return __value;
|
|
191
|
+
}
|
|
192
|
+
inline void removeWindowControlsInsetsChangedListener(double id) override {
|
|
193
|
+
auto __result = _swiftPart.removeWindowControlsInsetsChangedListener(std::forward<decltype(id)>(id));
|
|
194
|
+
if (__result.hasError()) [[unlikely]] {
|
|
195
|
+
std::rethrow_exception(__result.error());
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
inline void setMainMenuConfig(const MainMenuConfig& config) override {
|
|
199
|
+
auto __result = _swiftPart.setMainMenuConfig(std::forward<decltype(config)>(config));
|
|
200
|
+
if (__result.hasError()) [[unlikely]] {
|
|
201
|
+
std::rethrow_exception(__result.error());
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
inline double addMainMenuCommandListener(const std::function<void(MainMenuCommand /* command */)>& callback) override {
|
|
205
|
+
auto __result = _swiftPart.addMainMenuCommandListener(callback);
|
|
206
|
+
if (__result.hasError()) [[unlikely]] {
|
|
207
|
+
std::rethrow_exception(__result.error());
|
|
208
|
+
}
|
|
209
|
+
auto __value = std::move(__result.value());
|
|
210
|
+
return __value;
|
|
211
|
+
}
|
|
212
|
+
inline void removeMainMenuCommandListener(double id) override {
|
|
213
|
+
auto __result = _swiftPart.removeMainMenuCommandListener(std::forward<decltype(id)>(id));
|
|
214
|
+
if (__result.hasError()) [[unlikely]] {
|
|
215
|
+
std::rethrow_exception(__result.error());
|
|
216
|
+
}
|
|
217
|
+
}
|
|
164
218
|
inline std::shared_ptr<Promise<LaunchOptions>> getLaunchOptions() override {
|
|
165
219
|
auto __result = _swiftPart.getLaunchOptions();
|
|
166
220
|
if (__result.hasError()) [[unlikely]] {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_MainMenuCommand.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ command: MainMenuCommand) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_MainMenuCommand {
|
|
15
|
+
public typealias bridge = margelo.nitro.reactnativedeviceutils.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ command: MainMenuCommand) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ command: MainMenuCommand) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(command: Int32) -> Void {
|
|
25
|
+
self.closure(margelo.nitro.reactnativedeviceutils.MainMenuCommand(rawValue: command)!)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_MainMenuCommand`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_MainMenuCommand>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_MainMenuCommand {
|
|
44
|
+
return Unmanaged<Func_void_MainMenuCommand>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_WindowControlsInsets.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ insets: WindowControlsInsets) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_WindowControlsInsets {
|
|
15
|
+
public typealias bridge = margelo.nitro.reactnativedeviceutils.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ insets: WindowControlsInsets) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ insets: WindowControlsInsets) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(insets: WindowControlsInsets) -> Void {
|
|
25
|
+
self.closure(insets)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_WindowControlsInsets`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_WindowControlsInsets>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_WindowControlsInsets {
|
|
44
|
+
return Unmanaged<Func_void_WindowControlsInsets>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -23,6 +23,12 @@ public protocol HybridReactNativeDeviceUtilsSpec_protocol: HybridObject {
|
|
|
23
23
|
func addSpanningChangedListener(callback: @escaping (_ isSpanning: Bool) -> Void) throws -> Double
|
|
24
24
|
func removeSpanningChangedListener(id: Double) throws -> Void
|
|
25
25
|
func setUserInterfaceStyle(style: UserInterfaceStyle) throws -> Void
|
|
26
|
+
func getWindowControlsInsets() throws -> WindowControlsInsets
|
|
27
|
+
func addWindowControlsInsetsChangedListener(callback: @escaping (_ insets: WindowControlsInsets) -> Void) throws -> Double
|
|
28
|
+
func removeWindowControlsInsetsChangedListener(id: Double) throws -> Void
|
|
29
|
+
func setMainMenuConfig(config: MainMenuConfig) throws -> Void
|
|
30
|
+
func addMainMenuCommandListener(callback: @escaping (_ command: MainMenuCommand) -> Void) throws -> Double
|
|
31
|
+
func removeMainMenuCommandListener(id: Double) throws -> Void
|
|
26
32
|
func getLaunchOptions() throws -> Promise<LaunchOptions>
|
|
27
33
|
func clearLaunchOptions() throws -> Promise<Bool>
|
|
28
34
|
func getDeviceToken() throws -> Promise<String>
|
|
@@ -264,6 +264,85 @@ open class HybridReactNativeDeviceUtilsSpec_cxx {
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
+
@inline(__always)
|
|
268
|
+
public final func getWindowControlsInsets() -> bridge.Result_WindowControlsInsets_ {
|
|
269
|
+
do {
|
|
270
|
+
let __result = try self.__implementation.getWindowControlsInsets()
|
|
271
|
+
let __resultCpp = __result
|
|
272
|
+
return bridge.create_Result_WindowControlsInsets_(__resultCpp)
|
|
273
|
+
} catch (let __error) {
|
|
274
|
+
let __exceptionPtr = __error.toCpp()
|
|
275
|
+
return bridge.create_Result_WindowControlsInsets_(__exceptionPtr)
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
@inline(__always)
|
|
280
|
+
public final func addWindowControlsInsetsChangedListener(callback: bridge.Func_void_WindowControlsInsets) -> bridge.Result_double_ {
|
|
281
|
+
do {
|
|
282
|
+
let __result = try self.__implementation.addWindowControlsInsetsChangedListener(callback: { () -> (WindowControlsInsets) -> Void in
|
|
283
|
+
let __wrappedFunction = bridge.wrap_Func_void_WindowControlsInsets(callback)
|
|
284
|
+
return { (__insets: WindowControlsInsets) -> Void in
|
|
285
|
+
__wrappedFunction.call(__insets)
|
|
286
|
+
}
|
|
287
|
+
}())
|
|
288
|
+
let __resultCpp = __result
|
|
289
|
+
return bridge.create_Result_double_(__resultCpp)
|
|
290
|
+
} catch (let __error) {
|
|
291
|
+
let __exceptionPtr = __error.toCpp()
|
|
292
|
+
return bridge.create_Result_double_(__exceptionPtr)
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
@inline(__always)
|
|
297
|
+
public final func removeWindowControlsInsetsChangedListener(id: Double) -> bridge.Result_void_ {
|
|
298
|
+
do {
|
|
299
|
+
try self.__implementation.removeWindowControlsInsetsChangedListener(id: id)
|
|
300
|
+
return bridge.create_Result_void_()
|
|
301
|
+
} catch (let __error) {
|
|
302
|
+
let __exceptionPtr = __error.toCpp()
|
|
303
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
@inline(__always)
|
|
308
|
+
public final func setMainMenuConfig(config: MainMenuConfig) -> bridge.Result_void_ {
|
|
309
|
+
do {
|
|
310
|
+
try self.__implementation.setMainMenuConfig(config: config)
|
|
311
|
+
return bridge.create_Result_void_()
|
|
312
|
+
} catch (let __error) {
|
|
313
|
+
let __exceptionPtr = __error.toCpp()
|
|
314
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
@inline(__always)
|
|
319
|
+
public final func addMainMenuCommandListener(callback: bridge.Func_void_MainMenuCommand) -> bridge.Result_double_ {
|
|
320
|
+
do {
|
|
321
|
+
let __result = try self.__implementation.addMainMenuCommandListener(callback: { () -> (MainMenuCommand) -> Void in
|
|
322
|
+
let __wrappedFunction = bridge.wrap_Func_void_MainMenuCommand(callback)
|
|
323
|
+
return { (__command: MainMenuCommand) -> Void in
|
|
324
|
+
__wrappedFunction.call(__command.rawValue)
|
|
325
|
+
}
|
|
326
|
+
}())
|
|
327
|
+
let __resultCpp = __result
|
|
328
|
+
return bridge.create_Result_double_(__resultCpp)
|
|
329
|
+
} catch (let __error) {
|
|
330
|
+
let __exceptionPtr = __error.toCpp()
|
|
331
|
+
return bridge.create_Result_double_(__exceptionPtr)
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
@inline(__always)
|
|
336
|
+
public final func removeMainMenuCommandListener(id: Double) -> bridge.Result_void_ {
|
|
337
|
+
do {
|
|
338
|
+
try self.__implementation.removeMainMenuCommandListener(id: id)
|
|
339
|
+
return bridge.create_Result_void_()
|
|
340
|
+
} catch (let __error) {
|
|
341
|
+
let __exceptionPtr = __error.toCpp()
|
|
342
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
267
346
|
@inline(__always)
|
|
268
347
|
public final func getLaunchOptions() -> bridge.Result_std__shared_ptr_Promise_LaunchOptions___ {
|
|
269
348
|
do {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MainMenuCommand.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `MainMenuCommand`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias MainMenuCommand = margelo.nitro.reactnativedeviceutils.MainMenuCommand
|
|
12
|
+
|
|
13
|
+
public extension MainMenuCommand {
|
|
14
|
+
/**
|
|
15
|
+
* Get a MainMenuCommand for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "about":
|
|
21
|
+
self = .about
|
|
22
|
+
case "preferences":
|
|
23
|
+
self = .preferences
|
|
24
|
+
case "lockNow":
|
|
25
|
+
self = .locknow
|
|
26
|
+
default:
|
|
27
|
+
return nil
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get the String value this MainMenuCommand represents.
|
|
33
|
+
*/
|
|
34
|
+
var stringValue: String {
|
|
35
|
+
switch self {
|
|
36
|
+
case .about:
|
|
37
|
+
return "about"
|
|
38
|
+
case .preferences:
|
|
39
|
+
return "preferences"
|
|
40
|
+
case .locknow:
|
|
41
|
+
return "lockNow"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MainMenuConfig.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `MainMenuConfig`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias MainMenuConfig = margelo.nitro.reactnativedeviceutils.MainMenuConfig
|
|
14
|
+
|
|
15
|
+
public extension MainMenuConfig {
|
|
16
|
+
private typealias bridge = margelo.nitro.reactnativedeviceutils.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `MainMenuConfig`.
|
|
20
|
+
*/
|
|
21
|
+
init(aboutTitle: String, preferencesTitle: String, lockNowTitle: String, helpLinks: [MainMenuLink]) {
|
|
22
|
+
self.init(std.string(aboutTitle), std.string(preferencesTitle), std.string(lockNowTitle), { () -> bridge.std__vector_MainMenuLink_ in
|
|
23
|
+
var __vector = bridge.create_std__vector_MainMenuLink_(helpLinks.count)
|
|
24
|
+
for __item in helpLinks {
|
|
25
|
+
__vector.push_back(__item)
|
|
26
|
+
}
|
|
27
|
+
return __vector
|
|
28
|
+
}())
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@inline(__always)
|
|
32
|
+
var aboutTitle: String {
|
|
33
|
+
return String(self.__aboutTitle)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@inline(__always)
|
|
37
|
+
var preferencesTitle: String {
|
|
38
|
+
return String(self.__preferencesTitle)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@inline(__always)
|
|
42
|
+
var lockNowTitle: String {
|
|
43
|
+
return String(self.__lockNowTitle)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@inline(__always)
|
|
47
|
+
var helpLinks: [MainMenuLink] {
|
|
48
|
+
return self.__helpLinks.map({ __item in __item })
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MainMenuLink.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `MainMenuLink`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias MainMenuLink = margelo.nitro.reactnativedeviceutils.MainMenuLink
|
|
14
|
+
|
|
15
|
+
public extension MainMenuLink {
|
|
16
|
+
private typealias bridge = margelo.nitro.reactnativedeviceutils.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `MainMenuLink`.
|
|
20
|
+
*/
|
|
21
|
+
init(title: String, url: String) {
|
|
22
|
+
self.init(std.string(title), std.string(url))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@inline(__always)
|
|
26
|
+
var title: String {
|
|
27
|
+
return String(self.__title)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@inline(__always)
|
|
31
|
+
var url: String {
|
|
32
|
+
return String(self.__url)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WindowControlsInsets.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `WindowControlsInsets`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias WindowControlsInsets = margelo.nitro.reactnativedeviceutils.WindowControlsInsets
|
|
14
|
+
|
|
15
|
+
public extension WindowControlsInsets {
|
|
16
|
+
private typealias bridge = margelo.nitro.reactnativedeviceutils.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `WindowControlsInsets`.
|
|
20
|
+
*/
|
|
21
|
+
init(top: Double, left: Double, bottom: Double, right: Double) {
|
|
22
|
+
self.init(top, left, bottom, right)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@inline(__always)
|
|
26
|
+
var top: Double {
|
|
27
|
+
return self.__top
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@inline(__always)
|
|
31
|
+
var left: Double {
|
|
32
|
+
return self.__left
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@inline(__always)
|
|
36
|
+
var bottom: Double {
|
|
37
|
+
return self.__bottom
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@inline(__always)
|
|
41
|
+
var right: Double {
|
|
42
|
+
return self.__right
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -24,6 +24,12 @@ namespace margelo::nitro::reactnativedeviceutils {
|
|
|
24
24
|
prototype.registerHybridMethod("addSpanningChangedListener", &HybridReactNativeDeviceUtilsSpec::addSpanningChangedListener);
|
|
25
25
|
prototype.registerHybridMethod("removeSpanningChangedListener", &HybridReactNativeDeviceUtilsSpec::removeSpanningChangedListener);
|
|
26
26
|
prototype.registerHybridMethod("setUserInterfaceStyle", &HybridReactNativeDeviceUtilsSpec::setUserInterfaceStyle);
|
|
27
|
+
prototype.registerHybridMethod("getWindowControlsInsets", &HybridReactNativeDeviceUtilsSpec::getWindowControlsInsets);
|
|
28
|
+
prototype.registerHybridMethod("addWindowControlsInsetsChangedListener", &HybridReactNativeDeviceUtilsSpec::addWindowControlsInsetsChangedListener);
|
|
29
|
+
prototype.registerHybridMethod("removeWindowControlsInsetsChangedListener", &HybridReactNativeDeviceUtilsSpec::removeWindowControlsInsetsChangedListener);
|
|
30
|
+
prototype.registerHybridMethod("setMainMenuConfig", &HybridReactNativeDeviceUtilsSpec::setMainMenuConfig);
|
|
31
|
+
prototype.registerHybridMethod("addMainMenuCommandListener", &HybridReactNativeDeviceUtilsSpec::addMainMenuCommandListener);
|
|
32
|
+
prototype.registerHybridMethod("removeMainMenuCommandListener", &HybridReactNativeDeviceUtilsSpec::removeMainMenuCommandListener);
|
|
27
33
|
prototype.registerHybridMethod("getLaunchOptions", &HybridReactNativeDeviceUtilsSpec::getLaunchOptions);
|
|
28
34
|
prototype.registerHybridMethod("clearLaunchOptions", &HybridReactNativeDeviceUtilsSpec::clearLaunchOptions);
|
|
29
35
|
prototype.registerHybridMethod("getDeviceToken", &HybridReactNativeDeviceUtilsSpec::getDeviceToken);
|