@onekeyfe/react-native-device-utils 1.1.20 → 1.1.21
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/build.gradle +4 -1
- package/android/src/main/java/com/margelo/nitro/reactnativedeviceutils/ReactNativeDeviceUtils.kt +138 -0
- package/ios/ReactNativeDeviceUtils.swift +105 -0
- package/lib/typescript/src/ReactNativeDeviceUtils.nitro.d.ts +22 -0
- package/lib/typescript/src/ReactNativeDeviceUtils.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JGooglePlayServicesStatus.hpp +61 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeDeviceUtilsSpec.cpp +145 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeDeviceUtilsSpec.hpp +9 -0
- package/nitrogen/generated/android/c++/JLaunchOptions.hpp +62 -0
- package/nitrogen/generated/android/c++/JWebViewPackageInfo.hpp +65 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/GooglePlayServicesStatus.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/HybridReactNativeDeviceUtilsSpec.kt +36 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/LaunchOptions.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativedeviceutils/WebViewPackageInfo.kt +44 -0
- package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Bridge.cpp +48 -0
- package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Bridge.hpp +305 -0
- package/nitrogen/generated/ios/ReactNativeDeviceUtils-Swift-Cxx-Umbrella.hpp +11 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeDeviceUtilsSpecSwift.hpp +81 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_GooglePlayServicesStatus.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_LaunchOptions.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_WebViewPackageInfo.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/GooglePlayServicesStatus.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeDeviceUtilsSpec.swift +9 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeDeviceUtilsSpec_cxx.swift +163 -0
- package/nitrogen/generated/ios/swift/LaunchOptions.swift +66 -0
- package/nitrogen/generated/ios/swift/WebViewPackageInfo.swift +58 -0
- package/nitrogen/generated/shared/c++/GooglePlayServicesStatus.hpp +79 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeDeviceUtilsSpec.cpp +9 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeDeviceUtilsSpec.hpp +19 -0
- package/nitrogen/generated/shared/c++/LaunchOptions.hpp +80 -0
- package/nitrogen/generated/shared/c++/WebViewPackageInfo.hpp +83 -0
- package/package.json +1 -1
- package/src/ReactNativeDeviceUtils.nitro.ts +31 -0
|
@@ -16,12 +16,23 @@ 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 `LaunchOptions` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::reactnativedeviceutils { struct LaunchOptions; }
|
|
21
|
+
// Forward declaration of `WebViewPackageInfo` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::reactnativedeviceutils { struct WebViewPackageInfo; }
|
|
23
|
+
// Forward declaration of `GooglePlayServicesStatus` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::reactnativedeviceutils { struct GooglePlayServicesStatus; }
|
|
19
25
|
|
|
20
26
|
#include "DualScreenInfoRect.hpp"
|
|
21
27
|
#include <vector>
|
|
22
28
|
#include <NitroModules/Promise.hpp>
|
|
23
29
|
#include <functional>
|
|
24
30
|
#include "UserInterfaceStyle.hpp"
|
|
31
|
+
#include "LaunchOptions.hpp"
|
|
32
|
+
#include <string>
|
|
33
|
+
#include <optional>
|
|
34
|
+
#include "WebViewPackageInfo.hpp"
|
|
35
|
+
#include "GooglePlayServicesStatus.hpp"
|
|
25
36
|
|
|
26
37
|
#include "ReactNativeDeviceUtils-Swift-Cxx-Umbrella.hpp"
|
|
27
38
|
|
|
@@ -131,6 +142,76 @@ namespace margelo::nitro::reactnativedeviceutils {
|
|
|
131
142
|
std::rethrow_exception(__result.error());
|
|
132
143
|
}
|
|
133
144
|
}
|
|
145
|
+
inline std::shared_ptr<Promise<LaunchOptions>> getLaunchOptions() override {
|
|
146
|
+
auto __result = _swiftPart.getLaunchOptions();
|
|
147
|
+
if (__result.hasError()) [[unlikely]] {
|
|
148
|
+
std::rethrow_exception(__result.error());
|
|
149
|
+
}
|
|
150
|
+
auto __value = std::move(__result.value());
|
|
151
|
+
return __value;
|
|
152
|
+
}
|
|
153
|
+
inline std::shared_ptr<Promise<bool>> clearLaunchOptions() override {
|
|
154
|
+
auto __result = _swiftPart.clearLaunchOptions();
|
|
155
|
+
if (__result.hasError()) [[unlikely]] {
|
|
156
|
+
std::rethrow_exception(__result.error());
|
|
157
|
+
}
|
|
158
|
+
auto __value = std::move(__result.value());
|
|
159
|
+
return __value;
|
|
160
|
+
}
|
|
161
|
+
inline std::shared_ptr<Promise<std::string>> getDeviceToken() override {
|
|
162
|
+
auto __result = _swiftPart.getDeviceToken();
|
|
163
|
+
if (__result.hasError()) [[unlikely]] {
|
|
164
|
+
std::rethrow_exception(__result.error());
|
|
165
|
+
}
|
|
166
|
+
auto __value = std::move(__result.value());
|
|
167
|
+
return __value;
|
|
168
|
+
}
|
|
169
|
+
inline std::shared_ptr<Promise<void>> saveDeviceToken(const std::string& token) override {
|
|
170
|
+
auto __result = _swiftPart.saveDeviceToken(token);
|
|
171
|
+
if (__result.hasError()) [[unlikely]] {
|
|
172
|
+
std::rethrow_exception(__result.error());
|
|
173
|
+
}
|
|
174
|
+
auto __value = std::move(__result.value());
|
|
175
|
+
return __value;
|
|
176
|
+
}
|
|
177
|
+
inline std::shared_ptr<Promise<bool>> registerDeviceToken() override {
|
|
178
|
+
auto __result = _swiftPart.registerDeviceToken();
|
|
179
|
+
if (__result.hasError()) [[unlikely]] {
|
|
180
|
+
std::rethrow_exception(__result.error());
|
|
181
|
+
}
|
|
182
|
+
auto __value = std::move(__result.value());
|
|
183
|
+
return __value;
|
|
184
|
+
}
|
|
185
|
+
inline std::shared_ptr<Promise<double>> getStartupTime() override {
|
|
186
|
+
auto __result = _swiftPart.getStartupTime();
|
|
187
|
+
if (__result.hasError()) [[unlikely]] {
|
|
188
|
+
std::rethrow_exception(__result.error());
|
|
189
|
+
}
|
|
190
|
+
auto __value = std::move(__result.value());
|
|
191
|
+
return __value;
|
|
192
|
+
}
|
|
193
|
+
inline void exitApp() override {
|
|
194
|
+
auto __result = _swiftPart.exitApp();
|
|
195
|
+
if (__result.hasError()) [[unlikely]] {
|
|
196
|
+
std::rethrow_exception(__result.error());
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
inline std::shared_ptr<Promise<WebViewPackageInfo>> getCurrentWebViewPackageInfo() override {
|
|
200
|
+
auto __result = _swiftPart.getCurrentWebViewPackageInfo();
|
|
201
|
+
if (__result.hasError()) [[unlikely]] {
|
|
202
|
+
std::rethrow_exception(__result.error());
|
|
203
|
+
}
|
|
204
|
+
auto __value = std::move(__result.value());
|
|
205
|
+
return __value;
|
|
206
|
+
}
|
|
207
|
+
inline std::shared_ptr<Promise<GooglePlayServicesStatus>> isGooglePlayServicesAvailable() override {
|
|
208
|
+
auto __result = _swiftPart.isGooglePlayServicesAvailable();
|
|
209
|
+
if (__result.hasError()) [[unlikely]] {
|
|
210
|
+
std::rethrow_exception(__result.error());
|
|
211
|
+
}
|
|
212
|
+
auto __value = std::move(__result.value());
|
|
213
|
+
return __value;
|
|
214
|
+
}
|
|
134
215
|
|
|
135
216
|
private:
|
|
136
217
|
ReactNativeDeviceUtils::HybridReactNativeDeviceUtilsSpec_cxx _swiftPart;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `() -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void {
|
|
16
|
+
public typealias bridge = margelo.nitro.reactnativedeviceutils.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: () -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping () -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call() -> Void {
|
|
26
|
+
self.closure()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void {
|
|
45
|
+
return Unmanaged<Func_void>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_GooglePlayServicesStatus.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ value: GooglePlayServicesStatus) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_GooglePlayServicesStatus {
|
|
16
|
+
public typealias bridge = margelo.nitro.reactnativedeviceutils.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ value: GooglePlayServicesStatus) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ value: GooglePlayServicesStatus) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(value: GooglePlayServicesStatus) -> Void {
|
|
26
|
+
self.closure(value)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_GooglePlayServicesStatus`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_GooglePlayServicesStatus>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_GooglePlayServicesStatus {
|
|
45
|
+
return Unmanaged<Func_void_GooglePlayServicesStatus>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_LaunchOptions.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ value: LaunchOptions) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_LaunchOptions {
|
|
16
|
+
public typealias bridge = margelo.nitro.reactnativedeviceutils.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ value: LaunchOptions) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ value: LaunchOptions) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(value: LaunchOptions) -> Void {
|
|
26
|
+
self.closure(value)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_LaunchOptions`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_LaunchOptions>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_LaunchOptions {
|
|
45
|
+
return Unmanaged<Func_void_LaunchOptions>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_WebViewPackageInfo.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ value: WebViewPackageInfo) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_WebViewPackageInfo {
|
|
16
|
+
public typealias bridge = margelo.nitro.reactnativedeviceutils.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ value: WebViewPackageInfo) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ value: WebViewPackageInfo) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(value: WebViewPackageInfo) -> Void {
|
|
26
|
+
self.closure(value)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_WebViewPackageInfo`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_WebViewPackageInfo>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_WebViewPackageInfo {
|
|
45
|
+
return Unmanaged<Func_void_WebViewPackageInfo>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_double.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ value: Double) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_double {
|
|
16
|
+
public typealias bridge = margelo.nitro.reactnativedeviceutils.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ value: Double) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ value: Double) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(value: Double) -> Void {
|
|
26
|
+
self.closure(value)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_double`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_double>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_double {
|
|
45
|
+
return Unmanaged<Func_void_double>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__string.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ value: String) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_std__string {
|
|
16
|
+
public typealias bridge = margelo.nitro.reactnativedeviceutils.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ value: String) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ value: String) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(value: std.string) -> Void {
|
|
26
|
+
self.closure(String(value))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_std__string`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__string>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__string {
|
|
45
|
+
return Unmanaged<Func_void_std__string>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GooglePlayServicesStatus.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents an instance of `GooglePlayServicesStatus`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias GooglePlayServicesStatus = margelo.nitro.reactnativedeviceutils.GooglePlayServicesStatus
|
|
15
|
+
|
|
16
|
+
public extension GooglePlayServicesStatus {
|
|
17
|
+
private typealias bridge = margelo.nitro.reactnativedeviceutils.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `GooglePlayServicesStatus`.
|
|
21
|
+
*/
|
|
22
|
+
init(status: Double, isAvailable: Bool) {
|
|
23
|
+
self.init(status, isAvailable)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var status: Double {
|
|
27
|
+
@inline(__always)
|
|
28
|
+
get {
|
|
29
|
+
return self.__status
|
|
30
|
+
}
|
|
31
|
+
@inline(__always)
|
|
32
|
+
set {
|
|
33
|
+
self.__status = newValue
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var isAvailable: Bool {
|
|
38
|
+
@inline(__always)
|
|
39
|
+
get {
|
|
40
|
+
return self.__isAvailable
|
|
41
|
+
}
|
|
42
|
+
@inline(__always)
|
|
43
|
+
set {
|
|
44
|
+
self.__isAvailable = newValue
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -23,6 +23,15 @@ 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 getLaunchOptions() throws -> Promise<LaunchOptions>
|
|
27
|
+
func clearLaunchOptions() throws -> Promise<Bool>
|
|
28
|
+
func getDeviceToken() throws -> Promise<String>
|
|
29
|
+
func saveDeviceToken(token: String) throws -> Promise<Void>
|
|
30
|
+
func registerDeviceToken() throws -> Promise<Bool>
|
|
31
|
+
func getStartupTime() throws -> Promise<Double>
|
|
32
|
+
func exitApp() throws -> Void
|
|
33
|
+
func getCurrentWebViewPackageInfo() throws -> Promise<WebViewPackageInfo>
|
|
34
|
+
func isGooglePlayServicesAvailable() throws -> Promise<GooglePlayServicesStatus>
|
|
26
35
|
}
|
|
27
36
|
|
|
28
37
|
public extension HybridReactNativeDeviceUtilsSpec_protocol {
|
|
@@ -245,4 +245,167 @@ open class HybridReactNativeDeviceUtilsSpec_cxx {
|
|
|
245
245
|
return bridge.create_Result_void_(__exceptionPtr)
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
+
|
|
249
|
+
@inline(__always)
|
|
250
|
+
public final func getLaunchOptions() -> bridge.Result_std__shared_ptr_Promise_LaunchOptions___ {
|
|
251
|
+
do {
|
|
252
|
+
let __result = try self.__implementation.getLaunchOptions()
|
|
253
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_LaunchOptions__ in
|
|
254
|
+
let __promise = bridge.create_std__shared_ptr_Promise_LaunchOptions__()
|
|
255
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_LaunchOptions__(__promise)
|
|
256
|
+
__result
|
|
257
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
258
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
259
|
+
return __promise
|
|
260
|
+
}()
|
|
261
|
+
return bridge.create_Result_std__shared_ptr_Promise_LaunchOptions___(__resultCpp)
|
|
262
|
+
} catch (let __error) {
|
|
263
|
+
let __exceptionPtr = __error.toCpp()
|
|
264
|
+
return bridge.create_Result_std__shared_ptr_Promise_LaunchOptions___(__exceptionPtr)
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
@inline(__always)
|
|
269
|
+
public final func clearLaunchOptions() -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
|
270
|
+
do {
|
|
271
|
+
let __result = try self.__implementation.clearLaunchOptions()
|
|
272
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
|
|
273
|
+
let __promise = bridge.create_std__shared_ptr_Promise_bool__()
|
|
274
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
|
|
275
|
+
__result
|
|
276
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
277
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
278
|
+
return __promise
|
|
279
|
+
}()
|
|
280
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
|
|
281
|
+
} catch (let __error) {
|
|
282
|
+
let __exceptionPtr = __error.toCpp()
|
|
283
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
@inline(__always)
|
|
288
|
+
public final func getDeviceToken() -> bridge.Result_std__shared_ptr_Promise_std__string___ {
|
|
289
|
+
do {
|
|
290
|
+
let __result = try self.__implementation.getDeviceToken()
|
|
291
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__string__ in
|
|
292
|
+
let __promise = bridge.create_std__shared_ptr_Promise_std__string__()
|
|
293
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__string__(__promise)
|
|
294
|
+
__result
|
|
295
|
+
.then({ __result in __promiseHolder.resolve(std.string(__result)) })
|
|
296
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
297
|
+
return __promise
|
|
298
|
+
}()
|
|
299
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__string___(__resultCpp)
|
|
300
|
+
} catch (let __error) {
|
|
301
|
+
let __exceptionPtr = __error.toCpp()
|
|
302
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__string___(__exceptionPtr)
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
@inline(__always)
|
|
307
|
+
public final func saveDeviceToken(token: std.string) -> bridge.Result_std__shared_ptr_Promise_void___ {
|
|
308
|
+
do {
|
|
309
|
+
let __result = try self.__implementation.saveDeviceToken(token: String(token))
|
|
310
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
|
|
311
|
+
let __promise = bridge.create_std__shared_ptr_Promise_void__()
|
|
312
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
|
|
313
|
+
__result
|
|
314
|
+
.then({ __result in __promiseHolder.resolve() })
|
|
315
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
316
|
+
return __promise
|
|
317
|
+
}()
|
|
318
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
|
|
319
|
+
} catch (let __error) {
|
|
320
|
+
let __exceptionPtr = __error.toCpp()
|
|
321
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
@inline(__always)
|
|
326
|
+
public final func registerDeviceToken() -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
|
327
|
+
do {
|
|
328
|
+
let __result = try self.__implementation.registerDeviceToken()
|
|
329
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
|
|
330
|
+
let __promise = bridge.create_std__shared_ptr_Promise_bool__()
|
|
331
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
|
|
332
|
+
__result
|
|
333
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
334
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
335
|
+
return __promise
|
|
336
|
+
}()
|
|
337
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
|
|
338
|
+
} catch (let __error) {
|
|
339
|
+
let __exceptionPtr = __error.toCpp()
|
|
340
|
+
return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
@inline(__always)
|
|
345
|
+
public final func getStartupTime() -> bridge.Result_std__shared_ptr_Promise_double___ {
|
|
346
|
+
do {
|
|
347
|
+
let __result = try self.__implementation.getStartupTime()
|
|
348
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_double__ in
|
|
349
|
+
let __promise = bridge.create_std__shared_ptr_Promise_double__()
|
|
350
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_double__(__promise)
|
|
351
|
+
__result
|
|
352
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
353
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
354
|
+
return __promise
|
|
355
|
+
}()
|
|
356
|
+
return bridge.create_Result_std__shared_ptr_Promise_double___(__resultCpp)
|
|
357
|
+
} catch (let __error) {
|
|
358
|
+
let __exceptionPtr = __error.toCpp()
|
|
359
|
+
return bridge.create_Result_std__shared_ptr_Promise_double___(__exceptionPtr)
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
@inline(__always)
|
|
364
|
+
public final func exitApp() -> bridge.Result_void_ {
|
|
365
|
+
do {
|
|
366
|
+
try self.__implementation.exitApp()
|
|
367
|
+
return bridge.create_Result_void_()
|
|
368
|
+
} catch (let __error) {
|
|
369
|
+
let __exceptionPtr = __error.toCpp()
|
|
370
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
@inline(__always)
|
|
375
|
+
public final func getCurrentWebViewPackageInfo() -> bridge.Result_std__shared_ptr_Promise_WebViewPackageInfo___ {
|
|
376
|
+
do {
|
|
377
|
+
let __result = try self.__implementation.getCurrentWebViewPackageInfo()
|
|
378
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_WebViewPackageInfo__ in
|
|
379
|
+
let __promise = bridge.create_std__shared_ptr_Promise_WebViewPackageInfo__()
|
|
380
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_WebViewPackageInfo__(__promise)
|
|
381
|
+
__result
|
|
382
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
383
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
384
|
+
return __promise
|
|
385
|
+
}()
|
|
386
|
+
return bridge.create_Result_std__shared_ptr_Promise_WebViewPackageInfo___(__resultCpp)
|
|
387
|
+
} catch (let __error) {
|
|
388
|
+
let __exceptionPtr = __error.toCpp()
|
|
389
|
+
return bridge.create_Result_std__shared_ptr_Promise_WebViewPackageInfo___(__exceptionPtr)
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
@inline(__always)
|
|
394
|
+
public final func isGooglePlayServicesAvailable() -> bridge.Result_std__shared_ptr_Promise_GooglePlayServicesStatus___ {
|
|
395
|
+
do {
|
|
396
|
+
let __result = try self.__implementation.isGooglePlayServicesAvailable()
|
|
397
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_GooglePlayServicesStatus__ in
|
|
398
|
+
let __promise = bridge.create_std__shared_ptr_Promise_GooglePlayServicesStatus__()
|
|
399
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_GooglePlayServicesStatus__(__promise)
|
|
400
|
+
__result
|
|
401
|
+
.then({ __result in __promiseHolder.resolve(__result) })
|
|
402
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
403
|
+
return __promise
|
|
404
|
+
}()
|
|
405
|
+
return bridge.create_Result_std__shared_ptr_Promise_GooglePlayServicesStatus___(__resultCpp)
|
|
406
|
+
} catch (let __error) {
|
|
407
|
+
let __exceptionPtr = __error.toCpp()
|
|
408
|
+
return bridge.create_Result_std__shared_ptr_Promise_GooglePlayServicesStatus___(__exceptionPtr)
|
|
409
|
+
}
|
|
410
|
+
}
|
|
248
411
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// LaunchOptions.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents an instance of `LaunchOptions`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias LaunchOptions = margelo.nitro.reactnativedeviceutils.LaunchOptions
|
|
15
|
+
|
|
16
|
+
public extension LaunchOptions {
|
|
17
|
+
private typealias bridge = margelo.nitro.reactnativedeviceutils.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `LaunchOptions`.
|
|
21
|
+
*/
|
|
22
|
+
init(launchType: String, deepLink: String?) {
|
|
23
|
+
self.init(std.string(launchType), { () -> bridge.std__optional_std__string_ in
|
|
24
|
+
if let __unwrappedValue = deepLink {
|
|
25
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
26
|
+
} else {
|
|
27
|
+
return .init()
|
|
28
|
+
}
|
|
29
|
+
}())
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var launchType: String {
|
|
33
|
+
@inline(__always)
|
|
34
|
+
get {
|
|
35
|
+
return String(self.__launchType)
|
|
36
|
+
}
|
|
37
|
+
@inline(__always)
|
|
38
|
+
set {
|
|
39
|
+
self.__launchType = std.string(newValue)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var deepLink: String? {
|
|
44
|
+
@inline(__always)
|
|
45
|
+
get {
|
|
46
|
+
return { () -> String? in
|
|
47
|
+
if bridge.has_value_std__optional_std__string_(self.__deepLink) {
|
|
48
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__deepLink)
|
|
49
|
+
return String(__unwrapped)
|
|
50
|
+
} else {
|
|
51
|
+
return nil
|
|
52
|
+
}
|
|
53
|
+
}()
|
|
54
|
+
}
|
|
55
|
+
@inline(__always)
|
|
56
|
+
set {
|
|
57
|
+
self.__deepLink = { () -> bridge.std__optional_std__string_ in
|
|
58
|
+
if let __unwrappedValue = newValue {
|
|
59
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
60
|
+
} else {
|
|
61
|
+
return .init()
|
|
62
|
+
}
|
|
63
|
+
}()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|