@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,154 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeAppUpdate-Swift-Cxx-Bridge.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
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `DownloadEvent` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::reactnativeappupdate { struct DownloadEvent; }
|
|
13
|
+
// Forward declaration of `HybridReactNativeAppUpdateSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::reactnativeappupdate { class HybridReactNativeAppUpdateSpec; }
|
|
15
|
+
|
|
16
|
+
// Forward declarations of Swift defined types
|
|
17
|
+
// Forward declaration of `HybridReactNativeAppUpdateSpec_cxx` to properly resolve imports.
|
|
18
|
+
namespace ReactNativeAppUpdate { class HybridReactNativeAppUpdateSpec_cxx; }
|
|
19
|
+
|
|
20
|
+
// Include C++ defined types
|
|
21
|
+
#include "DownloadEvent.hpp"
|
|
22
|
+
#include "HybridReactNativeAppUpdateSpec.hpp"
|
|
23
|
+
#include <NitroModules/Promise.hpp>
|
|
24
|
+
#include <NitroModules/PromiseHolder.hpp>
|
|
25
|
+
#include <NitroModules/Result.hpp>
|
|
26
|
+
#include <exception>
|
|
27
|
+
#include <functional>
|
|
28
|
+
#include <memory>
|
|
29
|
+
#include <string>
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
33
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
34
|
+
*/
|
|
35
|
+
namespace margelo::nitro::reactnativeappupdate::bridge::swift {
|
|
36
|
+
|
|
37
|
+
// pragma MARK: std::shared_ptr<Promise<void>>
|
|
38
|
+
/**
|
|
39
|
+
* Specialized version of `std::shared_ptr<Promise<void>>`.
|
|
40
|
+
*/
|
|
41
|
+
using std__shared_ptr_Promise_void__ = std::shared_ptr<Promise<void>>;
|
|
42
|
+
inline std::shared_ptr<Promise<void>> create_std__shared_ptr_Promise_void__() noexcept {
|
|
43
|
+
return Promise<void>::create();
|
|
44
|
+
}
|
|
45
|
+
inline PromiseHolder<void> wrap_std__shared_ptr_Promise_void__(std::shared_ptr<Promise<void>> promise) noexcept {
|
|
46
|
+
return PromiseHolder<void>(std::move(promise));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// pragma MARK: std::function<void()>
|
|
50
|
+
/**
|
|
51
|
+
* Specialized version of `std::function<void()>`.
|
|
52
|
+
*/
|
|
53
|
+
using Func_void = std::function<void()>;
|
|
54
|
+
/**
|
|
55
|
+
* Wrapper class for a `std::function<void()>`, this can be used from Swift.
|
|
56
|
+
*/
|
|
57
|
+
class Func_void_Wrapper final {
|
|
58
|
+
public:
|
|
59
|
+
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
|
|
60
|
+
inline void call() const noexcept {
|
|
61
|
+
_function->operator()();
|
|
62
|
+
}
|
|
63
|
+
private:
|
|
64
|
+
std::unique_ptr<std::function<void()>> _function;
|
|
65
|
+
} SWIFT_NONCOPYABLE;
|
|
66
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
67
|
+
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
|
68
|
+
return Func_void_Wrapper(std::move(value));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
72
|
+
/**
|
|
73
|
+
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
74
|
+
*/
|
|
75
|
+
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
76
|
+
/**
|
|
77
|
+
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
78
|
+
*/
|
|
79
|
+
class Func_void_std__exception_ptr_Wrapper final {
|
|
80
|
+
public:
|
|
81
|
+
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
82
|
+
inline void call(std::exception_ptr error) const noexcept {
|
|
83
|
+
_function->operator()(error);
|
|
84
|
+
}
|
|
85
|
+
private:
|
|
86
|
+
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
87
|
+
} SWIFT_NONCOPYABLE;
|
|
88
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
89
|
+
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
90
|
+
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// pragma MARK: std::function<void(const DownloadEvent& /* event */)>
|
|
94
|
+
/**
|
|
95
|
+
* Specialized version of `std::function<void(const DownloadEvent&)>`.
|
|
96
|
+
*/
|
|
97
|
+
using Func_void_DownloadEvent = std::function<void(const DownloadEvent& /* event */)>;
|
|
98
|
+
/**
|
|
99
|
+
* Wrapper class for a `std::function<void(const DownloadEvent& / * event * /)>`, this can be used from Swift.
|
|
100
|
+
*/
|
|
101
|
+
class Func_void_DownloadEvent_Wrapper final {
|
|
102
|
+
public:
|
|
103
|
+
explicit Func_void_DownloadEvent_Wrapper(std::function<void(const DownloadEvent& /* event */)>&& func): _function(std::make_unique<std::function<void(const DownloadEvent& /* event */)>>(std::move(func))) {}
|
|
104
|
+
inline void call(DownloadEvent event) const noexcept {
|
|
105
|
+
_function->operator()(event);
|
|
106
|
+
}
|
|
107
|
+
private:
|
|
108
|
+
std::unique_ptr<std::function<void(const DownloadEvent& /* event */)>> _function;
|
|
109
|
+
} SWIFT_NONCOPYABLE;
|
|
110
|
+
Func_void_DownloadEvent create_Func_void_DownloadEvent(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
111
|
+
inline Func_void_DownloadEvent_Wrapper wrap_Func_void_DownloadEvent(Func_void_DownloadEvent value) noexcept {
|
|
112
|
+
return Func_void_DownloadEvent_Wrapper(std::move(value));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// pragma MARK: std::shared_ptr<HybridReactNativeAppUpdateSpec>
|
|
116
|
+
/**
|
|
117
|
+
* Specialized version of `std::shared_ptr<HybridReactNativeAppUpdateSpec>`.
|
|
118
|
+
*/
|
|
119
|
+
using std__shared_ptr_HybridReactNativeAppUpdateSpec_ = std::shared_ptr<HybridReactNativeAppUpdateSpec>;
|
|
120
|
+
std::shared_ptr<HybridReactNativeAppUpdateSpec> create_std__shared_ptr_HybridReactNativeAppUpdateSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
121
|
+
void* NON_NULL get_std__shared_ptr_HybridReactNativeAppUpdateSpec_(std__shared_ptr_HybridReactNativeAppUpdateSpec_ cppType);
|
|
122
|
+
|
|
123
|
+
// pragma MARK: std::weak_ptr<HybridReactNativeAppUpdateSpec>
|
|
124
|
+
using std__weak_ptr_HybridReactNativeAppUpdateSpec_ = std::weak_ptr<HybridReactNativeAppUpdateSpec>;
|
|
125
|
+
inline std__weak_ptr_HybridReactNativeAppUpdateSpec_ weakify_std__shared_ptr_HybridReactNativeAppUpdateSpec_(const std::shared_ptr<HybridReactNativeAppUpdateSpec>& strong) noexcept { return strong; }
|
|
126
|
+
|
|
127
|
+
// pragma MARK: Result<std::shared_ptr<Promise<void>>>
|
|
128
|
+
using Result_std__shared_ptr_Promise_void___ = Result<std::shared_ptr<Promise<void>>>;
|
|
129
|
+
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::shared_ptr<Promise<void>>& value) noexcept {
|
|
130
|
+
return Result<std::shared_ptr<Promise<void>>>::withValue(value);
|
|
131
|
+
}
|
|
132
|
+
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) noexcept {
|
|
133
|
+
return Result<std::shared_ptr<Promise<void>>>::withError(error);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// pragma MARK: Result<double>
|
|
137
|
+
using Result_double_ = Result<double>;
|
|
138
|
+
inline Result_double_ create_Result_double_(double value) noexcept {
|
|
139
|
+
return Result<double>::withValue(std::move(value));
|
|
140
|
+
}
|
|
141
|
+
inline Result_double_ create_Result_double_(const std::exception_ptr& error) noexcept {
|
|
142
|
+
return Result<double>::withError(error);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// pragma MARK: Result<void>
|
|
146
|
+
using Result_void_ = Result<void>;
|
|
147
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
148
|
+
return Result<void>::withValue();
|
|
149
|
+
}
|
|
150
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
151
|
+
return Result<void>::withError(error);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
} // namespace margelo::nitro::reactnativeappupdate::bridge::swift
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeAppUpdate-Swift-Cxx-Umbrella.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
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `AppUpdateDownloadParams` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::reactnativeappupdate { struct AppUpdateDownloadParams; }
|
|
13
|
+
// Forward declaration of `AppUpdateFileParams` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::reactnativeappupdate { struct AppUpdateFileParams; }
|
|
15
|
+
// Forward declaration of `DownloadEvent` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::reactnativeappupdate { struct DownloadEvent; }
|
|
17
|
+
// Forward declaration of `HybridReactNativeAppUpdateSpec` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::reactnativeappupdate { class HybridReactNativeAppUpdateSpec; }
|
|
19
|
+
|
|
20
|
+
// Include C++ defined types
|
|
21
|
+
#include "AppUpdateDownloadParams.hpp"
|
|
22
|
+
#include "AppUpdateFileParams.hpp"
|
|
23
|
+
#include "DownloadEvent.hpp"
|
|
24
|
+
#include "HybridReactNativeAppUpdateSpec.hpp"
|
|
25
|
+
#include <NitroModules/Promise.hpp>
|
|
26
|
+
#include <NitroModules/Result.hpp>
|
|
27
|
+
#include <exception>
|
|
28
|
+
#include <functional>
|
|
29
|
+
#include <memory>
|
|
30
|
+
#include <string>
|
|
31
|
+
|
|
32
|
+
// C++ helpers for Swift
|
|
33
|
+
#include "ReactNativeAppUpdate-Swift-Cxx-Bridge.hpp"
|
|
34
|
+
|
|
35
|
+
// Common C++ types used in Swift
|
|
36
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
37
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
38
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
39
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
40
|
+
|
|
41
|
+
// Forward declarations of Swift defined types
|
|
42
|
+
// Forward declaration of `HybridReactNativeAppUpdateSpec_cxx` to properly resolve imports.
|
|
43
|
+
namespace ReactNativeAppUpdate { class HybridReactNativeAppUpdateSpec_cxx; }
|
|
44
|
+
|
|
45
|
+
// Include Swift defined types
|
|
46
|
+
#if __has_include("ReactNativeAppUpdate-Swift.h")
|
|
47
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
48
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "ReactNativeAppUpdate".
|
|
49
|
+
#include "ReactNativeAppUpdate-Swift.h"
|
|
50
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
51
|
+
#elif __has_include(<ReactNativeAppUpdate/ReactNativeAppUpdate-Swift.h>)
|
|
52
|
+
#include <ReactNativeAppUpdate/ReactNativeAppUpdate-Swift.h>
|
|
53
|
+
#else
|
|
54
|
+
#error ReactNativeAppUpdate's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "ReactNativeAppUpdate", and try building the app first.
|
|
55
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeAppUpdateAutolinking.mm
|
|
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/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "ReactNativeAppUpdate-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridReactNativeAppUpdateSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface ReactNativeAppUpdateAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation ReactNativeAppUpdateAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::reactnativeappupdate;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"ReactNativeAppUpdate",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridReactNativeAppUpdateSpec> hybridObject = ReactNativeAppUpdate::ReactNativeAppUpdateAutolinking::createReactNativeAppUpdate();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeAppUpdateAutolinking.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
|
+
public final class ReactNativeAppUpdateAutolinking {
|
|
9
|
+
public typealias bridge = margelo.nitro.reactnativeappupdate.bridge.swift
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of a Swift class that implements `HybridReactNativeAppUpdateSpec`,
|
|
13
|
+
* and wraps it in a Swift class that can directly interop with C++ (`HybridReactNativeAppUpdateSpec_cxx`)
|
|
14
|
+
*
|
|
15
|
+
* This is generated by Nitrogen and will initialize the class specified
|
|
16
|
+
* in the `"autolinking"` property of `nitro.json` (in this case, `ReactNativeAppUpdate`).
|
|
17
|
+
*/
|
|
18
|
+
public static func createReactNativeAppUpdate() -> bridge.std__shared_ptr_HybridReactNativeAppUpdateSpec_ {
|
|
19
|
+
let hybridObject = ReactNativeAppUpdate()
|
|
20
|
+
return { () -> bridge.std__shared_ptr_HybridReactNativeAppUpdateSpec_ in
|
|
21
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
22
|
+
return __cxxWrapped.getCxxPart()
|
|
23
|
+
}()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeAppUpdateSpecSwift.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 "HybridReactNativeAppUpdateSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::reactnativeappupdate {
|
|
11
|
+
} // namespace margelo::nitro::reactnativeappupdate
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReactNativeAppUpdateSpecSwift.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
|
+
#include "HybridReactNativeAppUpdateSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridReactNativeAppUpdateSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace ReactNativeAppUpdate { class HybridReactNativeAppUpdateSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `AppUpdateDownloadParams` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::reactnativeappupdate { struct AppUpdateDownloadParams; }
|
|
17
|
+
// Forward declaration of `AppUpdateFileParams` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::reactnativeappupdate { struct AppUpdateFileParams; }
|
|
19
|
+
// Forward declaration of `DownloadEvent` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::reactnativeappupdate { struct DownloadEvent; }
|
|
21
|
+
|
|
22
|
+
#include <NitroModules/Promise.hpp>
|
|
23
|
+
#include "AppUpdateDownloadParams.hpp"
|
|
24
|
+
#include <string>
|
|
25
|
+
#include "AppUpdateFileParams.hpp"
|
|
26
|
+
#include "DownloadEvent.hpp"
|
|
27
|
+
#include <functional>
|
|
28
|
+
|
|
29
|
+
#include "ReactNativeAppUpdate-Swift-Cxx-Umbrella.hpp"
|
|
30
|
+
|
|
31
|
+
namespace margelo::nitro::reactnativeappupdate {
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The C++ part of HybridReactNativeAppUpdateSpec_cxx.swift.
|
|
35
|
+
*
|
|
36
|
+
* HybridReactNativeAppUpdateSpecSwift (C++) accesses HybridReactNativeAppUpdateSpec_cxx (Swift), and might
|
|
37
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
38
|
+
*
|
|
39
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
40
|
+
* the future, HybridReactNativeAppUpdateSpec_cxx can directly inherit from the C++ class HybridReactNativeAppUpdateSpec
|
|
41
|
+
* to simplify the whole structure and memory management.
|
|
42
|
+
*/
|
|
43
|
+
class HybridReactNativeAppUpdateSpecSwift: public virtual HybridReactNativeAppUpdateSpec {
|
|
44
|
+
public:
|
|
45
|
+
// Constructor from a Swift instance
|
|
46
|
+
explicit HybridReactNativeAppUpdateSpecSwift(const ReactNativeAppUpdate::HybridReactNativeAppUpdateSpec_cxx& swiftPart):
|
|
47
|
+
HybridObject(HybridReactNativeAppUpdateSpec::TAG),
|
|
48
|
+
_swiftPart(swiftPart) { }
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
// Get the Swift part
|
|
52
|
+
inline ReactNativeAppUpdate::HybridReactNativeAppUpdateSpec_cxx& getSwiftPart() noexcept {
|
|
53
|
+
return _swiftPart;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
58
|
+
return _swiftPart.getMemorySize();
|
|
59
|
+
}
|
|
60
|
+
void dispose() noexcept override {
|
|
61
|
+
_swiftPart.dispose();
|
|
62
|
+
}
|
|
63
|
+
std::string toString() override {
|
|
64
|
+
return _swiftPart.toString();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public:
|
|
68
|
+
// Properties
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
public:
|
|
72
|
+
// Methods
|
|
73
|
+
inline std::shared_ptr<Promise<void>> downloadAPK(const AppUpdateDownloadParams& params) override {
|
|
74
|
+
auto __result = _swiftPart.downloadAPK(std::forward<decltype(params)>(params));
|
|
75
|
+
if (__result.hasError()) [[unlikely]] {
|
|
76
|
+
std::rethrow_exception(__result.error());
|
|
77
|
+
}
|
|
78
|
+
auto __value = std::move(__result.value());
|
|
79
|
+
return __value;
|
|
80
|
+
}
|
|
81
|
+
inline std::shared_ptr<Promise<void>> downloadASC(const AppUpdateFileParams& params) override {
|
|
82
|
+
auto __result = _swiftPart.downloadASC(std::forward<decltype(params)>(params));
|
|
83
|
+
if (__result.hasError()) [[unlikely]] {
|
|
84
|
+
std::rethrow_exception(__result.error());
|
|
85
|
+
}
|
|
86
|
+
auto __value = std::move(__result.value());
|
|
87
|
+
return __value;
|
|
88
|
+
}
|
|
89
|
+
inline std::shared_ptr<Promise<void>> verifyASC(const AppUpdateFileParams& params) override {
|
|
90
|
+
auto __result = _swiftPart.verifyASC(std::forward<decltype(params)>(params));
|
|
91
|
+
if (__result.hasError()) [[unlikely]] {
|
|
92
|
+
std::rethrow_exception(__result.error());
|
|
93
|
+
}
|
|
94
|
+
auto __value = std::move(__result.value());
|
|
95
|
+
return __value;
|
|
96
|
+
}
|
|
97
|
+
inline std::shared_ptr<Promise<void>> verifyAPK(const AppUpdateFileParams& params) override {
|
|
98
|
+
auto __result = _swiftPart.verifyAPK(std::forward<decltype(params)>(params));
|
|
99
|
+
if (__result.hasError()) [[unlikely]] {
|
|
100
|
+
std::rethrow_exception(__result.error());
|
|
101
|
+
}
|
|
102
|
+
auto __value = std::move(__result.value());
|
|
103
|
+
return __value;
|
|
104
|
+
}
|
|
105
|
+
inline std::shared_ptr<Promise<void>> installAPK(const AppUpdateFileParams& params) override {
|
|
106
|
+
auto __result = _swiftPart.installAPK(std::forward<decltype(params)>(params));
|
|
107
|
+
if (__result.hasError()) [[unlikely]] {
|
|
108
|
+
std::rethrow_exception(__result.error());
|
|
109
|
+
}
|
|
110
|
+
auto __value = std::move(__result.value());
|
|
111
|
+
return __value;
|
|
112
|
+
}
|
|
113
|
+
inline std::shared_ptr<Promise<void>> clearCache() override {
|
|
114
|
+
auto __result = _swiftPart.clearCache();
|
|
115
|
+
if (__result.hasError()) [[unlikely]] {
|
|
116
|
+
std::rethrow_exception(__result.error());
|
|
117
|
+
}
|
|
118
|
+
auto __value = std::move(__result.value());
|
|
119
|
+
return __value;
|
|
120
|
+
}
|
|
121
|
+
inline double addDownloadListener(const std::function<void(const DownloadEvent& /* event */)>& callback) override {
|
|
122
|
+
auto __result = _swiftPart.addDownloadListener(callback);
|
|
123
|
+
if (__result.hasError()) [[unlikely]] {
|
|
124
|
+
std::rethrow_exception(__result.error());
|
|
125
|
+
}
|
|
126
|
+
auto __value = std::move(__result.value());
|
|
127
|
+
return __value;
|
|
128
|
+
}
|
|
129
|
+
inline void removeDownloadListener(double id) override {
|
|
130
|
+
auto __result = _swiftPart.removeDownloadListener(std::forward<decltype(id)>(id));
|
|
131
|
+
if (__result.hasError()) [[unlikely]] {
|
|
132
|
+
std::rethrow_exception(__result.error());
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private:
|
|
137
|
+
ReactNativeAppUpdate::HybridReactNativeAppUpdateSpec_cxx _swiftPart;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
} // namespace margelo::nitro::reactnativeappupdate
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AppUpdateDownloadParams.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 `AppUpdateDownloadParams`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias AppUpdateDownloadParams = margelo.nitro.reactnativeappupdate.AppUpdateDownloadParams
|
|
15
|
+
|
|
16
|
+
public extension AppUpdateDownloadParams {
|
|
17
|
+
private typealias bridge = margelo.nitro.reactnativeappupdate.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `AppUpdateDownloadParams`.
|
|
21
|
+
*/
|
|
22
|
+
init(downloadUrl: String, notificationTitle: String, fileSize: Double) {
|
|
23
|
+
self.init(std.string(downloadUrl), std.string(notificationTitle), fileSize)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var downloadUrl: String {
|
|
27
|
+
@inline(__always)
|
|
28
|
+
get {
|
|
29
|
+
return String(self.__downloadUrl)
|
|
30
|
+
}
|
|
31
|
+
@inline(__always)
|
|
32
|
+
set {
|
|
33
|
+
self.__downloadUrl = std.string(newValue)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var notificationTitle: String {
|
|
38
|
+
@inline(__always)
|
|
39
|
+
get {
|
|
40
|
+
return String(self.__notificationTitle)
|
|
41
|
+
}
|
|
42
|
+
@inline(__always)
|
|
43
|
+
set {
|
|
44
|
+
self.__notificationTitle = std.string(newValue)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var fileSize: Double {
|
|
49
|
+
@inline(__always)
|
|
50
|
+
get {
|
|
51
|
+
return self.__fileSize
|
|
52
|
+
}
|
|
53
|
+
@inline(__always)
|
|
54
|
+
set {
|
|
55
|
+
self.__fileSize = newValue
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AppUpdateFileParams.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 `AppUpdateFileParams`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias AppUpdateFileParams = margelo.nitro.reactnativeappupdate.AppUpdateFileParams
|
|
15
|
+
|
|
16
|
+
public extension AppUpdateFileParams {
|
|
17
|
+
private typealias bridge = margelo.nitro.reactnativeappupdate.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `AppUpdateFileParams`.
|
|
21
|
+
*/
|
|
22
|
+
init(downloadUrl: String) {
|
|
23
|
+
self.init(std.string(downloadUrl))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var downloadUrl: String {
|
|
27
|
+
@inline(__always)
|
|
28
|
+
get {
|
|
29
|
+
return String(self.__downloadUrl)
|
|
30
|
+
}
|
|
31
|
+
@inline(__always)
|
|
32
|
+
set {
|
|
33
|
+
self.__downloadUrl = std.string(newValue)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// DownloadEvent.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 `DownloadEvent`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias DownloadEvent = margelo.nitro.reactnativeappupdate.DownloadEvent
|
|
15
|
+
|
|
16
|
+
public extension DownloadEvent {
|
|
17
|
+
private typealias bridge = margelo.nitro.reactnativeappupdate.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `DownloadEvent`.
|
|
21
|
+
*/
|
|
22
|
+
init(type: String, progress: Double, message: String) {
|
|
23
|
+
self.init(std.string(type), progress, std.string(message))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var type: String {
|
|
27
|
+
@inline(__always)
|
|
28
|
+
get {
|
|
29
|
+
return String(self.__type)
|
|
30
|
+
}
|
|
31
|
+
@inline(__always)
|
|
32
|
+
set {
|
|
33
|
+
self.__type = std.string(newValue)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var progress: Double {
|
|
38
|
+
@inline(__always)
|
|
39
|
+
get {
|
|
40
|
+
return self.__progress
|
|
41
|
+
}
|
|
42
|
+
@inline(__always)
|
|
43
|
+
set {
|
|
44
|
+
self.__progress = newValue
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var message: String {
|
|
49
|
+
@inline(__always)
|
|
50
|
+
get {
|
|
51
|
+
return String(self.__message)
|
|
52
|
+
}
|
|
53
|
+
@inline(__always)
|
|
54
|
+
set {
|
|
55
|
+
self.__message = std.string(newValue)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -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.reactnativeappupdate.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_DownloadEvent.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 `(_ event: DownloadEvent) -> 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_DownloadEvent {
|
|
16
|
+
public typealias bridge = margelo.nitro.reactnativeappupdate.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ event: DownloadEvent) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ event: DownloadEvent) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(event: DownloadEvent) -> Void {
|
|
26
|
+
self.closure(event)
|
|
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_DownloadEvent`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_DownloadEvent>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_DownloadEvent {
|
|
45
|
+
return Unmanaged<Func_void_DownloadEvent>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|