react-native-candle 0.1.4 → 0.1.6
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/ReactNativeCandle.podspec +37 -4
- package/ios/Sources/CandleLinkSheetWrapperView.swift +22 -3
- package/ios/Sources/CandleLinkViewModel.swift +1 -23
- package/ios/Sources/RNCandle.swift +44 -6
- package/lib/commonjs/index.js +13 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +13 -11
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +4 -6
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts +16 -3
- package/lib/typescript/commonjs/src/specs/RNCandle.nitro.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +4 -6
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts +16 -3
- package/lib/typescript/module/src/specs/RNCandle.nitro.d.ts.map +1 -1
- package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Bridge.hpp +109 -13
- package/nitrogen/generated/ios/ReactNativeCandle-Swift-Cxx-Umbrella.hpp +10 -0
- package/nitrogen/generated/ios/c++/HybridRNCandleSpecSwift.hpp +14 -4
- package/nitrogen/generated/ios/swift/Details.swift +105 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_LinkedAccount_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridRNCandleSpec.swift +3 -3
- package/nitrogen/generated/ios/swift/HybridRNCandleSpec_cxx.swift +31 -12
- package/nitrogen/generated/ios/swift/LinkedAccount.swift +86 -0
- package/nitrogen/generated/ios/swift/Service.swift +4 -8
- package/nitrogen/generated/ios/swift/State.swift +38 -0
- package/nitrogen/generated/shared/c++/Details.hpp +84 -0
- package/nitrogen/generated/shared/c++/HybridRNCandleSpec.hpp +7 -3
- package/nitrogen/generated/shared/c++/LinkedAccount.hpp +87 -0
- package/nitrogen/generated/shared/c++/Service.hpp +4 -8
- package/nitrogen/generated/shared/c++/State.hpp +78 -0
- package/package.json +1 -1
- package/plugin/withIosDeploymentTarget.js +101 -101
- package/src/index.ts +14 -15
- package/src/specs/RNCandle.nitro.ts +20 -6
|
@@ -8,15 +8,27 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `Details` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::rncandle { struct Details; }
|
|
11
13
|
// Forward declaration of `HybridRNCandleSpec` to properly resolve imports.
|
|
12
14
|
namespace margelo::nitro::rncandle { class HybridRNCandleSpec; }
|
|
15
|
+
// Forward declaration of `LinkedAccount` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::rncandle { struct LinkedAccount; }
|
|
17
|
+
// Forward declaration of `Service` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::rncandle { enum class Service; }
|
|
19
|
+
// Forward declaration of `State` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::rncandle { enum class State; }
|
|
13
21
|
|
|
14
22
|
// Forward declarations of Swift defined types
|
|
15
23
|
// Forward declaration of `HybridRNCandleSpec_cxx` to properly resolve imports.
|
|
16
24
|
namespace ReactNativeCandle { class HybridRNCandleSpec_cxx; }
|
|
17
25
|
|
|
18
26
|
// Include C++ defined types
|
|
27
|
+
#include "Details.hpp"
|
|
19
28
|
#include "HybridRNCandleSpec.hpp"
|
|
29
|
+
#include "LinkedAccount.hpp"
|
|
30
|
+
#include "Service.hpp"
|
|
31
|
+
#include "State.hpp"
|
|
20
32
|
#include <NitroModules/Promise.hpp>
|
|
21
33
|
#include <NitroModules/PromiseHolder.hpp>
|
|
22
34
|
#include <NitroModules/Result.hpp>
|
|
@@ -25,6 +37,7 @@ namespace ReactNativeCandle { class HybridRNCandleSpec_cxx; }
|
|
|
25
37
|
#include <memory>
|
|
26
38
|
#include <optional>
|
|
27
39
|
#include <string>
|
|
40
|
+
#include <vector>
|
|
28
41
|
|
|
29
42
|
/**
|
|
30
43
|
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
@@ -32,6 +45,26 @@ namespace ReactNativeCandle { class HybridRNCandleSpec_cxx; }
|
|
|
32
45
|
*/
|
|
33
46
|
namespace margelo::nitro::rncandle::bridge::swift {
|
|
34
47
|
|
|
48
|
+
// pragma MARK: std::vector<Service>
|
|
49
|
+
/**
|
|
50
|
+
* Specialized version of `std::vector<Service>`.
|
|
51
|
+
*/
|
|
52
|
+
using std__vector_Service_ = std::vector<Service>;
|
|
53
|
+
inline std::vector<Service> create_std__vector_Service_(size_t size) {
|
|
54
|
+
std::vector<Service> vector;
|
|
55
|
+
vector.reserve(size);
|
|
56
|
+
return vector;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// pragma MARK: std::optional<std::vector<Service>>
|
|
60
|
+
/**
|
|
61
|
+
* Specialized version of `std::optional<std::vector<Service>>`.
|
|
62
|
+
*/
|
|
63
|
+
using std__optional_std__vector_Service__ = std::optional<std::vector<Service>>;
|
|
64
|
+
inline std::optional<std::vector<Service>> create_std__optional_std__vector_Service__(const std::vector<Service>& value) {
|
|
65
|
+
return std::optional<std::vector<Service>>(value);
|
|
66
|
+
}
|
|
67
|
+
|
|
35
68
|
// pragma MARK: std::optional<std::string>
|
|
36
69
|
/**
|
|
37
70
|
* Specialized version of `std::optional<std::string>`.
|
|
@@ -63,16 +96,58 @@ namespace margelo::nitro::rncandle::bridge::swift {
|
|
|
63
96
|
return Func_void_std__string_Wrapper(std::move(value));
|
|
64
97
|
}
|
|
65
98
|
|
|
66
|
-
// pragma MARK: std::
|
|
99
|
+
// pragma MARK: std::optional<Details>
|
|
67
100
|
/**
|
|
68
|
-
* Specialized version of `std::
|
|
101
|
+
* Specialized version of `std::optional<Details>`.
|
|
69
102
|
*/
|
|
70
|
-
using
|
|
71
|
-
inline std::
|
|
72
|
-
return
|
|
103
|
+
using std__optional_Details_ = std::optional<Details>;
|
|
104
|
+
inline std::optional<Details> create_std__optional_Details_(const Details& value) {
|
|
105
|
+
return std::optional<Details>(value);
|
|
73
106
|
}
|
|
74
|
-
|
|
75
|
-
|
|
107
|
+
|
|
108
|
+
// pragma MARK: std::vector<LinkedAccount>
|
|
109
|
+
/**
|
|
110
|
+
* Specialized version of `std::vector<LinkedAccount>`.
|
|
111
|
+
*/
|
|
112
|
+
using std__vector_LinkedAccount_ = std::vector<LinkedAccount>;
|
|
113
|
+
inline std::vector<LinkedAccount> create_std__vector_LinkedAccount_(size_t size) {
|
|
114
|
+
std::vector<LinkedAccount> vector;
|
|
115
|
+
vector.reserve(size);
|
|
116
|
+
return vector;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// pragma MARK: std::shared_ptr<Promise<std::vector<LinkedAccount>>>
|
|
120
|
+
/**
|
|
121
|
+
* Specialized version of `std::shared_ptr<Promise<std::vector<LinkedAccount>>>`.
|
|
122
|
+
*/
|
|
123
|
+
using std__shared_ptr_Promise_std__vector_LinkedAccount___ = std::shared_ptr<Promise<std::vector<LinkedAccount>>>;
|
|
124
|
+
inline std::shared_ptr<Promise<std::vector<LinkedAccount>>> create_std__shared_ptr_Promise_std__vector_LinkedAccount___() {
|
|
125
|
+
return Promise<std::vector<LinkedAccount>>::create();
|
|
126
|
+
}
|
|
127
|
+
inline PromiseHolder<std::vector<LinkedAccount>> wrap_std__shared_ptr_Promise_std__vector_LinkedAccount___(std::shared_ptr<Promise<std::vector<LinkedAccount>>> promise) {
|
|
128
|
+
return PromiseHolder<std::vector<LinkedAccount>>(std::move(promise));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// pragma MARK: std::function<void(const std::vector<LinkedAccount>& /* result */)>
|
|
132
|
+
/**
|
|
133
|
+
* Specialized version of `std::function<void(const std::vector<LinkedAccount>&)>`.
|
|
134
|
+
*/
|
|
135
|
+
using Func_void_std__vector_LinkedAccount_ = std::function<void(const std::vector<LinkedAccount>& /* result */)>;
|
|
136
|
+
/**
|
|
137
|
+
* Wrapper class for a `std::function<void(const std::vector<LinkedAccount>& / * result * /)>`, this can be used from Swift.
|
|
138
|
+
*/
|
|
139
|
+
class Func_void_std__vector_LinkedAccount__Wrapper final {
|
|
140
|
+
public:
|
|
141
|
+
explicit Func_void_std__vector_LinkedAccount__Wrapper(std::function<void(const std::vector<LinkedAccount>& /* result */)>&& func): _function(std::make_shared<std::function<void(const std::vector<LinkedAccount>& /* result */)>>(std::move(func))) {}
|
|
142
|
+
inline void call(std::vector<LinkedAccount> result) const {
|
|
143
|
+
_function->operator()(result);
|
|
144
|
+
}
|
|
145
|
+
private:
|
|
146
|
+
std::shared_ptr<std::function<void(const std::vector<LinkedAccount>& /* result */)>> _function;
|
|
147
|
+
};
|
|
148
|
+
Func_void_std__vector_LinkedAccount_ create_Func_void_std__vector_LinkedAccount_(void* _Nonnull swiftClosureWrapper);
|
|
149
|
+
inline Func_void_std__vector_LinkedAccount__Wrapper wrap_Func_void_std__vector_LinkedAccount_(Func_void_std__vector_LinkedAccount_ value) {
|
|
150
|
+
return Func_void_std__vector_LinkedAccount__Wrapper(std::move(value));
|
|
76
151
|
}
|
|
77
152
|
|
|
78
153
|
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
@@ -131,6 +206,18 @@ namespace margelo::nitro::rncandle::bridge::swift {
|
|
|
131
206
|
return Func_void_Wrapper(std::move(value));
|
|
132
207
|
}
|
|
133
208
|
|
|
209
|
+
// pragma MARK: std::shared_ptr<Promise<std::string>>
|
|
210
|
+
/**
|
|
211
|
+
* Specialized version of `std::shared_ptr<Promise<std::string>>`.
|
|
212
|
+
*/
|
|
213
|
+
using std__shared_ptr_Promise_std__string__ = std::shared_ptr<Promise<std::string>>;
|
|
214
|
+
inline std::shared_ptr<Promise<std::string>> create_std__shared_ptr_Promise_std__string__() {
|
|
215
|
+
return Promise<std::string>::create();
|
|
216
|
+
}
|
|
217
|
+
inline PromiseHolder<std::string> wrap_std__shared_ptr_Promise_std__string__(std::shared_ptr<Promise<std::string>> promise) {
|
|
218
|
+
return PromiseHolder<std::string>(std::move(promise));
|
|
219
|
+
}
|
|
220
|
+
|
|
134
221
|
// pragma MARK: std::shared_ptr<margelo::nitro::rncandle::HybridRNCandleSpec>
|
|
135
222
|
/**
|
|
136
223
|
* Specialized version of `std::shared_ptr<margelo::nitro::rncandle::HybridRNCandleSpec>`.
|
|
@@ -152,13 +239,13 @@ namespace margelo::nitro::rncandle::bridge::swift {
|
|
|
152
239
|
return Result<void>::withError(error);
|
|
153
240
|
}
|
|
154
241
|
|
|
155
|
-
// pragma MARK: Result<std::shared_ptr<Promise<std::
|
|
156
|
-
using
|
|
157
|
-
inline
|
|
158
|
-
return Result<std::shared_ptr<Promise<std::
|
|
242
|
+
// pragma MARK: Result<std::shared_ptr<Promise<std::vector<LinkedAccount>>>>
|
|
243
|
+
using Result_std__shared_ptr_Promise_std__vector_LinkedAccount____ = Result<std::shared_ptr<Promise<std::vector<LinkedAccount>>>>;
|
|
244
|
+
inline Result_std__shared_ptr_Promise_std__vector_LinkedAccount____ create_Result_std__shared_ptr_Promise_std__vector_LinkedAccount____(const std::shared_ptr<Promise<std::vector<LinkedAccount>>>& value) {
|
|
245
|
+
return Result<std::shared_ptr<Promise<std::vector<LinkedAccount>>>>::withValue(value);
|
|
159
246
|
}
|
|
160
|
-
inline
|
|
161
|
-
return Result<std::shared_ptr<Promise<std::
|
|
247
|
+
inline Result_std__shared_ptr_Promise_std__vector_LinkedAccount____ create_Result_std__shared_ptr_Promise_std__vector_LinkedAccount____(const std::exception_ptr& error) {
|
|
248
|
+
return Result<std::shared_ptr<Promise<std::vector<LinkedAccount>>>>::withError(error);
|
|
162
249
|
}
|
|
163
250
|
|
|
164
251
|
// pragma MARK: Result<std::shared_ptr<Promise<void>>>
|
|
@@ -169,5 +256,14 @@ namespace margelo::nitro::rncandle::bridge::swift {
|
|
|
169
256
|
inline Result_std__shared_ptr_Promise_void___ create_Result_std__shared_ptr_Promise_void___(const std::exception_ptr& error) {
|
|
170
257
|
return Result<std::shared_ptr<Promise<void>>>::withError(error);
|
|
171
258
|
}
|
|
259
|
+
|
|
260
|
+
// pragma MARK: Result<std::shared_ptr<Promise<std::string>>>
|
|
261
|
+
using Result_std__shared_ptr_Promise_std__string___ = Result<std::shared_ptr<Promise<std::string>>>;
|
|
262
|
+
inline Result_std__shared_ptr_Promise_std__string___ create_Result_std__shared_ptr_Promise_std__string___(const std::shared_ptr<Promise<std::string>>& value) {
|
|
263
|
+
return Result<std::shared_ptr<Promise<std::string>>>::withValue(value);
|
|
264
|
+
}
|
|
265
|
+
inline Result_std__shared_ptr_Promise_std__string___ create_Result_std__shared_ptr_Promise_std__string___(const std::exception_ptr& error) {
|
|
266
|
+
return Result<std::shared_ptr<Promise<std::string>>>::withError(error);
|
|
267
|
+
}
|
|
172
268
|
|
|
173
269
|
} // namespace margelo::nitro::rncandle::bridge::swift
|
|
@@ -8,22 +8,31 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `Details` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::rncandle { struct Details; }
|
|
11
13
|
// Forward declaration of `HybridRNCandleSpec` to properly resolve imports.
|
|
12
14
|
namespace margelo::nitro::rncandle { class HybridRNCandleSpec; }
|
|
15
|
+
// Forward declaration of `LinkedAccount` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::rncandle { struct LinkedAccount; }
|
|
13
17
|
// Forward declaration of `PresentationBackground` to properly resolve imports.
|
|
14
18
|
namespace margelo::nitro::rncandle { enum class PresentationBackground; }
|
|
15
19
|
// Forward declaration of `PresentationStyle` to properly resolve imports.
|
|
16
20
|
namespace margelo::nitro::rncandle { enum class PresentationStyle; }
|
|
17
21
|
// Forward declaration of `Service` to properly resolve imports.
|
|
18
22
|
namespace margelo::nitro::rncandle { enum class Service; }
|
|
23
|
+
// Forward declaration of `State` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::rncandle { enum class State; }
|
|
19
25
|
// Forward declaration of `ToolCall` to properly resolve imports.
|
|
20
26
|
namespace margelo::nitro::rncandle { struct ToolCall; }
|
|
21
27
|
|
|
22
28
|
// Include C++ defined types
|
|
29
|
+
#include "Details.hpp"
|
|
23
30
|
#include "HybridRNCandleSpec.hpp"
|
|
31
|
+
#include "LinkedAccount.hpp"
|
|
24
32
|
#include "PresentationBackground.hpp"
|
|
25
33
|
#include "PresentationStyle.hpp"
|
|
26
34
|
#include "Service.hpp"
|
|
35
|
+
#include "State.hpp"
|
|
27
36
|
#include "ToolCall.hpp"
|
|
28
37
|
#include <NitroModules/Promise.hpp>
|
|
29
38
|
#include <NitroModules/Result.hpp>
|
|
@@ -32,6 +41,7 @@ namespace margelo::nitro::rncandle { struct ToolCall; }
|
|
|
32
41
|
#include <memory>
|
|
33
42
|
#include <optional>
|
|
34
43
|
#include <string>
|
|
44
|
+
#include <vector>
|
|
35
45
|
|
|
36
46
|
// C++ helpers for Swift
|
|
37
47
|
#include "ReactNativeCandle-Swift-Cxx-Bridge.hpp"
|
|
@@ -18,16 +18,26 @@ namespace margelo::nitro::rncandle { enum class Service; }
|
|
|
18
18
|
namespace margelo::nitro::rncandle { enum class PresentationBackground; }
|
|
19
19
|
// Forward declaration of `PresentationStyle` to properly resolve imports.
|
|
20
20
|
namespace margelo::nitro::rncandle { enum class PresentationStyle; }
|
|
21
|
+
// Forward declaration of `LinkedAccount` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::rncandle { struct LinkedAccount; }
|
|
23
|
+
// Forward declaration of `Details` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::rncandle { struct Details; }
|
|
25
|
+
// Forward declaration of `State` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::rncandle { enum class State; }
|
|
21
27
|
// Forward declaration of `ToolCall` to properly resolve imports.
|
|
22
28
|
namespace margelo::nitro::rncandle { struct ToolCall; }
|
|
23
29
|
|
|
24
|
-
#include "Service.hpp"
|
|
25
30
|
#include <optional>
|
|
31
|
+
#include <vector>
|
|
32
|
+
#include "Service.hpp"
|
|
26
33
|
#include <string>
|
|
27
34
|
#include "PresentationBackground.hpp"
|
|
28
35
|
#include "PresentationStyle.hpp"
|
|
29
36
|
#include <functional>
|
|
30
37
|
#include <NitroModules/Promise.hpp>
|
|
38
|
+
#include "LinkedAccount.hpp"
|
|
39
|
+
#include "Details.hpp"
|
|
40
|
+
#include "State.hpp"
|
|
31
41
|
#include "ToolCall.hpp"
|
|
32
42
|
|
|
33
43
|
#include "ReactNativeCandle-Swift-Cxx-Umbrella.hpp"
|
|
@@ -69,13 +79,13 @@ namespace margelo::nitro::rncandle {
|
|
|
69
79
|
|
|
70
80
|
public:
|
|
71
81
|
// Methods
|
|
72
|
-
inline void candleLinkSheet(bool isPresented, Service
|
|
73
|
-
auto __result = _swiftPart.candleLinkSheet(std::forward<decltype(isPresented)>(isPresented),
|
|
82
|
+
inline void candleLinkSheet(bool isPresented, const std::optional<std::vector<Service>>& services, double cornerRadius, const std::optional<std::string>& customerName, bool showDynamicLoading, PresentationBackground presentationBackground, PresentationStyle presentationStyle, const std::function<void(const std::string& /* account */)>& onSuccess) override {
|
|
83
|
+
auto __result = _swiftPart.candleLinkSheet(std::forward<decltype(isPresented)>(isPresented), services, std::forward<decltype(cornerRadius)>(cornerRadius), customerName, std::forward<decltype(showDynamicLoading)>(showDynamicLoading), static_cast<int>(presentationBackground), static_cast<int>(presentationStyle), onSuccess);
|
|
74
84
|
if (__result.hasError()) [[unlikely]] {
|
|
75
85
|
std::rethrow_exception(__result.error());
|
|
76
86
|
}
|
|
77
87
|
}
|
|
78
|
-
inline std::shared_ptr<Promise<std::
|
|
88
|
+
inline std::shared_ptr<Promise<std::vector<LinkedAccount>>> getLinkedAccounts() override {
|
|
79
89
|
auto __result = _swiftPart.getLinkedAccounts();
|
|
80
90
|
if (__result.hasError()) [[unlikely]] {
|
|
81
91
|
std::rethrow_exception(__result.error());
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Details.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/// Represents an instance of `Details`, backed by a C++ struct.
|
|
11
|
+
public typealias Details = margelo.nitro.rncandle.Details
|
|
12
|
+
|
|
13
|
+
extension Details {
|
|
14
|
+
private typealias bridge = margelo.nitro.rncandle.bridge.swift
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Create a new instance of `Details`.
|
|
18
|
+
*/
|
|
19
|
+
public init(state: State, username: String?, legalName: String, accountOpened: String?) {
|
|
20
|
+
self.init(
|
|
21
|
+
state,
|
|
22
|
+
{ () -> bridge.std__optional_std__string_ in
|
|
23
|
+
if let __unwrappedValue = username {
|
|
24
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), std.string(legalName),
|
|
29
|
+
{ () -> bridge.std__optional_std__string_ in
|
|
30
|
+
if let __unwrappedValue = accountOpened {
|
|
31
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
32
|
+
} else {
|
|
33
|
+
return .init()
|
|
34
|
+
}
|
|
35
|
+
}())
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public var state: State {
|
|
39
|
+
@inline(__always)
|
|
40
|
+
get {
|
|
41
|
+
return self.__state
|
|
42
|
+
}
|
|
43
|
+
@inline(__always)
|
|
44
|
+
set {
|
|
45
|
+
self.__state = newValue
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public var username: String? {
|
|
50
|
+
@inline(__always)
|
|
51
|
+
get {
|
|
52
|
+
return { () -> String? in
|
|
53
|
+
if let __unwrapped = self.__username.value {
|
|
54
|
+
return String(__unwrapped)
|
|
55
|
+
} else {
|
|
56
|
+
return nil
|
|
57
|
+
}
|
|
58
|
+
}()
|
|
59
|
+
}
|
|
60
|
+
@inline(__always)
|
|
61
|
+
set {
|
|
62
|
+
self.__username = { () -> bridge.std__optional_std__string_ in
|
|
63
|
+
if let __unwrappedValue = newValue {
|
|
64
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
65
|
+
} else {
|
|
66
|
+
return .init()
|
|
67
|
+
}
|
|
68
|
+
}()
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public var legalName: String {
|
|
73
|
+
@inline(__always)
|
|
74
|
+
get {
|
|
75
|
+
return String(self.__legalName)
|
|
76
|
+
}
|
|
77
|
+
@inline(__always)
|
|
78
|
+
set {
|
|
79
|
+
self.__legalName = std.string(newValue)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public var accountOpened: String? {
|
|
84
|
+
@inline(__always)
|
|
85
|
+
get {
|
|
86
|
+
return { () -> String? in
|
|
87
|
+
if let __unwrapped = self.__accountOpened.value {
|
|
88
|
+
return String(__unwrapped)
|
|
89
|
+
} else {
|
|
90
|
+
return nil
|
|
91
|
+
}
|
|
92
|
+
}()
|
|
93
|
+
}
|
|
94
|
+
@inline(__always)
|
|
95
|
+
set {
|
|
96
|
+
self.__accountOpened = { () -> bridge.std__optional_std__string_ in
|
|
97
|
+
if let __unwrappedValue = newValue {
|
|
98
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
99
|
+
} else {
|
|
100
|
+
return .init()
|
|
101
|
+
}
|
|
102
|
+
}()
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__vector_LinkedAccount_.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/// Wraps a Swift `(_ value: [LinkedAccount]) -> Void` as a class.
|
|
11
|
+
/// This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
12
|
+
public final class Func_void_std__vector_LinkedAccount_ {
|
|
13
|
+
public typealias bridge = margelo.nitro.rncandle.bridge.swift
|
|
14
|
+
|
|
15
|
+
private let closure: (_ value: [LinkedAccount]) -> Void
|
|
16
|
+
|
|
17
|
+
public init(_ closure: @escaping (_ value: [LinkedAccount]) -> Void) {
|
|
18
|
+
self.closure = closure
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@inline(__always)
|
|
22
|
+
public func call(value: bridge.std__vector_LinkedAccount_) {
|
|
23
|
+
self.closure(value.map({ __item in __item }))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
28
|
+
* This acquires one additional strong reference on the object!
|
|
29
|
+
*/
|
|
30
|
+
@inline(__always)
|
|
31
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
32
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Casts an unsafe pointer to a `Func_void_std__vector_LinkedAccount_`.
|
|
37
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_LinkedAccount_>`.
|
|
38
|
+
* This removes one strong reference from the object!
|
|
39
|
+
*/
|
|
40
|
+
@inline(__always)
|
|
41
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer)
|
|
42
|
+
-> Func_void_std__vector_LinkedAccount_
|
|
43
|
+
{
|
|
44
|
+
return Unmanaged<Func_void_std__vector_LinkedAccount_>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -14,10 +14,10 @@ public protocol HybridRNCandleSpec_protocol: HybridObject {
|
|
|
14
14
|
|
|
15
15
|
// Methods
|
|
16
16
|
func candleLinkSheet(
|
|
17
|
-
isPresented: Bool,
|
|
18
|
-
|
|
17
|
+
isPresented: Bool, services: [Service]?, cornerRadius: Double, customerName: String?,
|
|
18
|
+
showDynamicLoading: Bool, presentationBackground: PresentationBackground,
|
|
19
19
|
presentationStyle: PresentationStyle, onSuccess: @escaping (_ account: String) -> Void) throws
|
|
20
|
-
func getLinkedAccounts() throws -> Promise<
|
|
20
|
+
func getLinkedAccounts() throws -> Promise<[LinkedAccount]>
|
|
21
21
|
func unlinkAccount(linkedAccountID: String) throws -> Promise<Void>
|
|
22
22
|
func getFiatAccounts() throws -> Promise<String>
|
|
23
23
|
func getActivity(span: String?) throws -> Promise<String>
|
|
@@ -99,21 +99,27 @@ public class HybridRNCandleSpec_cxx {
|
|
|
99
99
|
// Methods
|
|
100
100
|
@inline(__always)
|
|
101
101
|
public final func candleLinkSheet(
|
|
102
|
-
isPresented: Bool,
|
|
103
|
-
customerName: bridge.std__optional_std__string_,
|
|
102
|
+
isPresented: Bool, services: bridge.std__optional_std__vector_Service__, cornerRadius: Double,
|
|
103
|
+
customerName: bridge.std__optional_std__string_, showDynamicLoading: Bool,
|
|
104
104
|
presentationBackground: Int32, presentationStyle: Int32, onSuccess: bridge.Func_void_std__string
|
|
105
105
|
) -> bridge.Result_void_ {
|
|
106
106
|
do {
|
|
107
107
|
try self.__implementation.candleLinkSheet(
|
|
108
|
-
isPresented: isPresented,
|
|
109
|
-
|
|
108
|
+
isPresented: isPresented,
|
|
109
|
+
services: { () -> [Service]? in
|
|
110
|
+
if let __unwrapped = services.value {
|
|
111
|
+
return __unwrapped.map({ __item in __item })
|
|
112
|
+
} else {
|
|
113
|
+
return nil
|
|
114
|
+
}
|
|
115
|
+
}(), cornerRadius: cornerRadius,
|
|
110
116
|
customerName: { () -> String? in
|
|
111
117
|
if let __unwrapped = customerName.value {
|
|
112
118
|
return String(__unwrapped)
|
|
113
119
|
} else {
|
|
114
120
|
return nil
|
|
115
121
|
}
|
|
116
|
-
}(),
|
|
122
|
+
}(), showDynamicLoading: showDynamicLoading,
|
|
117
123
|
presentationBackground: margelo.nitro.rncandle.PresentationBackground(
|
|
118
124
|
rawValue: presentationBackground)!,
|
|
119
125
|
presentationStyle: margelo.nitro.rncandle.PresentationStyle(rawValue: presentationStyle)!,
|
|
@@ -131,21 +137,34 @@ public class HybridRNCandleSpec_cxx {
|
|
|
131
137
|
}
|
|
132
138
|
|
|
133
139
|
@inline(__always)
|
|
134
|
-
public final func getLinkedAccounts()
|
|
140
|
+
public final func getLinkedAccounts()
|
|
141
|
+
-> bridge.Result_std__shared_ptr_Promise_std__vector_LinkedAccount____
|
|
142
|
+
{
|
|
135
143
|
do {
|
|
136
144
|
let __result = try self.__implementation.getLinkedAccounts()
|
|
137
|
-
let __resultCpp = { () -> bridge.
|
|
138
|
-
let __promise = bridge.
|
|
139
|
-
let __promiseHolder = bridge.
|
|
145
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__vector_LinkedAccount___ in
|
|
146
|
+
let __promise = bridge.create_std__shared_ptr_Promise_std__vector_LinkedAccount___()
|
|
147
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__vector_LinkedAccount___(
|
|
148
|
+
__promise)
|
|
140
149
|
__result
|
|
141
|
-
.then({ __result in
|
|
150
|
+
.then({ __result in
|
|
151
|
+
__promiseHolder.resolve(
|
|
152
|
+
{ () -> bridge.std__vector_LinkedAccount_ in
|
|
153
|
+
var __vector = bridge.create_std__vector_LinkedAccount_(__result.count)
|
|
154
|
+
for __item in __result {
|
|
155
|
+
__vector.push_back(__item)
|
|
156
|
+
}
|
|
157
|
+
return __vector
|
|
158
|
+
}())
|
|
159
|
+
})
|
|
142
160
|
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
143
161
|
return __promise
|
|
144
162
|
}()
|
|
145
|
-
return bridge.
|
|
163
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__vector_LinkedAccount____(__resultCpp)
|
|
146
164
|
} catch (let __error) {
|
|
147
165
|
let __exceptionPtr = __error.toCpp()
|
|
148
|
-
return bridge.
|
|
166
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__vector_LinkedAccount____(
|
|
167
|
+
__exceptionPtr)
|
|
149
168
|
}
|
|
150
169
|
}
|
|
151
170
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// LinkedAccount.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/// Represents an instance of `LinkedAccount`, backed by a C++ struct.
|
|
11
|
+
public typealias LinkedAccount = margelo.nitro.rncandle.LinkedAccount
|
|
12
|
+
|
|
13
|
+
extension LinkedAccount {
|
|
14
|
+
private typealias bridge = margelo.nitro.rncandle.bridge.swift
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Create a new instance of `LinkedAccount`.
|
|
18
|
+
*/
|
|
19
|
+
public init(serviceUserID: String, details: Details?, linkedAccountID: String, service: Service) {
|
|
20
|
+
self.init(
|
|
21
|
+
std.string(serviceUserID),
|
|
22
|
+
{ () -> bridge.std__optional_Details_ in
|
|
23
|
+
if let __unwrappedValue = details {
|
|
24
|
+
return bridge.create_std__optional_Details_(__unwrappedValue)
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), std.string(linkedAccountID), service)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public var serviceUserID: String {
|
|
32
|
+
@inline(__always)
|
|
33
|
+
get {
|
|
34
|
+
return String(self.__serviceUserID)
|
|
35
|
+
}
|
|
36
|
+
@inline(__always)
|
|
37
|
+
set {
|
|
38
|
+
self.__serviceUserID = std.string(newValue)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public var details: Details? {
|
|
43
|
+
@inline(__always)
|
|
44
|
+
get {
|
|
45
|
+
return { () -> Details? in
|
|
46
|
+
if let __unwrapped = self.__details.value {
|
|
47
|
+
return __unwrapped
|
|
48
|
+
} else {
|
|
49
|
+
return nil
|
|
50
|
+
}
|
|
51
|
+
}()
|
|
52
|
+
}
|
|
53
|
+
@inline(__always)
|
|
54
|
+
set {
|
|
55
|
+
self.__details = { () -> bridge.std__optional_Details_ in
|
|
56
|
+
if let __unwrappedValue = newValue {
|
|
57
|
+
return bridge.create_std__optional_Details_(__unwrappedValue)
|
|
58
|
+
} else {
|
|
59
|
+
return .init()
|
|
60
|
+
}
|
|
61
|
+
}()
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public var linkedAccountID: String {
|
|
66
|
+
@inline(__always)
|
|
67
|
+
get {
|
|
68
|
+
return String(self.__linkedAccountID)
|
|
69
|
+
}
|
|
70
|
+
@inline(__always)
|
|
71
|
+
set {
|
|
72
|
+
self.__linkedAccountID = std.string(newValue)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public var service: Service {
|
|
77
|
+
@inline(__always)
|
|
78
|
+
get {
|
|
79
|
+
return self.__service
|
|
80
|
+
}
|
|
81
|
+
@inline(__always)
|
|
82
|
+
set {
|
|
83
|
+
self.__service = newValue
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -23,14 +23,12 @@ extension Service {
|
|
|
23
23
|
self = .venmo
|
|
24
24
|
case "apple":
|
|
25
25
|
self = .apple
|
|
26
|
-
case "
|
|
27
|
-
self = .
|
|
26
|
+
case "sandbox":
|
|
27
|
+
self = .sandbox
|
|
28
28
|
case "uber":
|
|
29
29
|
self = .uber
|
|
30
30
|
case "lyft":
|
|
31
31
|
self = .lyft
|
|
32
|
-
case "default":
|
|
33
|
-
self = .default
|
|
34
32
|
default:
|
|
35
33
|
return nil
|
|
36
34
|
}
|
|
@@ -49,14 +47,12 @@ extension Service {
|
|
|
49
47
|
return "venmo"
|
|
50
48
|
case .apple:
|
|
51
49
|
return "apple"
|
|
52
|
-
case .
|
|
53
|
-
return "
|
|
50
|
+
case .sandbox:
|
|
51
|
+
return "sandbox"
|
|
54
52
|
case .uber:
|
|
55
53
|
return "uber"
|
|
56
54
|
case .lyft:
|
|
57
55
|
return "lyft"
|
|
58
|
-
case .default:
|
|
59
|
-
return "default"
|
|
60
56
|
}
|
|
61
57
|
}
|
|
62
58
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// State.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/// Represents the JS union `State`, backed by a C++ enum.
|
|
9
|
+
public typealias State = margelo.nitro.rncandle.State
|
|
10
|
+
|
|
11
|
+
extension State {
|
|
12
|
+
/**
|
|
13
|
+
* Get a State for the given String value, or
|
|
14
|
+
* return `nil` if the given value was invalid/unknown.
|
|
15
|
+
*/
|
|
16
|
+
public init?(fromString string: String) {
|
|
17
|
+
switch string {
|
|
18
|
+
case "active":
|
|
19
|
+
self = .active
|
|
20
|
+
case "inactive":
|
|
21
|
+
self = .inactive
|
|
22
|
+
default:
|
|
23
|
+
return nil
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get the String value this State represents.
|
|
29
|
+
*/
|
|
30
|
+
public var stringValue: String {
|
|
31
|
+
switch self {
|
|
32
|
+
case .active:
|
|
33
|
+
return "active"
|
|
34
|
+
case .inactive:
|
|
35
|
+
return "inactive"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|