react-native-nitro-ali-push 0.0.0-stage → 1.0.1
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 +240 -2
- package/android/CMakeLists.txt +31 -0
- package/android/build.gradle +139 -0
- package/android/src/main/AndroidManifest.xml +30 -0
- package/android/src/main/java/com/margelo/nitro/alipush/AliPushMessageReceiver.kt +156 -0
- package/android/src/main/java/com/margelo/nitro/alipush/HybridAliPushPlugin.kt +303 -0
- package/android/src/main/java/com/margelo/nitro/alipush/ThirdPartMessageActivity.kt +26 -0
- package/ios/HybridAliPushPlugin.swift +519 -0
- package/lib/index.d.ts +195 -0
- package/lib/index.js +269 -0
- package/lib/specs/AliPushPlugin.nitro.d.ts +88 -0
- package/lib/specs/AliPushPlugin.nitro.js +2 -0
- package/lib/types.d.ts +111 -0
- package/lib/types.js +11 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroAliPush+autolinking.cmake +84 -0
- package/nitrogen/generated/android/NitroAliPush+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroAliPushOnLoad.cpp +58 -0
- package/nitrogen/generated/android/NitroAliPushOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JAliPushAppState.hpp +61 -0
- package/nitrogen/generated/android/c++/JAliPushMessage.hpp +98 -0
- package/nitrogen/generated/android/c++/JAliPushMessageType.hpp +58 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_AliPushMessage.hpp +87 -0
- package/nitrogen/generated/android/c++/JHybridAliPushPluginSpec.cpp +338 -0
- package/nitrogen/generated/android/c++/JHybridAliPushPluginSpec.hpp +78 -0
- package/nitrogen/generated/android/c++/JVariant_Double_String.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_Double_String.hpp +68 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_AliPushMessage.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_AliPushMessage.hpp +80 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_String.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_String.hpp +70 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/AliPushAppState.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/AliPushMessage.kt +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/AliPushMessageType.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/Func_void.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/Func_void_AliPushMessage.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/HybridAliPushPluginSpec.kt +123 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/NitroAliPushOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/Variant_Double_String.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/Variant_NullType_AliPushMessage.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/alipush/Variant_NullType_String.kt +62 -0
- package/nitrogen/generated/ios/NitroAliPush+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NitroAliPush-Swift-Cxx-Bridge.cpp +89 -0
- package/nitrogen/generated/ios/NitroAliPush-Swift-Cxx-Bridge.hpp +531 -0
- package/nitrogen/generated/ios/NitroAliPush-Swift-Cxx-Umbrella.hpp +60 -0
- package/nitrogen/generated/ios/NitroAliPushAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroAliPushAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridAliPushPluginSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridAliPushPluginSpecSwift.hpp +217 -0
- package/nitrogen/generated/ios/swift/AliPushAppState.swift +44 -0
- package/nitrogen/generated/ios/swift/AliPushMessage.swift +191 -0
- package/nitrogen/generated/ios/swift/AliPushMessageType.swift +40 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_AliPushMessage.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__AliPushMessage_.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridAliPushPluginSpec.swift +70 -0
- package/nitrogen/generated/ios/swift/HybridAliPushPluginSpec_cxx.swift +476 -0
- package/nitrogen/generated/ios/swift/Variant_Double_String.swift +30 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_AliPushMessage.swift +30 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_String.swift +30 -0
- package/nitrogen/generated/shared/c++/AliPushAppState.hpp +80 -0
- package/nitrogen/generated/shared/c++/AliPushMessage.hpp +123 -0
- package/nitrogen/generated/shared/c++/AliPushMessageType.hpp +76 -0
- package/nitrogen/generated/shared/c++/HybridAliPushPluginSpec.cpp +36 -0
- package/nitrogen/generated/shared/c++/HybridAliPushPluginSpec.hpp +85 -0
- package/package.json +61 -4
- package/react-native-nitro-ali-push.podspec +41 -0
- package/src/index.ts +284 -0
- package/src/specs/AliPushPlugin.nitro.ts +104 -0
- package/src/types.ts +117 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridAliPushPluginSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridAliPushPluginSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridAliPushPluginSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace NitroAliPush { class HybridAliPushPluginSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `AliPushMessage` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::alipush { struct AliPushMessage; }
|
|
17
|
+
// Forward declaration of `AliPushMessageType` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::alipush { enum class AliPushMessageType; }
|
|
19
|
+
// Forward declaration of `AliPushAppState` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::alipush { enum class AliPushAppState; }
|
|
21
|
+
|
|
22
|
+
#include <NitroModules/Promise.hpp>
|
|
23
|
+
#include <string>
|
|
24
|
+
#include <vector>
|
|
25
|
+
#include <NitroModules/Null.hpp>
|
|
26
|
+
#include <variant>
|
|
27
|
+
#include <optional>
|
|
28
|
+
#include "AliPushMessage.hpp"
|
|
29
|
+
#include <NitroModules/AnyMap.hpp>
|
|
30
|
+
#include "AliPushMessageType.hpp"
|
|
31
|
+
#include "AliPushAppState.hpp"
|
|
32
|
+
#include <functional>
|
|
33
|
+
|
|
34
|
+
#include "NitroAliPush-Swift-Cxx-Umbrella.hpp"
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::alipush {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The C++ part of HybridAliPushPluginSpec_cxx.swift.
|
|
40
|
+
*
|
|
41
|
+
* HybridAliPushPluginSpecSwift (C++) accesses HybridAliPushPluginSpec_cxx (Swift), and might
|
|
42
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
43
|
+
*
|
|
44
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
45
|
+
* the future, HybridAliPushPluginSpec_cxx can directly inherit from the C++ class HybridAliPushPluginSpec
|
|
46
|
+
* to simplify the whole structure and memory management.
|
|
47
|
+
*/
|
|
48
|
+
class HybridAliPushPluginSpecSwift: public virtual HybridAliPushPluginSpec {
|
|
49
|
+
public:
|
|
50
|
+
// Constructor from a Swift instance
|
|
51
|
+
explicit HybridAliPushPluginSpecSwift(const NitroAliPush::HybridAliPushPluginSpec_cxx& swiftPart):
|
|
52
|
+
HybridObject(HybridAliPushPluginSpec::TAG),
|
|
53
|
+
_swiftPart(swiftPart) { }
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
// Get the Swift part
|
|
57
|
+
inline NitroAliPush::HybridAliPushPluginSpec_cxx& getSwiftPart() noexcept {
|
|
58
|
+
return _swiftPart;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
63
|
+
return _swiftPart.getMemorySize();
|
|
64
|
+
}
|
|
65
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
66
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridAliPushPluginSpecSwift>(other)) {
|
|
67
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
void dispose() noexcept override {
|
|
72
|
+
_swiftPart.dispose();
|
|
73
|
+
}
|
|
74
|
+
std::string toString() override {
|
|
75
|
+
return _swiftPart.toString();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public:
|
|
79
|
+
// Properties
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
public:
|
|
83
|
+
// Methods
|
|
84
|
+
inline std::shared_ptr<Promise<void>> initPush(const std::string& appKey, const std::string& appSecret) override {
|
|
85
|
+
auto __result = _swiftPart.initPush(appKey, appSecret);
|
|
86
|
+
if (__result.hasError()) [[unlikely]] {
|
|
87
|
+
std::rethrow_exception(__result.error());
|
|
88
|
+
}
|
|
89
|
+
auto __value = std::move(__result.value());
|
|
90
|
+
return __value;
|
|
91
|
+
}
|
|
92
|
+
inline std::shared_ptr<Promise<std::string>> getDeviceId() override {
|
|
93
|
+
auto __result = _swiftPart.getDeviceId();
|
|
94
|
+
if (__result.hasError()) [[unlikely]] {
|
|
95
|
+
std::rethrow_exception(__result.error());
|
|
96
|
+
}
|
|
97
|
+
auto __value = std::move(__result.value());
|
|
98
|
+
return __value;
|
|
99
|
+
}
|
|
100
|
+
inline std::shared_ptr<Promise<void>> bindAccount(const std::string& account) override {
|
|
101
|
+
auto __result = _swiftPart.bindAccount(account);
|
|
102
|
+
if (__result.hasError()) [[unlikely]] {
|
|
103
|
+
std::rethrow_exception(__result.error());
|
|
104
|
+
}
|
|
105
|
+
auto __value = std::move(__result.value());
|
|
106
|
+
return __value;
|
|
107
|
+
}
|
|
108
|
+
inline std::shared_ptr<Promise<void>> unbindAccount() override {
|
|
109
|
+
auto __result = _swiftPart.unbindAccount();
|
|
110
|
+
if (__result.hasError()) [[unlikely]] {
|
|
111
|
+
std::rethrow_exception(__result.error());
|
|
112
|
+
}
|
|
113
|
+
auto __value = std::move(__result.value());
|
|
114
|
+
return __value;
|
|
115
|
+
}
|
|
116
|
+
inline std::shared_ptr<Promise<void>> bindTag(double target, const std::vector<std::string>& tags, const std::optional<std::variant<nitro::NullType, std::string>>& alias) override {
|
|
117
|
+
auto __result = _swiftPart.bindTag(std::forward<decltype(target)>(target), tags, alias);
|
|
118
|
+
if (__result.hasError()) [[unlikely]] {
|
|
119
|
+
std::rethrow_exception(__result.error());
|
|
120
|
+
}
|
|
121
|
+
auto __value = std::move(__result.value());
|
|
122
|
+
return __value;
|
|
123
|
+
}
|
|
124
|
+
inline std::shared_ptr<Promise<void>> unbindTag(double target, const std::vector<std::string>& tags, const std::optional<std::variant<nitro::NullType, std::string>>& alias) override {
|
|
125
|
+
auto __result = _swiftPart.unbindTag(std::forward<decltype(target)>(target), tags, alias);
|
|
126
|
+
if (__result.hasError()) [[unlikely]] {
|
|
127
|
+
std::rethrow_exception(__result.error());
|
|
128
|
+
}
|
|
129
|
+
auto __value = std::move(__result.value());
|
|
130
|
+
return __value;
|
|
131
|
+
}
|
|
132
|
+
inline std::shared_ptr<Promise<std::string>> listTags(double target) override {
|
|
133
|
+
auto __result = _swiftPart.listTags(std::forward<decltype(target)>(target));
|
|
134
|
+
if (__result.hasError()) [[unlikely]] {
|
|
135
|
+
std::rethrow_exception(__result.error());
|
|
136
|
+
}
|
|
137
|
+
auto __value = std::move(__result.value());
|
|
138
|
+
return __value;
|
|
139
|
+
}
|
|
140
|
+
inline std::shared_ptr<Promise<void>> addAlias(const std::string& alias) override {
|
|
141
|
+
auto __result = _swiftPart.addAlias(alias);
|
|
142
|
+
if (__result.hasError()) [[unlikely]] {
|
|
143
|
+
std::rethrow_exception(__result.error());
|
|
144
|
+
}
|
|
145
|
+
auto __value = std::move(__result.value());
|
|
146
|
+
return __value;
|
|
147
|
+
}
|
|
148
|
+
inline std::shared_ptr<Promise<void>> removeAlias(const std::string& alias) override {
|
|
149
|
+
auto __result = _swiftPart.removeAlias(alias);
|
|
150
|
+
if (__result.hasError()) [[unlikely]] {
|
|
151
|
+
std::rethrow_exception(__result.error());
|
|
152
|
+
}
|
|
153
|
+
auto __value = std::move(__result.value());
|
|
154
|
+
return __value;
|
|
155
|
+
}
|
|
156
|
+
inline std::shared_ptr<Promise<std::string>> listAliases() override {
|
|
157
|
+
auto __result = _swiftPart.listAliases();
|
|
158
|
+
if (__result.hasError()) [[unlikely]] {
|
|
159
|
+
std::rethrow_exception(__result.error());
|
|
160
|
+
}
|
|
161
|
+
auto __value = std::move(__result.value());
|
|
162
|
+
return __value;
|
|
163
|
+
}
|
|
164
|
+
inline std::shared_ptr<Promise<void>> setApplicationIconBadgeNumber(double badge) override {
|
|
165
|
+
auto __result = _swiftPart.setApplicationIconBadgeNumber(std::forward<decltype(badge)>(badge));
|
|
166
|
+
if (__result.hasError()) [[unlikely]] {
|
|
167
|
+
std::rethrow_exception(__result.error());
|
|
168
|
+
}
|
|
169
|
+
auto __value = std::move(__result.value());
|
|
170
|
+
return __value;
|
|
171
|
+
}
|
|
172
|
+
inline std::shared_ptr<Promise<double>> getApplicationIconBadgeNumber() override {
|
|
173
|
+
auto __result = _swiftPart.getApplicationIconBadgeNumber();
|
|
174
|
+
if (__result.hasError()) [[unlikely]] {
|
|
175
|
+
std::rethrow_exception(__result.error());
|
|
176
|
+
}
|
|
177
|
+
auto __value = std::move(__result.value());
|
|
178
|
+
return __value;
|
|
179
|
+
}
|
|
180
|
+
inline std::shared_ptr<Promise<std::variant<nitro::NullType, AliPushMessage>>> getInitialMessage() override {
|
|
181
|
+
auto __result = _swiftPart.getInitialMessage();
|
|
182
|
+
if (__result.hasError()) [[unlikely]] {
|
|
183
|
+
std::rethrow_exception(__result.error());
|
|
184
|
+
}
|
|
185
|
+
auto __value = std::move(__result.value());
|
|
186
|
+
return __value;
|
|
187
|
+
}
|
|
188
|
+
inline std::shared_ptr<Promise<bool>> getAuthorizationStatus() override {
|
|
189
|
+
auto __result = _swiftPart.getAuthorizationStatus();
|
|
190
|
+
if (__result.hasError()) [[unlikely]] {
|
|
191
|
+
std::rethrow_exception(__result.error());
|
|
192
|
+
}
|
|
193
|
+
auto __value = std::move(__result.value());
|
|
194
|
+
return __value;
|
|
195
|
+
}
|
|
196
|
+
inline std::shared_ptr<Promise<void>> syncBadgeNum(double badge) override {
|
|
197
|
+
auto __result = _swiftPart.syncBadgeNum(std::forward<decltype(badge)>(badge));
|
|
198
|
+
if (__result.hasError()) [[unlikely]] {
|
|
199
|
+
std::rethrow_exception(__result.error());
|
|
200
|
+
}
|
|
201
|
+
auto __value = std::move(__result.value());
|
|
202
|
+
return __value;
|
|
203
|
+
}
|
|
204
|
+
inline std::function<void()> addListener(const std::function<void(const AliPushMessage& /* message */)>& listener) override {
|
|
205
|
+
auto __result = _swiftPart.addListener(listener);
|
|
206
|
+
if (__result.hasError()) [[unlikely]] {
|
|
207
|
+
std::rethrow_exception(__result.error());
|
|
208
|
+
}
|
|
209
|
+
auto __value = std::move(__result.value());
|
|
210
|
+
return __value;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
private:
|
|
214
|
+
NitroAliPush::HybridAliPushPluginSpec_cxx _swiftPart;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
} // namespace margelo::nitro::alipush
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AliPushAppState.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `AliPushAppState`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias AliPushAppState = margelo.nitro.alipush.AliPushAppState
|
|
12
|
+
|
|
13
|
+
public extension AliPushAppState {
|
|
14
|
+
/**
|
|
15
|
+
* Get a AliPushAppState for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "active":
|
|
21
|
+
self = .active
|
|
22
|
+
case "inactive":
|
|
23
|
+
self = .inactive
|
|
24
|
+
case "background":
|
|
25
|
+
self = .background
|
|
26
|
+
default:
|
|
27
|
+
return nil
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get the String value this AliPushAppState represents.
|
|
33
|
+
*/
|
|
34
|
+
var stringValue: String {
|
|
35
|
+
switch self {
|
|
36
|
+
case .active:
|
|
37
|
+
return "active"
|
|
38
|
+
case .inactive:
|
|
39
|
+
return "inactive"
|
|
40
|
+
case .background:
|
|
41
|
+
return "background"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AliPushMessage.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `AliPushMessage`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias AliPushMessage = margelo.nitro.alipush.AliPushMessage
|
|
14
|
+
|
|
15
|
+
public extension AliPushMessage {
|
|
16
|
+
private typealias bridge = margelo.nitro.alipush.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `AliPushMessage`.
|
|
20
|
+
*/
|
|
21
|
+
init(title: String?, subtitle: String?, body: String?, badge: Double?, extras: AnyMap?, type: AliPushMessageType?, actionIdentifier: String?, appState: AliPushAppState?, date: Variant_Double_String?) {
|
|
22
|
+
self.init({ () -> bridge.std__optional_std__string_ in
|
|
23
|
+
if let __unwrappedValue = title {
|
|
24
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
29
|
+
if let __unwrappedValue = subtitle {
|
|
30
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
34
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
35
|
+
if let __unwrappedValue = body {
|
|
36
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
37
|
+
} else {
|
|
38
|
+
return .init()
|
|
39
|
+
}
|
|
40
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
41
|
+
if let __unwrappedValue = badge {
|
|
42
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
43
|
+
} else {
|
|
44
|
+
return .init()
|
|
45
|
+
}
|
|
46
|
+
}(), { () -> bridge.std__optional_std__shared_ptr_AnyMap__ in
|
|
47
|
+
if let __unwrappedValue = extras {
|
|
48
|
+
return bridge.create_std__optional_std__shared_ptr_AnyMap__(__unwrappedValue.cppPart)
|
|
49
|
+
} else {
|
|
50
|
+
return .init()
|
|
51
|
+
}
|
|
52
|
+
}(), { () -> bridge.std__optional_AliPushMessageType_ in
|
|
53
|
+
if let __unwrappedValue = type {
|
|
54
|
+
return bridge.create_std__optional_AliPushMessageType_(__unwrappedValue)
|
|
55
|
+
} else {
|
|
56
|
+
return .init()
|
|
57
|
+
}
|
|
58
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
59
|
+
if let __unwrappedValue = actionIdentifier {
|
|
60
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
61
|
+
} else {
|
|
62
|
+
return .init()
|
|
63
|
+
}
|
|
64
|
+
}(), { () -> bridge.std__optional_AliPushAppState_ in
|
|
65
|
+
if let __unwrappedValue = appState {
|
|
66
|
+
return bridge.create_std__optional_AliPushAppState_(__unwrappedValue)
|
|
67
|
+
} else {
|
|
68
|
+
return .init()
|
|
69
|
+
}
|
|
70
|
+
}(), { () -> bridge.std__optional_std__variant_double__std__string__ in
|
|
71
|
+
if let __unwrappedValue = date {
|
|
72
|
+
return bridge.create_std__optional_std__variant_double__std__string__({ () -> bridge.std__variant_double__std__string_ in
|
|
73
|
+
switch __unwrappedValue {
|
|
74
|
+
case .first(let __value):
|
|
75
|
+
return bridge.create_std__variant_double__std__string_(__value)
|
|
76
|
+
case .second(let __value):
|
|
77
|
+
return bridge.create_std__variant_double__std__string_(std.string(__value))
|
|
78
|
+
}
|
|
79
|
+
}().variant)
|
|
80
|
+
} else {
|
|
81
|
+
return .init()
|
|
82
|
+
}
|
|
83
|
+
}())
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@inline(__always)
|
|
87
|
+
var title: String? {
|
|
88
|
+
return { () -> String? in
|
|
89
|
+
if bridge.has_value_std__optional_std__string_(self.__title) {
|
|
90
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__title)
|
|
91
|
+
return String(__unwrapped)
|
|
92
|
+
} else {
|
|
93
|
+
return nil
|
|
94
|
+
}
|
|
95
|
+
}()
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@inline(__always)
|
|
99
|
+
var subtitle: String? {
|
|
100
|
+
return { () -> String? in
|
|
101
|
+
if bridge.has_value_std__optional_std__string_(self.__subtitle) {
|
|
102
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__subtitle)
|
|
103
|
+
return String(__unwrapped)
|
|
104
|
+
} else {
|
|
105
|
+
return nil
|
|
106
|
+
}
|
|
107
|
+
}()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@inline(__always)
|
|
111
|
+
var body: String? {
|
|
112
|
+
return { () -> String? in
|
|
113
|
+
if bridge.has_value_std__optional_std__string_(self.__body) {
|
|
114
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__body)
|
|
115
|
+
return String(__unwrapped)
|
|
116
|
+
} else {
|
|
117
|
+
return nil
|
|
118
|
+
}
|
|
119
|
+
}()
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@inline(__always)
|
|
123
|
+
var badge: Double? {
|
|
124
|
+
return { () -> Double? in
|
|
125
|
+
if bridge.has_value_std__optional_double_(self.__badge) {
|
|
126
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__badge)
|
|
127
|
+
return __unwrapped
|
|
128
|
+
} else {
|
|
129
|
+
return nil
|
|
130
|
+
}
|
|
131
|
+
}()
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@inline(__always)
|
|
135
|
+
var extras: AnyMap? {
|
|
136
|
+
return { () -> AnyMap? in
|
|
137
|
+
if bridge.has_value_std__optional_std__shared_ptr_AnyMap__(self.__extras) {
|
|
138
|
+
let __unwrapped = bridge.get_std__optional_std__shared_ptr_AnyMap__(self.__extras)
|
|
139
|
+
return AnyMap(withCppPart: __unwrapped)
|
|
140
|
+
} else {
|
|
141
|
+
return nil
|
|
142
|
+
}
|
|
143
|
+
}()
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@inline(__always)
|
|
147
|
+
var type: AliPushMessageType? {
|
|
148
|
+
return self.__type.value
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@inline(__always)
|
|
152
|
+
var actionIdentifier: String? {
|
|
153
|
+
return { () -> String? in
|
|
154
|
+
if bridge.has_value_std__optional_std__string_(self.__actionIdentifier) {
|
|
155
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__actionIdentifier)
|
|
156
|
+
return String(__unwrapped)
|
|
157
|
+
} else {
|
|
158
|
+
return nil
|
|
159
|
+
}
|
|
160
|
+
}()
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@inline(__always)
|
|
164
|
+
var appState: AliPushAppState? {
|
|
165
|
+
return self.__appState.value
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@inline(__always)
|
|
169
|
+
var date: Variant_Double_String? {
|
|
170
|
+
return { () -> Variant_Double_String? in
|
|
171
|
+
if bridge.has_value_std__optional_std__variant_double__std__string__(self.__date) {
|
|
172
|
+
let __unwrapped = bridge.get_std__optional_std__variant_double__std__string__(self.__date)
|
|
173
|
+
return { () -> Variant_Double_String in
|
|
174
|
+
let __variant = bridge.std__variant_double__std__string_(__unwrapped)
|
|
175
|
+
switch __variant.index() {
|
|
176
|
+
case 0:
|
|
177
|
+
let __actual = __variant.get_0()
|
|
178
|
+
return .first(__actual)
|
|
179
|
+
case 1:
|
|
180
|
+
let __actual = __variant.get_1()
|
|
181
|
+
return .second(String(__actual))
|
|
182
|
+
default:
|
|
183
|
+
fatalError("Variant can never have index \(__variant.index())!")
|
|
184
|
+
}
|
|
185
|
+
}()
|
|
186
|
+
} else {
|
|
187
|
+
return nil
|
|
188
|
+
}
|
|
189
|
+
}()
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AliPushMessageType.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `AliPushMessageType`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias AliPushMessageType = margelo.nitro.alipush.AliPushMessageType
|
|
12
|
+
|
|
13
|
+
public extension AliPushMessageType {
|
|
14
|
+
/**
|
|
15
|
+
* Get a AliPushMessageType for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "notification":
|
|
21
|
+
self = .notification
|
|
22
|
+
case "message":
|
|
23
|
+
self = .message
|
|
24
|
+
default:
|
|
25
|
+
return nil
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get the String value this AliPushMessageType represents.
|
|
31
|
+
*/
|
|
32
|
+
var stringValue: String {
|
|
33
|
+
switch self {
|
|
34
|
+
case .notification:
|
|
35
|
+
return "notification"
|
|
36
|
+
case .message:
|
|
37
|
+
return "message"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `() -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void {
|
|
15
|
+
public typealias bridge = margelo.nitro.alipush.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: () -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping () -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call() -> Void {
|
|
25
|
+
self.closure()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void {
|
|
44
|
+
return Unmanaged<Func_void>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_AliPushMessage.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ message: AliPushMessage) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_AliPushMessage {
|
|
15
|
+
public typealias bridge = margelo.nitro.alipush.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ message: AliPushMessage) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ message: AliPushMessage) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(message: AliPushMessage) -> Void {
|
|
25
|
+
self.closure(message)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_AliPushMessage`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_AliPushMessage>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_AliPushMessage {
|
|
44
|
+
return Unmanaged<Func_void_AliPushMessage>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_bool.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ value: Bool) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_bool {
|
|
15
|
+
public typealias bridge = margelo.nitro.alipush.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ value: Bool) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ value: Bool) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(value: Bool) -> Void {
|
|
25
|
+
self.closure(value)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_bool`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_bool>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_bool {
|
|
44
|
+
return Unmanaged<Func_void_bool>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ value: Double) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_double {
|
|
15
|
+
public typealias bridge = margelo.nitro.alipush.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ value: Double) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ value: Double) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(value: Double) -> Void {
|
|
25
|
+
self.closure(value)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_double`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_double>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_double {
|
|
44
|
+
return Unmanaged<Func_void_double>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|