@onekeyfe/react-native-device-utils 6.7.0-19 → 6.7.0-20
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 +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 +1 -1
- package/src/ReactNativeDeviceUtils.nitro.ts +54 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_WindowControlsInsets.kt
|
|
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
|
+
package com.margelo.nitro.reactnativedeviceutils
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `(insets: struct) => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void_WindowControlsInsets: (WindowControlsInsets) -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(insets: WindowControlsInsets): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(insets: struct) => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_WindowControlsInsets_cxx: Func_void_WindowControlsInsets {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(insets: WindowControlsInsets): Unit
|
|
59
|
+
= invoke_cxx(insets)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(insets: WindowControlsInsets): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(insets: struct) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(WindowControlsInsets) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_WindowControlsInsets_java(private val function: (WindowControlsInsets) -> Unit): Func_void_WindowControlsInsets {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(insets: WindowControlsInsets): Unit {
|
|
76
|
+
return this.function(insets)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -75,6 +75,40 @@ abstract class HybridReactNativeDeviceUtilsSpec: HybridObject() {
|
|
|
75
75
|
@Keep
|
|
76
76
|
abstract fun setUserInterfaceStyle(style: UserInterfaceStyle): Unit
|
|
77
77
|
|
|
78
|
+
@DoNotStrip
|
|
79
|
+
@Keep
|
|
80
|
+
abstract fun getWindowControlsInsets(): WindowControlsInsets
|
|
81
|
+
|
|
82
|
+
abstract fun addWindowControlsInsetsChangedListener(callback: (insets: WindowControlsInsets) -> Unit): Double
|
|
83
|
+
|
|
84
|
+
@DoNotStrip
|
|
85
|
+
@Keep
|
|
86
|
+
private fun addWindowControlsInsetsChangedListener_cxx(callback: Func_void_WindowControlsInsets): Double {
|
|
87
|
+
val __result = addWindowControlsInsetsChangedListener(callback)
|
|
88
|
+
return __result
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@DoNotStrip
|
|
92
|
+
@Keep
|
|
93
|
+
abstract fun removeWindowControlsInsetsChangedListener(id: Double): Unit
|
|
94
|
+
|
|
95
|
+
@DoNotStrip
|
|
96
|
+
@Keep
|
|
97
|
+
abstract fun setMainMenuConfig(config: MainMenuConfig): Unit
|
|
98
|
+
|
|
99
|
+
abstract fun addMainMenuCommandListener(callback: (command: MainMenuCommand) -> Unit): Double
|
|
100
|
+
|
|
101
|
+
@DoNotStrip
|
|
102
|
+
@Keep
|
|
103
|
+
private fun addMainMenuCommandListener_cxx(callback: Func_void_MainMenuCommand): Double {
|
|
104
|
+
val __result = addMainMenuCommandListener(callback)
|
|
105
|
+
return __result
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@DoNotStrip
|
|
109
|
+
@Keep
|
|
110
|
+
abstract fun removeMainMenuCommandListener(id: Double): Unit
|
|
111
|
+
|
|
78
112
|
@DoNotStrip
|
|
79
113
|
@Keep
|
|
80
114
|
abstract fun getLaunchOptions(): Promise<LaunchOptions>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MainMenuCommand.kt
|
|
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
|
+
package com.margelo.nitro.reactnativedeviceutils
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "MainMenuCommand".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class MainMenuCommand(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
ABOUT(0),
|
|
20
|
+
PREFERENCES(1),
|
|
21
|
+
LOCKNOW(2);
|
|
22
|
+
|
|
23
|
+
companion object
|
|
24
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/MainMenuConfig.kt
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MainMenuConfig.kt
|
|
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
|
+
package com.margelo.nitro.reactnativedeviceutils
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "MainMenuConfig".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class MainMenuConfig(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val aboutTitle: String,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val preferencesTitle: String,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val lockNowTitle: String,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val helpLinks: Array<MainMenuLink>
|
|
33
|
+
) {
|
|
34
|
+
/* primary constructor */
|
|
35
|
+
|
|
36
|
+
override fun equals(other: Any?): Boolean {
|
|
37
|
+
if (this === other) return true
|
|
38
|
+
if (other !is MainMenuConfig) return false
|
|
39
|
+
return Objects.deepEquals(this.aboutTitle, other.aboutTitle)
|
|
40
|
+
&& Objects.deepEquals(this.preferencesTitle, other.preferencesTitle)
|
|
41
|
+
&& Objects.deepEquals(this.lockNowTitle, other.lockNowTitle)
|
|
42
|
+
&& Objects.deepEquals(this.helpLinks, other.helpLinks)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
override fun hashCode(): Int {
|
|
46
|
+
return arrayOf<Any?>(
|
|
47
|
+
aboutTitle,
|
|
48
|
+
preferencesTitle,
|
|
49
|
+
lockNowTitle,
|
|
50
|
+
helpLinks
|
|
51
|
+
).contentDeepHashCode()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
companion object {
|
|
55
|
+
/**
|
|
56
|
+
* Constructor called from C++
|
|
57
|
+
*/
|
|
58
|
+
@DoNotStrip
|
|
59
|
+
@Keep
|
|
60
|
+
@Suppress("unused")
|
|
61
|
+
@JvmStatic
|
|
62
|
+
private fun fromCpp(aboutTitle: String, preferencesTitle: String, lockNowTitle: String, helpLinks: Array<MainMenuLink>): MainMenuConfig {
|
|
63
|
+
return MainMenuConfig(aboutTitle, preferencesTitle, lockNowTitle, helpLinks)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/MainMenuLink.kt
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MainMenuLink.kt
|
|
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
|
+
package com.margelo.nitro.reactnativedeviceutils
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "MainMenuLink".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class MainMenuLink(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val title: String,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val url: String
|
|
27
|
+
) {
|
|
28
|
+
/* primary constructor */
|
|
29
|
+
|
|
30
|
+
override fun equals(other: Any?): Boolean {
|
|
31
|
+
if (this === other) return true
|
|
32
|
+
if (other !is MainMenuLink) return false
|
|
33
|
+
return Objects.deepEquals(this.title, other.title)
|
|
34
|
+
&& Objects.deepEquals(this.url, other.url)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override fun hashCode(): Int {
|
|
38
|
+
return arrayOf<Any?>(
|
|
39
|
+
title,
|
|
40
|
+
url
|
|
41
|
+
).contentDeepHashCode()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
companion object {
|
|
45
|
+
/**
|
|
46
|
+
* Constructor called from C++
|
|
47
|
+
*/
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
@Suppress("unused")
|
|
51
|
+
@JvmStatic
|
|
52
|
+
private fun fromCpp(title: String, url: String): MainMenuLink {
|
|
53
|
+
return MainMenuLink(title, url)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WindowControlsInsets.kt
|
|
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
|
+
package com.margelo.nitro.reactnativedeviceutils
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "WindowControlsInsets".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class WindowControlsInsets(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val top: Double,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val left: Double,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val bottom: Double,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val right: Double
|
|
33
|
+
) {
|
|
34
|
+
/* primary constructor */
|
|
35
|
+
|
|
36
|
+
override fun equals(other: Any?): Boolean {
|
|
37
|
+
if (this === other) return true
|
|
38
|
+
if (other !is WindowControlsInsets) return false
|
|
39
|
+
return Objects.deepEquals(this.top, other.top)
|
|
40
|
+
&& Objects.deepEquals(this.left, other.left)
|
|
41
|
+
&& Objects.deepEquals(this.bottom, other.bottom)
|
|
42
|
+
&& Objects.deepEquals(this.right, other.right)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
override fun hashCode(): Int {
|
|
46
|
+
return arrayOf<Any?>(
|
|
47
|
+
top,
|
|
48
|
+
left,
|
|
49
|
+
bottom,
|
|
50
|
+
right
|
|
51
|
+
).contentDeepHashCode()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
companion object {
|
|
55
|
+
/**
|
|
56
|
+
* Constructor called from C++
|
|
57
|
+
*/
|
|
58
|
+
@DoNotStrip
|
|
59
|
+
@Keep
|
|
60
|
+
@Suppress("unused")
|
|
61
|
+
@JvmStatic
|
|
62
|
+
private fun fromCpp(top: Double, left: Double, bottom: Double, right: Double): WindowControlsInsets {
|
|
63
|
+
return WindowControlsInsets(top, left, bottom, right)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -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
|
+
}
|