@onekeyfe/react-native-perp-depth-bar 3.0.48 → 3.0.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/margelo/nitro/perpdepthbar/HybridPerpDepthBars.kt +121 -15
- package/android/src/main/java/com/margelo/nitro/perpdepthbar/HybridPerpSideRatio.kt +30 -0
- package/ios/HybridPerpDepthBars.swift +84 -5
- package/ios/HybridPerpSideRatio.swift +19 -1
- package/ios/PerpColorParser.swift +10 -1
- package/lib/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +47 -1
- package/lib/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +6 -1
- package/lib/nitrogen/generated/android/c++/JHybridPerpSideRatioSpec.cpp +4 -1
- package/lib/nitrogen/generated/android/c++/JHybridPerpSideRatioSpec.hpp +1 -1
- package/lib/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +8 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +19 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpSideRatioSpec.kt +3 -1
- package/lib/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.hpp +11 -0
- package/lib/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Umbrella.hpp +3 -0
- package/lib/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +29 -2
- package/lib/nitrogen/generated/ios/c++/HybridPerpSideRatioSpecSwift.hpp +6 -1
- package/lib/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +10 -0
- package/lib/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +4 -1
- package/lib/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +44 -0
- package/lib/nitrogen/generated/ios/swift/HybridPerpSideRatioSpec.swift +1 -1
- package/lib/nitrogen/generated/ios/swift/HybridPerpSideRatioSpec_cxx.swift +11 -0
- package/lib/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +6 -0
- package/lib/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +7 -1
- package/lib/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.cpp +1 -0
- package/lib/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.hpp +1 -1
- package/lib/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +24 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +2 -0
- package/lib/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +2 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +47 -1
- package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +6 -1
- package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpSideRatioSpec.cpp +4 -1
- package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpSideRatioSpec.hpp +1 -1
- package/lib/nitrogen/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +8 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +19 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpSideRatioSpec.kt +3 -1
- package/lib/nitrogen/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.hpp +11 -0
- package/lib/nitrogen/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Umbrella.hpp +3 -0
- package/lib/nitrogen/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +29 -2
- package/lib/nitrogen/nitrogen/generated/ios/c++/HybridPerpSideRatioSpecSwift.hpp +6 -1
- package/lib/nitrogen/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +10 -0
- package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +4 -1
- package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +44 -0
- package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpSideRatioSpec.swift +1 -1
- package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpSideRatioSpec_cxx.swift +11 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +6 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +7 -1
- package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.cpp +1 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.hpp +1 -1
- package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +24 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +2 -0
- package/lib/nitrogen/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +2 -0
- package/lib/typescript/src/PerpDepthBars.nitro.d.ts +81 -3
- package/lib/typescript/src/PerpDepthBars.nitro.d.ts.map +1 -1
- package/lib/typescript/src/PerpSideRatio.nitro.d.ts +25 -2
- package/lib/typescript/src/PerpSideRatio.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +47 -1
- package/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +6 -1
- package/nitrogen/generated/android/c++/JHybridPerpSideRatioSpec.cpp +4 -1
- package/nitrogen/generated/android/c++/JHybridPerpSideRatioSpec.hpp +1 -1
- package/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +8 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpSideRatioSpec.kt +3 -1
- package/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.hpp +11 -0
- package/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Umbrella.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +29 -2
- package/nitrogen/generated/ios/c++/HybridPerpSideRatioSpecSwift.hpp +6 -1
- package/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +10 -0
- package/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +4 -1
- package/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +44 -0
- package/nitrogen/generated/ios/swift/HybridPerpSideRatioSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridPerpSideRatioSpec_cxx.swift +11 -0
- package/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +6 -0
- package/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +7 -1
- package/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +24 -0
- package/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +2 -0
- package/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +2 -0
- package/package.json +1 -1
- package/src/PerpDepthBars.nitro.ts +85 -9
- package/src/PerpSideRatio.nitro.ts +27 -3
|
@@ -12,12 +12,15 @@
|
|
|
12
12
|
// Forward declaration of `HybridPerpDepthBarsSpec_cxx` to properly resolve imports.
|
|
13
13
|
namespace PerpDepthBar { class HybridPerpDepthBarsSpec_cxx; }
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// Forward declaration of `ArrayBufferHolder` to properly resolve imports.
|
|
16
|
+
namespace NitroModules { class ArrayBufferHolder; }
|
|
16
17
|
|
|
17
18
|
#include <vector>
|
|
18
19
|
#include <string>
|
|
19
20
|
#include <functional>
|
|
20
21
|
#include <optional>
|
|
22
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
23
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
21
24
|
|
|
22
25
|
#include "PerpDepthBar-Swift-Cxx-Umbrella.hpp"
|
|
23
26
|
|
|
@@ -156,6 +159,19 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
156
159
|
inline void setTextInset(double textInset) noexcept override {
|
|
157
160
|
_swiftPart.setTextInset(std::forward<decltype(textInset)>(textInset));
|
|
158
161
|
}
|
|
162
|
+
inline std::string getPlaceholderText() noexcept override {
|
|
163
|
+
auto __result = _swiftPart.getPlaceholderText();
|
|
164
|
+
return __result;
|
|
165
|
+
}
|
|
166
|
+
inline void setPlaceholderText(const std::string& placeholderText) noexcept override {
|
|
167
|
+
_swiftPart.setPlaceholderText(placeholderText);
|
|
168
|
+
}
|
|
169
|
+
inline double getPlaceholderRows() noexcept override {
|
|
170
|
+
return _swiftPart.getPlaceholderRows();
|
|
171
|
+
}
|
|
172
|
+
inline void setPlaceholderRows(double placeholderRows) noexcept override {
|
|
173
|
+
_swiftPart.setPlaceholderRows(std::forward<decltype(placeholderRows)>(placeholderRows));
|
|
174
|
+
}
|
|
159
175
|
inline std::optional<std::function<void(double /* rowIndex */)>> getOnRowPress() noexcept override {
|
|
160
176
|
auto __result = _swiftPart.getOnRowPress();
|
|
161
177
|
return __result;
|
|
@@ -166,7 +182,18 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
166
182
|
|
|
167
183
|
public:
|
|
168
184
|
// Methods
|
|
169
|
-
|
|
185
|
+
inline void setDepth(const std::shared_ptr<ArrayBuffer>& buffer) override {
|
|
186
|
+
auto __result = _swiftPart.setDepth(ArrayBufferHolder(buffer));
|
|
187
|
+
if (__result.hasError()) [[unlikely]] {
|
|
188
|
+
std::rethrow_exception(__result.error());
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
inline void setText(const std::vector<std::string>& prices, const std::vector<std::string>& sizes) override {
|
|
192
|
+
auto __result = _swiftPart.setText(prices, sizes);
|
|
193
|
+
if (__result.hasError()) [[unlikely]] {
|
|
194
|
+
std::rethrow_exception(__result.error());
|
|
195
|
+
}
|
|
196
|
+
}
|
|
170
197
|
|
|
171
198
|
private:
|
|
172
199
|
PerpDepthBar::HybridPerpDepthBarsSpec_cxx _swiftPart;
|
|
@@ -109,7 +109,12 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
109
109
|
|
|
110
110
|
public:
|
|
111
111
|
// Methods
|
|
112
|
-
|
|
112
|
+
inline void setRatio(double bidPercentage, double askPercentage) override {
|
|
113
|
+
auto __result = _swiftPart.setRatio(std::forward<decltype(bidPercentage)>(bidPercentage), std::forward<decltype(askPercentage)>(askPercentage));
|
|
114
|
+
if (__result.hasError()) [[unlikely]] {
|
|
115
|
+
std::rethrow_exception(__result.error());
|
|
116
|
+
}
|
|
117
|
+
}
|
|
113
118
|
|
|
114
119
|
private:
|
|
115
120
|
PerpDepthBar::HybridPerpSideRatioSpec_cxx _swiftPart;
|
|
@@ -146,6 +146,16 @@ using namespace margelo::nitro::perpdepthbar::views;
|
|
|
146
146
|
swiftPart.setTextInset(newViewProps.textInset.value);
|
|
147
147
|
newViewProps.textInset.isDirty = false;
|
|
148
148
|
}
|
|
149
|
+
// placeholderText: string
|
|
150
|
+
if (newViewProps.placeholderText.isDirty) {
|
|
151
|
+
swiftPart.setPlaceholderText(newViewProps.placeholderText.value);
|
|
152
|
+
newViewProps.placeholderText.isDirty = false;
|
|
153
|
+
}
|
|
154
|
+
// placeholderRows: number
|
|
155
|
+
if (newViewProps.placeholderRows.isDirty) {
|
|
156
|
+
swiftPart.setPlaceholderRows(newViewProps.placeholderRows.value);
|
|
157
|
+
newViewProps.placeholderRows.isDirty = false;
|
|
158
|
+
}
|
|
149
159
|
// onRowPress: optional
|
|
150
160
|
if (newViewProps.onRowPress.isDirty) {
|
|
151
161
|
swiftPart.setOnRowPress(newViewProps.onRowPress.value);
|
|
@@ -26,10 +26,13 @@ public protocol HybridPerpDepthBarsSpec_protocol: HybridObject, HybridView {
|
|
|
26
26
|
var priceFontSize: Double { get set }
|
|
27
27
|
var sizeFontSize: Double { get set }
|
|
28
28
|
var textInset: Double { get set }
|
|
29
|
+
var placeholderText: String { get set }
|
|
30
|
+
var placeholderRows: Double { get set }
|
|
29
31
|
var onRowPress: ((_ rowIndex: Double) -> Void)? { get set }
|
|
30
32
|
|
|
31
33
|
// Methods
|
|
32
|
-
|
|
34
|
+
func setDepth(buffer: ArrayBuffer) throws -> Void
|
|
35
|
+
func setText(prices: [String], sizes: [String]) throws -> Void
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
public extension HybridPerpDepthBarsSpec_protocol {
|
|
@@ -297,6 +297,28 @@ open class HybridPerpDepthBarsSpec_cxx {
|
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
|
|
300
|
+
public final var placeholderText: std.string {
|
|
301
|
+
@inline(__always)
|
|
302
|
+
get {
|
|
303
|
+
return std.string(self.__implementation.placeholderText)
|
|
304
|
+
}
|
|
305
|
+
@inline(__always)
|
|
306
|
+
set {
|
|
307
|
+
self.__implementation.placeholderText = String(newValue)
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
public final var placeholderRows: Double {
|
|
312
|
+
@inline(__always)
|
|
313
|
+
get {
|
|
314
|
+
return self.__implementation.placeholderRows
|
|
315
|
+
}
|
|
316
|
+
@inline(__always)
|
|
317
|
+
set {
|
|
318
|
+
self.__implementation.placeholderRows = newValue
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
300
322
|
public final var onRowPress: bridge.std__optional_std__function_void_double____rowIndex______ {
|
|
301
323
|
@inline(__always)
|
|
302
324
|
get {
|
|
@@ -330,6 +352,28 @@ open class HybridPerpDepthBarsSpec_cxx {
|
|
|
330
352
|
}
|
|
331
353
|
|
|
332
354
|
// Methods
|
|
355
|
+
@inline(__always)
|
|
356
|
+
public final func setDepth(buffer: ArrayBuffer) -> bridge.Result_void_ {
|
|
357
|
+
do {
|
|
358
|
+
try self.__implementation.setDepth(buffer: buffer)
|
|
359
|
+
return bridge.create_Result_void_()
|
|
360
|
+
} catch (let __error) {
|
|
361
|
+
let __exceptionPtr = __error.toCpp()
|
|
362
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
@inline(__always)
|
|
367
|
+
public final func setText(prices: bridge.std__vector_std__string_, sizes: bridge.std__vector_std__string_) -> bridge.Result_void_ {
|
|
368
|
+
do {
|
|
369
|
+
try self.__implementation.setText(prices: prices.map({ __item in String(__item) }), sizes: sizes.map({ __item in String(__item) }))
|
|
370
|
+
return bridge.create_Result_void_()
|
|
371
|
+
} catch (let __error) {
|
|
372
|
+
let __exceptionPtr = __error.toCpp()
|
|
373
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
333
377
|
public final func getView() -> UnsafeMutableRawPointer {
|
|
334
378
|
return Unmanaged.passRetained(__implementation.view).toOpaque()
|
|
335
379
|
}
|
|
@@ -21,7 +21,7 @@ public protocol HybridPerpSideRatioSpec_protocol: HybridObject, HybridView {
|
|
|
21
21
|
var reducedMotion: Bool { get set }
|
|
22
22
|
|
|
23
23
|
// Methods
|
|
24
|
-
|
|
24
|
+
func setRatio(bidPercentage: Double, askPercentage: Double) throws -> Void
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
public extension HybridPerpSideRatioSpec_protocol {
|
|
@@ -203,6 +203,17 @@ open class HybridPerpSideRatioSpec_cxx {
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
// Methods
|
|
206
|
+
@inline(__always)
|
|
207
|
+
public final func setRatio(bidPercentage: Double, askPercentage: Double) -> bridge.Result_void_ {
|
|
208
|
+
do {
|
|
209
|
+
try self.__implementation.setRatio(bidPercentage: bidPercentage, askPercentage: askPercentage)
|
|
210
|
+
return bridge.create_Result_void_()
|
|
211
|
+
} catch (let __error) {
|
|
212
|
+
let __exceptionPtr = __error.toCpp()
|
|
213
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
206
217
|
public final func getView() -> UnsafeMutableRawPointer {
|
|
207
218
|
return Unmanaged.passRetained(__implementation.view).toOpaque()
|
|
208
219
|
}
|
|
@@ -44,8 +44,14 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
44
44
|
prototype.registerHybridSetter("sizeFontSize", &HybridPerpDepthBarsSpec::setSizeFontSize);
|
|
45
45
|
prototype.registerHybridGetter("textInset", &HybridPerpDepthBarsSpec::getTextInset);
|
|
46
46
|
prototype.registerHybridSetter("textInset", &HybridPerpDepthBarsSpec::setTextInset);
|
|
47
|
+
prototype.registerHybridGetter("placeholderText", &HybridPerpDepthBarsSpec::getPlaceholderText);
|
|
48
|
+
prototype.registerHybridSetter("placeholderText", &HybridPerpDepthBarsSpec::setPlaceholderText);
|
|
49
|
+
prototype.registerHybridGetter("placeholderRows", &HybridPerpDepthBarsSpec::getPlaceholderRows);
|
|
50
|
+
prototype.registerHybridSetter("placeholderRows", &HybridPerpDepthBarsSpec::setPlaceholderRows);
|
|
47
51
|
prototype.registerHybridGetter("onRowPress", &HybridPerpDepthBarsSpec::getOnRowPress);
|
|
48
52
|
prototype.registerHybridSetter("onRowPress", &HybridPerpDepthBarsSpec::setOnRowPress);
|
|
53
|
+
prototype.registerHybridMethod("setDepth", &HybridPerpDepthBarsSpec::setDepth);
|
|
54
|
+
prototype.registerHybridMethod("setText", &HybridPerpDepthBarsSpec::setText);
|
|
49
55
|
});
|
|
50
56
|
}
|
|
51
57
|
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
#include <string>
|
|
20
20
|
#include <functional>
|
|
21
21
|
#include <optional>
|
|
22
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
22
23
|
|
|
23
24
|
namespace margelo::nitro::perpdepthbar {
|
|
24
25
|
|
|
@@ -77,12 +78,17 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
77
78
|
virtual void setSizeFontSize(double sizeFontSize) = 0;
|
|
78
79
|
virtual double getTextInset() = 0;
|
|
79
80
|
virtual void setTextInset(double textInset) = 0;
|
|
81
|
+
virtual std::string getPlaceholderText() = 0;
|
|
82
|
+
virtual void setPlaceholderText(const std::string& placeholderText) = 0;
|
|
83
|
+
virtual double getPlaceholderRows() = 0;
|
|
84
|
+
virtual void setPlaceholderRows(double placeholderRows) = 0;
|
|
80
85
|
virtual std::optional<std::function<void(double /* rowIndex */)>> getOnRowPress() = 0;
|
|
81
86
|
virtual void setOnRowPress(const std::optional<std::function<void(double /* rowIndex */)>>& onRowPress) = 0;
|
|
82
87
|
|
|
83
88
|
public:
|
|
84
89
|
// Methods
|
|
85
|
-
|
|
90
|
+
virtual void setDepth(const std::shared_ptr<ArrayBuffer>& buffer) = 0;
|
|
91
|
+
virtual void setText(const std::vector<std::string>& prices, const std::vector<std::string>& sizes) = 0;
|
|
86
92
|
|
|
87
93
|
protected:
|
|
88
94
|
// Hybrid Setup
|
|
@@ -30,6 +30,7 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
30
30
|
prototype.registerHybridSetter("gap", &HybridPerpSideRatioSpec::setGap);
|
|
31
31
|
prototype.registerHybridGetter("reducedMotion", &HybridPerpSideRatioSpec::getReducedMotion);
|
|
32
32
|
prototype.registerHybridSetter("reducedMotion", &HybridPerpSideRatioSpec::setReducedMotion);
|
|
33
|
+
prototype.registerHybridMethod("setRatio", &HybridPerpSideRatioSpec::setRatio);
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -175,6 +175,26 @@ namespace margelo::nitro::perpdepthbar::views {
|
|
|
175
175
|
throw std::runtime_error(std::string("PerpDepthBars.textInset: ") + exc.what());
|
|
176
176
|
}
|
|
177
177
|
}()),
|
|
178
|
+
placeholderText([&]() -> CachedProp<std::string> {
|
|
179
|
+
try {
|
|
180
|
+
const react::RawValue* rawValue = rawProps.at("placeholderText", nullptr, nullptr);
|
|
181
|
+
if (rawValue == nullptr) return sourceProps.placeholderText;
|
|
182
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
183
|
+
return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.placeholderText);
|
|
184
|
+
} catch (const std::exception& exc) {
|
|
185
|
+
throw std::runtime_error(std::string("PerpDepthBars.placeholderText: ") + exc.what());
|
|
186
|
+
}
|
|
187
|
+
}()),
|
|
188
|
+
placeholderRows([&]() -> CachedProp<double> {
|
|
189
|
+
try {
|
|
190
|
+
const react::RawValue* rawValue = rawProps.at("placeholderRows", nullptr, nullptr);
|
|
191
|
+
if (rawValue == nullptr) return sourceProps.placeholderRows;
|
|
192
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
193
|
+
return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.placeholderRows);
|
|
194
|
+
} catch (const std::exception& exc) {
|
|
195
|
+
throw std::runtime_error(std::string("PerpDepthBars.placeholderRows: ") + exc.what());
|
|
196
|
+
}
|
|
197
|
+
}()),
|
|
178
198
|
onRowPress([&]() -> CachedProp<std::optional<std::function<void(double /* rowIndex */)>>> {
|
|
179
199
|
try {
|
|
180
200
|
const react::RawValue* rawValue = rawProps.at("onRowPress", nullptr, nullptr);
|
|
@@ -213,6 +233,8 @@ namespace margelo::nitro::perpdepthbar::views {
|
|
|
213
233
|
priceFontSize(other.priceFontSize),
|
|
214
234
|
sizeFontSize(other.sizeFontSize),
|
|
215
235
|
textInset(other.textInset),
|
|
236
|
+
placeholderText(other.placeholderText),
|
|
237
|
+
placeholderRows(other.placeholderRows),
|
|
216
238
|
onRowPress(other.onRowPress),
|
|
217
239
|
hybridRef(other.hybridRef) { }
|
|
218
240
|
|
|
@@ -233,6 +255,8 @@ namespace margelo::nitro::perpdepthbar::views {
|
|
|
233
255
|
case hashString("priceFontSize"): return true;
|
|
234
256
|
case hashString("sizeFontSize"): return true;
|
|
235
257
|
case hashString("textInset"): return true;
|
|
258
|
+
case hashString("placeholderText"): return true;
|
|
259
|
+
case hashString("placeholderRows"): return true;
|
|
236
260
|
case hashString("onRowPress"): return true;
|
|
237
261
|
case hashString("hybridRef"): return true;
|
|
238
262
|
default: return false;
|
|
@@ -59,6 +59,8 @@ namespace margelo::nitro::perpdepthbar::views {
|
|
|
59
59
|
CachedProp<double> priceFontSize;
|
|
60
60
|
CachedProp<double> sizeFontSize;
|
|
61
61
|
CachedProp<double> textInset;
|
|
62
|
+
CachedProp<std::string> placeholderText;
|
|
63
|
+
CachedProp<double> placeholderRows;
|
|
62
64
|
CachedProp<std::optional<std::function<void(double /* rowIndex */)>>> onRowPress;
|
|
63
65
|
CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridPerpDepthBarsSpec>& /* ref */)>>> hybridRef;
|
|
64
66
|
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
#include <optional>
|
|
16
16
|
#include "JFunc_void_double.hpp"
|
|
17
17
|
#include <NitroModules/JNICallable.hpp>
|
|
18
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
19
|
+
#include <NitroModules/JArrayBuffer.hpp>
|
|
20
|
+
#include <NitroModules/JUnit.hpp>
|
|
18
21
|
|
|
19
22
|
namespace margelo::nitro::perpdepthbar {
|
|
20
23
|
|
|
@@ -226,6 +229,24 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
226
229
|
static const auto method = javaClassStatic()->getMethod<void(double /* textInset */)>("setTextInset");
|
|
227
230
|
method(_javaPart, textInset);
|
|
228
231
|
}
|
|
232
|
+
std::string JHybridPerpDepthBarsSpec::getPlaceholderText() {
|
|
233
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getPlaceholderText");
|
|
234
|
+
auto __result = method(_javaPart);
|
|
235
|
+
return __result->toStdString();
|
|
236
|
+
}
|
|
237
|
+
void JHybridPerpDepthBarsSpec::setPlaceholderText(const std::string& placeholderText) {
|
|
238
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* placeholderText */)>("setPlaceholderText");
|
|
239
|
+
method(_javaPart, jni::make_jstring(placeholderText));
|
|
240
|
+
}
|
|
241
|
+
double JHybridPerpDepthBarsSpec::getPlaceholderRows() {
|
|
242
|
+
static const auto method = javaClassStatic()->getMethod<double()>("getPlaceholderRows");
|
|
243
|
+
auto __result = method(_javaPart);
|
|
244
|
+
return __result;
|
|
245
|
+
}
|
|
246
|
+
void JHybridPerpDepthBarsSpec::setPlaceholderRows(double placeholderRows) {
|
|
247
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* placeholderRows */)>("setPlaceholderRows");
|
|
248
|
+
method(_javaPart, placeholderRows);
|
|
249
|
+
}
|
|
229
250
|
std::optional<std::function<void(double /* rowIndex */)>> JHybridPerpDepthBarsSpec::getOnRowPress() {
|
|
230
251
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_double::javaobject>()>("getOnRowPress_cxx");
|
|
231
252
|
auto __result = method(_javaPart);
|
|
@@ -245,6 +266,31 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
245
266
|
}
|
|
246
267
|
|
|
247
268
|
// Methods
|
|
248
|
-
|
|
269
|
+
void JHybridPerpDepthBarsSpec::setDepth(const std::shared_ptr<ArrayBuffer>& buffer) {
|
|
270
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JArrayBuffer::javaobject> /* buffer */)>("setDepth");
|
|
271
|
+
method(_javaPart, JArrayBuffer::wrap(buffer));
|
|
272
|
+
}
|
|
273
|
+
void JHybridPerpDepthBarsSpec::setText(const std::vector<std::string>& prices, const std::vector<std::string>& sizes) {
|
|
274
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<jni::JString>> /* prices */, jni::alias_ref<jni::JArrayClass<jni::JString>> /* sizes */)>("setText");
|
|
275
|
+
method(_javaPart, [&]() {
|
|
276
|
+
size_t __size = prices.size();
|
|
277
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
|
|
278
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
279
|
+
const auto& __element = prices[__i];
|
|
280
|
+
auto __elementJni = jni::make_jstring(__element);
|
|
281
|
+
__array->setElement(__i, *__elementJni);
|
|
282
|
+
}
|
|
283
|
+
return __array;
|
|
284
|
+
}(), [&]() {
|
|
285
|
+
size_t __size = sizes.size();
|
|
286
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
|
|
287
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
288
|
+
const auto& __element = sizes[__i];
|
|
289
|
+
auto __elementJni = jni::make_jstring(__element);
|
|
290
|
+
__array->setElement(__i, *__elementJni);
|
|
291
|
+
}
|
|
292
|
+
return __array;
|
|
293
|
+
}());
|
|
294
|
+
}
|
|
249
295
|
|
|
250
296
|
} // namespace margelo::nitro::perpdepthbar
|
|
@@ -80,12 +80,17 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
80
80
|
void setSizeFontSize(double sizeFontSize) override;
|
|
81
81
|
double getTextInset() override;
|
|
82
82
|
void setTextInset(double textInset) override;
|
|
83
|
+
std::string getPlaceholderText() override;
|
|
84
|
+
void setPlaceholderText(const std::string& placeholderText) override;
|
|
85
|
+
double getPlaceholderRows() override;
|
|
86
|
+
void setPlaceholderRows(double placeholderRows) override;
|
|
83
87
|
std::optional<std::function<void(double /* rowIndex */)>> getOnRowPress() override;
|
|
84
88
|
void setOnRowPress(const std::optional<std::function<void(double /* rowIndex */)>>& onRowPress) override;
|
|
85
89
|
|
|
86
90
|
public:
|
|
87
91
|
// Methods
|
|
88
|
-
|
|
92
|
+
void setDepth(const std::shared_ptr<ArrayBuffer>& buffer) override;
|
|
93
|
+
void setText(const std::vector<std::string>& prices, const std::vector<std::string>& sizes) override;
|
|
89
94
|
|
|
90
95
|
private:
|
|
91
96
|
friend HybridBase;
|
|
@@ -114,6 +114,9 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
// Methods
|
|
117
|
-
|
|
117
|
+
void JHybridPerpSideRatioSpec::setRatio(double bidPercentage, double askPercentage) {
|
|
118
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* bidPercentage */, double /* askPercentage */)>("setRatio");
|
|
119
|
+
method(_javaPart, bidPercentage, askPercentage);
|
|
120
|
+
}
|
|
118
121
|
|
|
119
122
|
} // namespace margelo::nitro::perpdepthbar
|
package/lib/nitrogen/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp
CHANGED
|
@@ -96,6 +96,14 @@ void JHybridPerpDepthBarsStateUpdater::updateViewProps(jni::alias_ref<jni::JClas
|
|
|
96
96
|
view->setTextInset(props.textInset.value);
|
|
97
97
|
// TODO: Set isDirty = false
|
|
98
98
|
}
|
|
99
|
+
if (props.placeholderText.isDirty) {
|
|
100
|
+
view->setPlaceholderText(props.placeholderText.value);
|
|
101
|
+
// TODO: Set isDirty = false
|
|
102
|
+
}
|
|
103
|
+
if (props.placeholderRows.isDirty) {
|
|
104
|
+
view->setPlaceholderRows(props.placeholderRows.value);
|
|
105
|
+
// TODO: Set isDirty = false
|
|
106
|
+
}
|
|
99
107
|
if (props.onRowPress.isDirty) {
|
|
100
108
|
view->setOnRowPress(props.onRowPress.value);
|
|
101
109
|
// TODO: Set isDirty = false
|
|
@@ -10,6 +10,7 @@ package com.margelo.nitro.perpdepthbar
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.ArrayBuffer
|
|
13
14
|
import com.margelo.nitro.views.HybridView
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -132,6 +133,18 @@ abstract class HybridPerpDepthBarsSpec: HybridView() {
|
|
|
132
133
|
@set:Keep
|
|
133
134
|
abstract var textInset: Double
|
|
134
135
|
|
|
136
|
+
@get:DoNotStrip
|
|
137
|
+
@get:Keep
|
|
138
|
+
@set:DoNotStrip
|
|
139
|
+
@set:Keep
|
|
140
|
+
abstract var placeholderText: String
|
|
141
|
+
|
|
142
|
+
@get:DoNotStrip
|
|
143
|
+
@get:Keep
|
|
144
|
+
@set:DoNotStrip
|
|
145
|
+
@set:Keep
|
|
146
|
+
abstract var placeholderRows: Double
|
|
147
|
+
|
|
135
148
|
abstract var onRowPress: ((rowIndex: Double) -> Unit)?
|
|
136
149
|
|
|
137
150
|
private var onRowPress_cxx: Func_void_double?
|
|
@@ -147,7 +160,13 @@ abstract class HybridPerpDepthBarsSpec: HybridView() {
|
|
|
147
160
|
}
|
|
148
161
|
|
|
149
162
|
// Methods
|
|
163
|
+
@DoNotStrip
|
|
164
|
+
@Keep
|
|
165
|
+
abstract fun setDepth(buffer: ArrayBuffer): Unit
|
|
150
166
|
|
|
167
|
+
@DoNotStrip
|
|
168
|
+
@Keep
|
|
169
|
+
abstract fun setText(prices: Array<String>, sizes: Array<String>): Unit
|
|
151
170
|
|
|
152
171
|
private external fun initHybrid(): HybridData
|
|
153
172
|
|
|
@@ -91,7 +91,9 @@ abstract class HybridPerpSideRatioSpec: HybridView() {
|
|
|
91
91
|
abstract var reducedMotion: Boolean
|
|
92
92
|
|
|
93
93
|
// Methods
|
|
94
|
-
|
|
94
|
+
@DoNotStrip
|
|
95
|
+
@Keep
|
|
96
|
+
abstract fun setRatio(bidPercentage: Double, askPercentage: Double): Unit
|
|
95
97
|
|
|
96
98
|
private external fun initHybrid(): HybridData
|
|
97
99
|
|
|
@@ -22,6 +22,8 @@ namespace PerpDepthBar { class HybridPerpSideRatioSpec_cxx; }
|
|
|
22
22
|
// Include C++ defined types
|
|
23
23
|
#include "HybridPerpDepthBarsSpec.hpp"
|
|
24
24
|
#include "HybridPerpSideRatioSpec.hpp"
|
|
25
|
+
#include <NitroModules/Result.hpp>
|
|
26
|
+
#include <exception>
|
|
25
27
|
#include <functional>
|
|
26
28
|
#include <memory>
|
|
27
29
|
#include <optional>
|
|
@@ -105,6 +107,15 @@ namespace margelo::nitro::perpdepthbar::bridge::swift {
|
|
|
105
107
|
using std__weak_ptr_HybridPerpDepthBarsSpec_ = std::weak_ptr<HybridPerpDepthBarsSpec>;
|
|
106
108
|
inline std__weak_ptr_HybridPerpDepthBarsSpec_ weakify_std__shared_ptr_HybridPerpDepthBarsSpec_(const std::shared_ptr<HybridPerpDepthBarsSpec>& strong) noexcept { return strong; }
|
|
107
109
|
|
|
110
|
+
// pragma MARK: Result<void>
|
|
111
|
+
using Result_void_ = Result<void>;
|
|
112
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
113
|
+
return Result<void>::withValue();
|
|
114
|
+
}
|
|
115
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
116
|
+
return Result<void>::withError(error);
|
|
117
|
+
}
|
|
118
|
+
|
|
108
119
|
// pragma MARK: std::shared_ptr<HybridPerpSideRatioSpec>
|
|
109
120
|
/**
|
|
110
121
|
* Specialized version of `std::shared_ptr<HybridPerpSideRatioSpec>`.
|
|
@@ -16,6 +16,9 @@ namespace margelo::nitro::perpdepthbar { class HybridPerpSideRatioSpec; }
|
|
|
16
16
|
// Include C++ defined types
|
|
17
17
|
#include "HybridPerpDepthBarsSpec.hpp"
|
|
18
18
|
#include "HybridPerpSideRatioSpec.hpp"
|
|
19
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
20
|
+
#include <NitroModules/Result.hpp>
|
|
21
|
+
#include <exception>
|
|
19
22
|
#include <functional>
|
|
20
23
|
#include <memory>
|
|
21
24
|
#include <optional>
|
|
@@ -12,12 +12,15 @@
|
|
|
12
12
|
// Forward declaration of `HybridPerpDepthBarsSpec_cxx` to properly resolve imports.
|
|
13
13
|
namespace PerpDepthBar { class HybridPerpDepthBarsSpec_cxx; }
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// Forward declaration of `ArrayBufferHolder` to properly resolve imports.
|
|
16
|
+
namespace NitroModules { class ArrayBufferHolder; }
|
|
16
17
|
|
|
17
18
|
#include <vector>
|
|
18
19
|
#include <string>
|
|
19
20
|
#include <functional>
|
|
20
21
|
#include <optional>
|
|
22
|
+
#include <NitroModules/ArrayBuffer.hpp>
|
|
23
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
21
24
|
|
|
22
25
|
#include "PerpDepthBar-Swift-Cxx-Umbrella.hpp"
|
|
23
26
|
|
|
@@ -156,6 +159,19 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
156
159
|
inline void setTextInset(double textInset) noexcept override {
|
|
157
160
|
_swiftPart.setTextInset(std::forward<decltype(textInset)>(textInset));
|
|
158
161
|
}
|
|
162
|
+
inline std::string getPlaceholderText() noexcept override {
|
|
163
|
+
auto __result = _swiftPart.getPlaceholderText();
|
|
164
|
+
return __result;
|
|
165
|
+
}
|
|
166
|
+
inline void setPlaceholderText(const std::string& placeholderText) noexcept override {
|
|
167
|
+
_swiftPart.setPlaceholderText(placeholderText);
|
|
168
|
+
}
|
|
169
|
+
inline double getPlaceholderRows() noexcept override {
|
|
170
|
+
return _swiftPart.getPlaceholderRows();
|
|
171
|
+
}
|
|
172
|
+
inline void setPlaceholderRows(double placeholderRows) noexcept override {
|
|
173
|
+
_swiftPart.setPlaceholderRows(std::forward<decltype(placeholderRows)>(placeholderRows));
|
|
174
|
+
}
|
|
159
175
|
inline std::optional<std::function<void(double /* rowIndex */)>> getOnRowPress() noexcept override {
|
|
160
176
|
auto __result = _swiftPart.getOnRowPress();
|
|
161
177
|
return __result;
|
|
@@ -166,7 +182,18 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
166
182
|
|
|
167
183
|
public:
|
|
168
184
|
// Methods
|
|
169
|
-
|
|
185
|
+
inline void setDepth(const std::shared_ptr<ArrayBuffer>& buffer) override {
|
|
186
|
+
auto __result = _swiftPart.setDepth(ArrayBufferHolder(buffer));
|
|
187
|
+
if (__result.hasError()) [[unlikely]] {
|
|
188
|
+
std::rethrow_exception(__result.error());
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
inline void setText(const std::vector<std::string>& prices, const std::vector<std::string>& sizes) override {
|
|
192
|
+
auto __result = _swiftPart.setText(prices, sizes);
|
|
193
|
+
if (__result.hasError()) [[unlikely]] {
|
|
194
|
+
std::rethrow_exception(__result.error());
|
|
195
|
+
}
|
|
196
|
+
}
|
|
170
197
|
|
|
171
198
|
private:
|
|
172
199
|
PerpDepthBar::HybridPerpDepthBarsSpec_cxx _swiftPart;
|
|
@@ -109,7 +109,12 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
109
109
|
|
|
110
110
|
public:
|
|
111
111
|
// Methods
|
|
112
|
-
|
|
112
|
+
inline void setRatio(double bidPercentage, double askPercentage) override {
|
|
113
|
+
auto __result = _swiftPart.setRatio(std::forward<decltype(bidPercentage)>(bidPercentage), std::forward<decltype(askPercentage)>(askPercentage));
|
|
114
|
+
if (__result.hasError()) [[unlikely]] {
|
|
115
|
+
std::rethrow_exception(__result.error());
|
|
116
|
+
}
|
|
117
|
+
}
|
|
113
118
|
|
|
114
119
|
private:
|
|
115
120
|
PerpDepthBar::HybridPerpSideRatioSpec_cxx _swiftPart;
|
|
@@ -146,6 +146,16 @@ using namespace margelo::nitro::perpdepthbar::views;
|
|
|
146
146
|
swiftPart.setTextInset(newViewProps.textInset.value);
|
|
147
147
|
newViewProps.textInset.isDirty = false;
|
|
148
148
|
}
|
|
149
|
+
// placeholderText: string
|
|
150
|
+
if (newViewProps.placeholderText.isDirty) {
|
|
151
|
+
swiftPart.setPlaceholderText(newViewProps.placeholderText.value);
|
|
152
|
+
newViewProps.placeholderText.isDirty = false;
|
|
153
|
+
}
|
|
154
|
+
// placeholderRows: number
|
|
155
|
+
if (newViewProps.placeholderRows.isDirty) {
|
|
156
|
+
swiftPart.setPlaceholderRows(newViewProps.placeholderRows.value);
|
|
157
|
+
newViewProps.placeholderRows.isDirty = false;
|
|
158
|
+
}
|
|
149
159
|
// onRowPress: optional
|
|
150
160
|
if (newViewProps.onRowPress.isDirty) {
|
|
151
161
|
swiftPart.setOnRowPress(newViewProps.onRowPress.value);
|
|
@@ -26,10 +26,13 @@ public protocol HybridPerpDepthBarsSpec_protocol: HybridObject, HybridView {
|
|
|
26
26
|
var priceFontSize: Double { get set }
|
|
27
27
|
var sizeFontSize: Double { get set }
|
|
28
28
|
var textInset: Double { get set }
|
|
29
|
+
var placeholderText: String { get set }
|
|
30
|
+
var placeholderRows: Double { get set }
|
|
29
31
|
var onRowPress: ((_ rowIndex: Double) -> Void)? { get set }
|
|
30
32
|
|
|
31
33
|
// Methods
|
|
32
|
-
|
|
34
|
+
func setDepth(buffer: ArrayBuffer) throws -> Void
|
|
35
|
+
func setText(prices: [String], sizes: [String]) throws -> Void
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
public extension HybridPerpDepthBarsSpec_protocol {
|