@onekeyfe/react-native-app-update 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/LICENSE +21 -0
- package/README.md +36 -0
- package/ReactNativeAppUpdate.podspec +30 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +141 -0
- package/android/gradle.properties +4 -0
- package/android/src/main/AndroidManifest.xml +17 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeappupdate/ReactNativeAppUpdate.kt +819 -0
- package/android/src/main/java/com/margelo/nitro/reactnativeappupdate/ReactNativeAppUpdatePackage.kt +24 -0
- package/android/src/main/res/xml/app_update_file_paths.xml +4 -0
- package/ios/ReactNativeAppUpdate.swift +41 -0
- package/lib/module/ReactNativeAppUpdate.nitro.js +4 -0
- package/lib/module/ReactNativeAppUpdate.nitro.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/ReactNativeAppUpdate.nitro.d.ts +28 -0
- package/lib/typescript/src/ReactNativeAppUpdate.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JAppUpdateDownloadParams.hpp +65 -0
- package/nitrogen/generated/android/c++/JAppUpdateFileParams.hpp +57 -0
- package/nitrogen/generated/android/c++/JDownloadEvent.hpp +65 -0
- package/nitrogen/generated/android/c++/JFunc_void_DownloadEvent.hpp +78 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeAppUpdateSpec.cpp +162 -0
- package/nitrogen/generated/android/c++/JHybridReactNativeAppUpdateSpec.hpp +72 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/AppUpdateDownloadParams.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/AppUpdateFileParams.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/DownloadEvent.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/Func_void_DownloadEvent.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/HybridReactNativeAppUpdateSpec.kt +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativeappupdate/reactnativeappupdateOnLoad.kt +35 -0
- package/nitrogen/generated/android/reactnativeappupdate+autolinking.cmake +81 -0
- package/nitrogen/generated/android/reactnativeappupdate+autolinking.gradle +27 -0
- package/nitrogen/generated/android/reactnativeappupdateOnLoad.cpp +46 -0
- package/nitrogen/generated/android/reactnativeappupdateOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/ReactNativeAppUpdate+autolinking.rb +60 -0
- package/nitrogen/generated/ios/ReactNativeAppUpdate-Swift-Cxx-Bridge.cpp +57 -0
- package/nitrogen/generated/ios/ReactNativeAppUpdate-Swift-Cxx-Bridge.hpp +154 -0
- package/nitrogen/generated/ios/ReactNativeAppUpdate-Swift-Cxx-Umbrella.hpp +55 -0
- package/nitrogen/generated/ios/ReactNativeAppUpdateAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ReactNativeAppUpdateAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeAppUpdateSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridReactNativeAppUpdateSpecSwift.hpp +140 -0
- package/nitrogen/generated/ios/swift/AppUpdateDownloadParams.swift +58 -0
- package/nitrogen/generated/ios/swift/AppUpdateFileParams.swift +36 -0
- package/nitrogen/generated/ios/swift/DownloadEvent.swift +58 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_DownloadEvent.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeAppUpdateSpec.swift +63 -0
- package/nitrogen/generated/ios/swift/HybridReactNativeAppUpdateSpec_cxx.swift +261 -0
- package/nitrogen/generated/shared/c++/AppUpdateDownloadParams.hpp +83 -0
- package/nitrogen/generated/shared/c++/AppUpdateFileParams.hpp +75 -0
- package/nitrogen/generated/shared/c++/DownloadEvent.hpp +83 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeAppUpdateSpec.cpp +28 -0
- package/nitrogen/generated/shared/c++/HybridReactNativeAppUpdateSpec.hpp +78 -0
- package/package.json +169 -0
- package/src/ReactNativeAppUpdate.nitro.ts +30 -0
- package/src/index.tsx +8 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__exception_ptr.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 `(_ error: Error) -> 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__exception_ptr {
|
|
16
|
+
public typealias bridge = margelo.nitro.reactnativeappupdate.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ error: Error) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ error: Error) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(error: std.exception_ptr) -> Void {
|
|
26
|
+
self.closure(RuntimeError.from(cppError: error))
|
|
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__exception_ptr`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
|
|
45
|
+
return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeAppUpdateSpec.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
|
+
/// See ``HybridReactNativeAppUpdateSpec``
|
|
12
|
+
public protocol HybridReactNativeAppUpdateSpec_protocol: HybridObject {
|
|
13
|
+
// Properties
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Methods
|
|
17
|
+
func downloadAPK(params: AppUpdateDownloadParams) throws -> Promise<Void>
|
|
18
|
+
func downloadASC(params: AppUpdateFileParams) throws -> Promise<Void>
|
|
19
|
+
func verifyASC(params: AppUpdateFileParams) throws -> Promise<Void>
|
|
20
|
+
func verifyAPK(params: AppUpdateFileParams) throws -> Promise<Void>
|
|
21
|
+
func installAPK(params: AppUpdateFileParams) throws -> Promise<Void>
|
|
22
|
+
func clearCache() throws -> Promise<Void>
|
|
23
|
+
func addDownloadListener(callback: @escaping (_ event: DownloadEvent) -> Void) throws -> Double
|
|
24
|
+
func removeDownloadListener(id: Double) throws -> Void
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public extension HybridReactNativeAppUpdateSpec_protocol {
|
|
28
|
+
/// Default implementation of ``HybridObject.toString``
|
|
29
|
+
func toString() -> String {
|
|
30
|
+
return "[HybridObject ReactNativeAppUpdate]"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/// See ``HybridReactNativeAppUpdateSpec``
|
|
35
|
+
open class HybridReactNativeAppUpdateSpec_base {
|
|
36
|
+
private weak var cxxWrapper: HybridReactNativeAppUpdateSpec_cxx? = nil
|
|
37
|
+
public init() { }
|
|
38
|
+
public func getCxxWrapper() -> HybridReactNativeAppUpdateSpec_cxx {
|
|
39
|
+
#if DEBUG
|
|
40
|
+
guard self is HybridReactNativeAppUpdateSpec else {
|
|
41
|
+
fatalError("`self` is not a `HybridReactNativeAppUpdateSpec`! Did you accidentally inherit from `HybridReactNativeAppUpdateSpec_base` instead of `HybridReactNativeAppUpdateSpec`?")
|
|
42
|
+
}
|
|
43
|
+
#endif
|
|
44
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
45
|
+
return cxxWrapper
|
|
46
|
+
} else {
|
|
47
|
+
let cxxWrapper = HybridReactNativeAppUpdateSpec_cxx(self as! HybridReactNativeAppUpdateSpec)
|
|
48
|
+
self.cxxWrapper = cxxWrapper
|
|
49
|
+
return cxxWrapper
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A Swift base-protocol representing the ReactNativeAppUpdate HybridObject.
|
|
56
|
+
* Implement this protocol to create Swift-based instances of ReactNativeAppUpdate.
|
|
57
|
+
* ```swift
|
|
58
|
+
* class HybridReactNativeAppUpdate : HybridReactNativeAppUpdateSpec {
|
|
59
|
+
* // ...
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
public typealias HybridReactNativeAppUpdateSpec = HybridReactNativeAppUpdateSpec_protocol & HybridReactNativeAppUpdateSpec_base
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeAppUpdateSpec_cxx.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
|
+
* A class implementation that bridges HybridReactNativeAppUpdateSpec over to C++.
|
|
13
|
+
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
14
|
+
*
|
|
15
|
+
* Also, some Swift types need to be bridged with special handling:
|
|
16
|
+
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
|
17
|
+
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
|
18
|
+
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
|
19
|
+
*/
|
|
20
|
+
open class HybridReactNativeAppUpdateSpec_cxx {
|
|
21
|
+
/**
|
|
22
|
+
* The Swift <> C++ bridge's namespace (`margelo::nitro::reactnativeappupdate::bridge::swift`)
|
|
23
|
+
* from `ReactNativeAppUpdate-Swift-Cxx-Bridge.hpp`.
|
|
24
|
+
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
25
|
+
*/
|
|
26
|
+
public typealias bridge = margelo.nitro.reactnativeappupdate.bridge.swift
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Holds an instance of the `HybridReactNativeAppUpdateSpec` Swift protocol.
|
|
30
|
+
*/
|
|
31
|
+
private var __implementation: any HybridReactNativeAppUpdateSpec
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
35
|
+
*/
|
|
36
|
+
private var __cxxPart: bridge.std__weak_ptr_HybridReactNativeAppUpdateSpec_
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Create a new `HybridReactNativeAppUpdateSpec_cxx` that wraps the given `HybridReactNativeAppUpdateSpec`.
|
|
40
|
+
* All properties and methods bridge to C++ types.
|
|
41
|
+
*/
|
|
42
|
+
public init(_ implementation: any HybridReactNativeAppUpdateSpec) {
|
|
43
|
+
self.__implementation = implementation
|
|
44
|
+
self.__cxxPart = .init()
|
|
45
|
+
/* no base class */
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get the actual `HybridReactNativeAppUpdateSpec` instance this class wraps.
|
|
50
|
+
*/
|
|
51
|
+
@inline(__always)
|
|
52
|
+
public func getHybridReactNativeAppUpdateSpec() -> any HybridReactNativeAppUpdateSpec {
|
|
53
|
+
return __implementation
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
58
|
+
* This acquires one additional strong reference on the object!
|
|
59
|
+
*/
|
|
60
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
61
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Casts an unsafe pointer to a `HybridReactNativeAppUpdateSpec_cxx`.
|
|
66
|
+
* The pointer has to be a retained opaque `Unmanaged<HybridReactNativeAppUpdateSpec_cxx>`.
|
|
67
|
+
* This removes one strong reference from the object!
|
|
68
|
+
*/
|
|
69
|
+
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridReactNativeAppUpdateSpec_cxx {
|
|
70
|
+
return Unmanaged<HybridReactNativeAppUpdateSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
75
|
+
* The C++ part is a `std::shared_ptr<HybridReactNativeAppUpdateSpec>`.
|
|
76
|
+
*/
|
|
77
|
+
public func getCxxPart() -> bridge.std__shared_ptr_HybridReactNativeAppUpdateSpec_ {
|
|
78
|
+
let cachedCxxPart = self.__cxxPart.lock()
|
|
79
|
+
if Bool(fromCxx: cachedCxxPart) {
|
|
80
|
+
return cachedCxxPart
|
|
81
|
+
} else {
|
|
82
|
+
let newCxxPart = bridge.create_std__shared_ptr_HybridReactNativeAppUpdateSpec_(self.toUnsafe())
|
|
83
|
+
__cxxPart = bridge.weakify_std__shared_ptr_HybridReactNativeAppUpdateSpec_(newCxxPart)
|
|
84
|
+
return newCxxPart
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
92
|
+
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
93
|
+
*/
|
|
94
|
+
@inline(__always)
|
|
95
|
+
public var memorySize: Int {
|
|
96
|
+
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Call dispose() on the Swift class.
|
|
101
|
+
* This _may_ be called manually from JS.
|
|
102
|
+
*/
|
|
103
|
+
@inline(__always)
|
|
104
|
+
public func dispose() {
|
|
105
|
+
self.__implementation.dispose()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Call toString() on the Swift class.
|
|
110
|
+
*/
|
|
111
|
+
@inline(__always)
|
|
112
|
+
public func toString() -> String {
|
|
113
|
+
return self.__implementation.toString()
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Properties
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
// Methods
|
|
120
|
+
@inline(__always)
|
|
121
|
+
public final func downloadAPK(params: AppUpdateDownloadParams) -> bridge.Result_std__shared_ptr_Promise_void___ {
|
|
122
|
+
do {
|
|
123
|
+
let __result = try self.__implementation.downloadAPK(params: params)
|
|
124
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
|
|
125
|
+
let __promise = bridge.create_std__shared_ptr_Promise_void__()
|
|
126
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
|
|
127
|
+
__result
|
|
128
|
+
.then({ __result in __promiseHolder.resolve() })
|
|
129
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
130
|
+
return __promise
|
|
131
|
+
}()
|
|
132
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
|
|
133
|
+
} catch (let __error) {
|
|
134
|
+
let __exceptionPtr = __error.toCpp()
|
|
135
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@inline(__always)
|
|
140
|
+
public final func downloadASC(params: AppUpdateFileParams) -> bridge.Result_std__shared_ptr_Promise_void___ {
|
|
141
|
+
do {
|
|
142
|
+
let __result = try self.__implementation.downloadASC(params: params)
|
|
143
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
|
|
144
|
+
let __promise = bridge.create_std__shared_ptr_Promise_void__()
|
|
145
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
|
|
146
|
+
__result
|
|
147
|
+
.then({ __result in __promiseHolder.resolve() })
|
|
148
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
149
|
+
return __promise
|
|
150
|
+
}()
|
|
151
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
|
|
152
|
+
} catch (let __error) {
|
|
153
|
+
let __exceptionPtr = __error.toCpp()
|
|
154
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@inline(__always)
|
|
159
|
+
public final func verifyASC(params: AppUpdateFileParams) -> bridge.Result_std__shared_ptr_Promise_void___ {
|
|
160
|
+
do {
|
|
161
|
+
let __result = try self.__implementation.verifyASC(params: params)
|
|
162
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
|
|
163
|
+
let __promise = bridge.create_std__shared_ptr_Promise_void__()
|
|
164
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
|
|
165
|
+
__result
|
|
166
|
+
.then({ __result in __promiseHolder.resolve() })
|
|
167
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
168
|
+
return __promise
|
|
169
|
+
}()
|
|
170
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
|
|
171
|
+
} catch (let __error) {
|
|
172
|
+
let __exceptionPtr = __error.toCpp()
|
|
173
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
@inline(__always)
|
|
178
|
+
public final func verifyAPK(params: AppUpdateFileParams) -> bridge.Result_std__shared_ptr_Promise_void___ {
|
|
179
|
+
do {
|
|
180
|
+
let __result = try self.__implementation.verifyAPK(params: params)
|
|
181
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
|
|
182
|
+
let __promise = bridge.create_std__shared_ptr_Promise_void__()
|
|
183
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
|
|
184
|
+
__result
|
|
185
|
+
.then({ __result in __promiseHolder.resolve() })
|
|
186
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
187
|
+
return __promise
|
|
188
|
+
}()
|
|
189
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
|
|
190
|
+
} catch (let __error) {
|
|
191
|
+
let __exceptionPtr = __error.toCpp()
|
|
192
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
@inline(__always)
|
|
197
|
+
public final func installAPK(params: AppUpdateFileParams) -> bridge.Result_std__shared_ptr_Promise_void___ {
|
|
198
|
+
do {
|
|
199
|
+
let __result = try self.__implementation.installAPK(params: params)
|
|
200
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
|
|
201
|
+
let __promise = bridge.create_std__shared_ptr_Promise_void__()
|
|
202
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
|
|
203
|
+
__result
|
|
204
|
+
.then({ __result in __promiseHolder.resolve() })
|
|
205
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
206
|
+
return __promise
|
|
207
|
+
}()
|
|
208
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
|
|
209
|
+
} catch (let __error) {
|
|
210
|
+
let __exceptionPtr = __error.toCpp()
|
|
211
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@inline(__always)
|
|
216
|
+
public final func clearCache() -> bridge.Result_std__shared_ptr_Promise_void___ {
|
|
217
|
+
do {
|
|
218
|
+
let __result = try self.__implementation.clearCache()
|
|
219
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
|
|
220
|
+
let __promise = bridge.create_std__shared_ptr_Promise_void__()
|
|
221
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
|
|
222
|
+
__result
|
|
223
|
+
.then({ __result in __promiseHolder.resolve() })
|
|
224
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
225
|
+
return __promise
|
|
226
|
+
}()
|
|
227
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
|
|
228
|
+
} catch (let __error) {
|
|
229
|
+
let __exceptionPtr = __error.toCpp()
|
|
230
|
+
return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@inline(__always)
|
|
235
|
+
public final func addDownloadListener(callback: bridge.Func_void_DownloadEvent) -> bridge.Result_double_ {
|
|
236
|
+
do {
|
|
237
|
+
let __result = try self.__implementation.addDownloadListener(callback: { () -> (DownloadEvent) -> Void in
|
|
238
|
+
let __wrappedFunction = bridge.wrap_Func_void_DownloadEvent(callback)
|
|
239
|
+
return { (__event: DownloadEvent) -> Void in
|
|
240
|
+
__wrappedFunction.call(__event)
|
|
241
|
+
}
|
|
242
|
+
}())
|
|
243
|
+
let __resultCpp = __result
|
|
244
|
+
return bridge.create_Result_double_(__resultCpp)
|
|
245
|
+
} catch (let __error) {
|
|
246
|
+
let __exceptionPtr = __error.toCpp()
|
|
247
|
+
return bridge.create_Result_double_(__exceptionPtr)
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
@inline(__always)
|
|
252
|
+
public final func removeDownloadListener(id: Double) -> bridge.Result_void_ {
|
|
253
|
+
do {
|
|
254
|
+
try self.__implementation.removeDownloadListener(id: id)
|
|
255
|
+
return bridge.create_Result_void_()
|
|
256
|
+
} catch (let __error) {
|
|
257
|
+
let __exceptionPtr = __error.toCpp()
|
|
258
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AppUpdateDownloadParams.hpp
|
|
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
|
+
#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
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#include <string>
|
|
29
|
+
|
|
30
|
+
namespace margelo::nitro::reactnativeappupdate {
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A struct which can be represented as a JavaScript object (AppUpdateDownloadParams).
|
|
34
|
+
*/
|
|
35
|
+
struct AppUpdateDownloadParams {
|
|
36
|
+
public:
|
|
37
|
+
std::string downloadUrl SWIFT_PRIVATE;
|
|
38
|
+
std::string notificationTitle SWIFT_PRIVATE;
|
|
39
|
+
double fileSize SWIFT_PRIVATE;
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
AppUpdateDownloadParams() = default;
|
|
43
|
+
explicit AppUpdateDownloadParams(std::string downloadUrl, std::string notificationTitle, double fileSize): downloadUrl(downloadUrl), notificationTitle(notificationTitle), fileSize(fileSize) {}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
} // namespace margelo::nitro::reactnativeappupdate
|
|
47
|
+
|
|
48
|
+
namespace margelo::nitro {
|
|
49
|
+
|
|
50
|
+
// C++ AppUpdateDownloadParams <> JS AppUpdateDownloadParams (object)
|
|
51
|
+
template <>
|
|
52
|
+
struct JSIConverter<margelo::nitro::reactnativeappupdate::AppUpdateDownloadParams> final {
|
|
53
|
+
static inline margelo::nitro::reactnativeappupdate::AppUpdateDownloadParams fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
54
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
55
|
+
return margelo::nitro::reactnativeappupdate::AppUpdateDownloadParams(
|
|
56
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "downloadUrl")),
|
|
57
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "notificationTitle")),
|
|
58
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "fileSize"))
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativeappupdate::AppUpdateDownloadParams& arg) {
|
|
62
|
+
jsi::Object obj(runtime);
|
|
63
|
+
obj.setProperty(runtime, "downloadUrl", JSIConverter<std::string>::toJSI(runtime, arg.downloadUrl));
|
|
64
|
+
obj.setProperty(runtime, "notificationTitle", JSIConverter<std::string>::toJSI(runtime, arg.notificationTitle));
|
|
65
|
+
obj.setProperty(runtime, "fileSize", JSIConverter<double>::toJSI(runtime, arg.fileSize));
|
|
66
|
+
return obj;
|
|
67
|
+
}
|
|
68
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
69
|
+
if (!value.isObject()) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
jsi::Object obj = value.getObject(runtime);
|
|
73
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "downloadUrl"))) return false;
|
|
77
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "notificationTitle"))) return false;
|
|
78
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "fileSize"))) return false;
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AppUpdateFileParams.hpp
|
|
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
|
+
#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
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#include <string>
|
|
29
|
+
|
|
30
|
+
namespace margelo::nitro::reactnativeappupdate {
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A struct which can be represented as a JavaScript object (AppUpdateFileParams).
|
|
34
|
+
*/
|
|
35
|
+
struct AppUpdateFileParams {
|
|
36
|
+
public:
|
|
37
|
+
std::string downloadUrl SWIFT_PRIVATE;
|
|
38
|
+
|
|
39
|
+
public:
|
|
40
|
+
AppUpdateFileParams() = default;
|
|
41
|
+
explicit AppUpdateFileParams(std::string downloadUrl): downloadUrl(downloadUrl) {}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
} // namespace margelo::nitro::reactnativeappupdate
|
|
45
|
+
|
|
46
|
+
namespace margelo::nitro {
|
|
47
|
+
|
|
48
|
+
// C++ AppUpdateFileParams <> JS AppUpdateFileParams (object)
|
|
49
|
+
template <>
|
|
50
|
+
struct JSIConverter<margelo::nitro::reactnativeappupdate::AppUpdateFileParams> final {
|
|
51
|
+
static inline margelo::nitro::reactnativeappupdate::AppUpdateFileParams fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
52
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
53
|
+
return margelo::nitro::reactnativeappupdate::AppUpdateFileParams(
|
|
54
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "downloadUrl"))
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativeappupdate::AppUpdateFileParams& arg) {
|
|
58
|
+
jsi::Object obj(runtime);
|
|
59
|
+
obj.setProperty(runtime, "downloadUrl", JSIConverter<std::string>::toJSI(runtime, arg.downloadUrl));
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
63
|
+
if (!value.isObject()) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
jsi::Object obj = value.getObject(runtime);
|
|
67
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "downloadUrl"))) return false;
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// DownloadEvent.hpp
|
|
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
|
+
#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
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
#include <string>
|
|
29
|
+
|
|
30
|
+
namespace margelo::nitro::reactnativeappupdate {
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A struct which can be represented as a JavaScript object (DownloadEvent).
|
|
34
|
+
*/
|
|
35
|
+
struct DownloadEvent {
|
|
36
|
+
public:
|
|
37
|
+
std::string type SWIFT_PRIVATE;
|
|
38
|
+
double progress SWIFT_PRIVATE;
|
|
39
|
+
std::string message SWIFT_PRIVATE;
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
DownloadEvent() = default;
|
|
43
|
+
explicit DownloadEvent(std::string type, double progress, std::string message): type(type), progress(progress), message(message) {}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
} // namespace margelo::nitro::reactnativeappupdate
|
|
47
|
+
|
|
48
|
+
namespace margelo::nitro {
|
|
49
|
+
|
|
50
|
+
// C++ DownloadEvent <> JS DownloadEvent (object)
|
|
51
|
+
template <>
|
|
52
|
+
struct JSIConverter<margelo::nitro::reactnativeappupdate::DownloadEvent> final {
|
|
53
|
+
static inline margelo::nitro::reactnativeappupdate::DownloadEvent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
54
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
55
|
+
return margelo::nitro::reactnativeappupdate::DownloadEvent(
|
|
56
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "type")),
|
|
57
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "progress")),
|
|
58
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "message"))
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::reactnativeappupdate::DownloadEvent& arg) {
|
|
62
|
+
jsi::Object obj(runtime);
|
|
63
|
+
obj.setProperty(runtime, "type", JSIConverter<std::string>::toJSI(runtime, arg.type));
|
|
64
|
+
obj.setProperty(runtime, "progress", JSIConverter<double>::toJSI(runtime, arg.progress));
|
|
65
|
+
obj.setProperty(runtime, "message", JSIConverter<std::string>::toJSI(runtime, arg.message));
|
|
66
|
+
return obj;
|
|
67
|
+
}
|
|
68
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
69
|
+
if (!value.isObject()) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
jsi::Object obj = value.getObject(runtime);
|
|
73
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "type"))) return false;
|
|
77
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, "progress"))) return false;
|
|
78
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "message"))) return false;
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeAppUpdateSpec.cpp
|
|
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
|
+
#include "HybridReactNativeAppUpdateSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::reactnativeappupdate {
|
|
11
|
+
|
|
12
|
+
void HybridReactNativeAppUpdateSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("downloadAPK", &HybridReactNativeAppUpdateSpec::downloadAPK);
|
|
18
|
+
prototype.registerHybridMethod("downloadASC", &HybridReactNativeAppUpdateSpec::downloadASC);
|
|
19
|
+
prototype.registerHybridMethod("verifyASC", &HybridReactNativeAppUpdateSpec::verifyASC);
|
|
20
|
+
prototype.registerHybridMethod("verifyAPK", &HybridReactNativeAppUpdateSpec::verifyAPK);
|
|
21
|
+
prototype.registerHybridMethod("installAPK", &HybridReactNativeAppUpdateSpec::installAPK);
|
|
22
|
+
prototype.registerHybridMethod("clearCache", &HybridReactNativeAppUpdateSpec::clearCache);
|
|
23
|
+
prototype.registerHybridMethod("addDownloadListener", &HybridReactNativeAppUpdateSpec::addDownloadListener);
|
|
24
|
+
prototype.registerHybridMethod("removeDownloadListener", &HybridReactNativeAppUpdateSpec::removeDownloadListener);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
} // namespace margelo::nitro::reactnativeappupdate
|