@onekeyfe/react-native-device-utils 6.7.0-alpha.385 → 6.7.0-alpha.386
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/android/src/main/java/com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtils.kt +29 -0
- package/ios/DualScreenDetector.swift +158 -0
- package/ios/MainMenuController.swift +170 -0
- package/ios/ReactNativeDeviceUtils.swift +29 -4
- package/ios/WindowControlsInsetsObserver.swift +149 -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 +1 -1
- package/src/ReactNativeDeviceUtils.nitro.ts +54 -0
|
@@ -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);
|
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
namespace margelo::nitro::reactnativedeviceutils { struct DualScreenInfoRect; }
|
|
18
18
|
// Forward declaration of `UserInterfaceStyle` to properly resolve imports.
|
|
19
19
|
namespace margelo::nitro::reactnativedeviceutils { enum class UserInterfaceStyle; }
|
|
20
|
+
// Forward declaration of `WindowControlsInsets` to properly resolve imports.
|
|
21
|
+
namespace margelo::nitro::reactnativedeviceutils { struct WindowControlsInsets; }
|
|
22
|
+
// Forward declaration of `MainMenuConfig` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::reactnativedeviceutils { struct MainMenuConfig; }
|
|
24
|
+
// Forward declaration of `MainMenuCommand` to properly resolve imports.
|
|
25
|
+
namespace margelo::nitro::reactnativedeviceutils { enum class MainMenuCommand; }
|
|
20
26
|
// Forward declaration of `LaunchOptions` to properly resolve imports.
|
|
21
27
|
namespace margelo::nitro::reactnativedeviceutils { struct LaunchOptions; }
|
|
22
28
|
// Forward declaration of `WebViewPackageInfo` to properly resolve imports.
|
|
@@ -33,6 +39,9 @@ namespace margelo::nitro::reactnativedeviceutils { enum class InstallerPackageNa
|
|
|
33
39
|
#include <NitroModules/Promise.hpp>
|
|
34
40
|
#include <functional>
|
|
35
41
|
#include "UserInterfaceStyle.hpp"
|
|
42
|
+
#include "WindowControlsInsets.hpp"
|
|
43
|
+
#include "MainMenuConfig.hpp"
|
|
44
|
+
#include "MainMenuCommand.hpp"
|
|
36
45
|
#include "LaunchOptions.hpp"
|
|
37
46
|
#include <string>
|
|
38
47
|
#include <variant>
|
|
@@ -83,6 +92,12 @@ namespace margelo::nitro::reactnativedeviceutils {
|
|
|
83
92
|
virtual double addSpanningChangedListener(const std::function<void(bool /* isSpanning */)>& callback) = 0;
|
|
84
93
|
virtual void removeSpanningChangedListener(double id) = 0;
|
|
85
94
|
virtual void setUserInterfaceStyle(UserInterfaceStyle style) = 0;
|
|
95
|
+
virtual WindowControlsInsets getWindowControlsInsets() = 0;
|
|
96
|
+
virtual double addWindowControlsInsetsChangedListener(const std::function<void(const WindowControlsInsets& /* insets */)>& callback) = 0;
|
|
97
|
+
virtual void removeWindowControlsInsetsChangedListener(double id) = 0;
|
|
98
|
+
virtual void setMainMenuConfig(const MainMenuConfig& config) = 0;
|
|
99
|
+
virtual double addMainMenuCommandListener(const std::function<void(MainMenuCommand /* command */)>& callback) = 0;
|
|
100
|
+
virtual void removeMainMenuCommandListener(double id) = 0;
|
|
86
101
|
virtual std::shared_ptr<Promise<LaunchOptions>> getLaunchOptions() = 0;
|
|
87
102
|
virtual std::shared_ptr<Promise<bool>> clearLaunchOptions() = 0;
|
|
88
103
|
virtual std::shared_ptr<Promise<std::string>> getDeviceToken() = 0;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MainMenuCommand.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::reactnativedeviceutils {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (MainMenuCommand).
|
|
30
|
+
*/
|
|
31
|
+
enum class MainMenuCommand {
|
|
32
|
+
ABOUT SWIFT_NAME(about) = 0,
|
|
33
|
+
PREFERENCES SWIFT_NAME(preferences) = 1,
|
|
34
|
+
LOCKNOW SWIFT_NAME(locknow) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::reactnativedeviceutils
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ MainMenuCommand <> JS MainMenuCommand (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::reactnativedeviceutils::MainMenuCommand> final {
|
|
44
|
+
static inline margelo::nitro::reactnativedeviceutils::MainMenuCommand fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("about"): return margelo::nitro::reactnativedeviceutils::MainMenuCommand::ABOUT;
|
|
48
|
+
case hashString("preferences"): return margelo::nitro::reactnativedeviceutils::MainMenuCommand::PREFERENCES;
|
|
49
|
+
case hashString("lockNow"): return margelo::nitro::reactnativedeviceutils::MainMenuCommand::LOCKNOW;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum MainMenuCommand - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::reactnativedeviceutils::MainMenuCommand arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::reactnativedeviceutils::MainMenuCommand::ABOUT: return JSIConverter<std::string>::toJSI(runtime, "about");
|
|
57
|
+
case margelo::nitro::reactnativedeviceutils::MainMenuCommand::PREFERENCES: return JSIConverter<std::string>::toJSI(runtime, "preferences");
|
|
58
|
+
case margelo::nitro::reactnativedeviceutils::MainMenuCommand::LOCKNOW: return JSIConverter<std::string>::toJSI(runtime, "lockNow");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert MainMenuCommand to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("about"):
|
|
71
|
+
case hashString("preferences"):
|
|
72
|
+
case hashString("lockNow"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MainMenuConfig.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `MainMenuLink` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::reactnativedeviceutils { struct MainMenuLink; }
|
|
33
|
+
|
|
34
|
+
#include <string>
|
|
35
|
+
#include "MainMenuLink.hpp"
|
|
36
|
+
#include <vector>
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro::reactnativedeviceutils {
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A struct which can be represented as a JavaScript object (MainMenuConfig).
|
|
42
|
+
*/
|
|
43
|
+
struct MainMenuConfig final {
|
|
44
|
+
public:
|
|
45
|
+
std::string aboutTitle SWIFT_PRIVATE;
|
|
46
|
+
std::string preferencesTitle SWIFT_PRIVATE;
|
|
47
|
+
std::string lockNowTitle SWIFT_PRIVATE;
|
|
48
|
+
std::vector<MainMenuLink> helpLinks SWIFT_PRIVATE;
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
MainMenuConfig() = default;
|
|
52
|
+
explicit MainMenuConfig(std::string aboutTitle, std::string preferencesTitle, std::string lockNowTitle, std::vector<MainMenuLink> helpLinks): aboutTitle(aboutTitle), preferencesTitle(preferencesTitle), lockNowTitle(lockNowTitle), helpLinks(helpLinks) {}
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
friend bool operator==(const MainMenuConfig& lhs, const MainMenuConfig& rhs) = default;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
} // namespace margelo::nitro::reactnativedeviceutils
|
|
59
|
+
|
|
60
|
+
namespace margelo::nitro {
|
|
61
|
+
|
|
62
|
+
// C++ MainMenuConfig <> JS MainMenuConfig (object)
|
|
63
|
+
template <>
|
|
64
|
+
struct JSIConverter<margelo::nitro::reactnativedeviceutils::MainMenuConfig> final {
|
|
65
|
+
static inline margelo::nitro::reactnativedeviceutils::MainMenuConfig fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
66
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
67
|
+
return margelo::nitro::reactnativedeviceutils::MainMenuConfig(
|
|
68
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "aboutTitle"))),
|
|
69
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preferencesTitle"))),
|
|
70
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "lockNowTitle"))),
|
|
71
|
+
JSIConverter<std::vector<margelo::nitro::reactnativedeviceutils::MainMenuLink>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "helpLinks")))
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativedeviceutils::MainMenuConfig& arg) {
|
|
75
|
+
jsi::Object obj(runtime);
|
|
76
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "aboutTitle"), JSIConverter<std::string>::toJSI(runtime, arg.aboutTitle));
|
|
77
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "preferencesTitle"), JSIConverter<std::string>::toJSI(runtime, arg.preferencesTitle));
|
|
78
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "lockNowTitle"), JSIConverter<std::string>::toJSI(runtime, arg.lockNowTitle));
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "helpLinks"), JSIConverter<std::vector<margelo::nitro::reactnativedeviceutils::MainMenuLink>>::toJSI(runtime, arg.helpLinks));
|
|
80
|
+
return obj;
|
|
81
|
+
}
|
|
82
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
83
|
+
if (!value.isObject()) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
jsi::Object obj = value.getObject(runtime);
|
|
87
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "aboutTitle")))) return false;
|
|
91
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "preferencesTitle")))) return false;
|
|
92
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "lockNowTitle")))) return false;
|
|
93
|
+
if (!JSIConverter<std::vector<margelo::nitro::reactnativedeviceutils::MainMenuLink>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "helpLinks")))) return false;
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MainMenuLink.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <string>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::reactnativedeviceutils {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (MainMenuLink).
|
|
39
|
+
*/
|
|
40
|
+
struct MainMenuLink final {
|
|
41
|
+
public:
|
|
42
|
+
std::string title SWIFT_PRIVATE;
|
|
43
|
+
std::string url SWIFT_PRIVATE;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
MainMenuLink() = default;
|
|
47
|
+
explicit MainMenuLink(std::string title, std::string url): title(title), url(url) {}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
friend bool operator==(const MainMenuLink& lhs, const MainMenuLink& rhs) = default;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::reactnativedeviceutils
|
|
54
|
+
|
|
55
|
+
namespace margelo::nitro {
|
|
56
|
+
|
|
57
|
+
// C++ MainMenuLink <> JS MainMenuLink (object)
|
|
58
|
+
template <>
|
|
59
|
+
struct JSIConverter<margelo::nitro::reactnativedeviceutils::MainMenuLink> final {
|
|
60
|
+
static inline margelo::nitro::reactnativedeviceutils::MainMenuLink fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
61
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
62
|
+
return margelo::nitro::reactnativedeviceutils::MainMenuLink(
|
|
63
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "title"))),
|
|
64
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "url")))
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativedeviceutils::MainMenuLink& arg) {
|
|
68
|
+
jsi::Object obj(runtime);
|
|
69
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "title"), JSIConverter<std::string>::toJSI(runtime, arg.title));
|
|
70
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "url"), JSIConverter<std::string>::toJSI(runtime, arg.url));
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
74
|
+
if (!value.isObject()) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
jsi::Object obj = value.getObject(runtime);
|
|
78
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "title")))) return false;
|
|
82
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "url")))) return false;
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
} // namespace margelo::nitro
|