@onekeyfe/react-native-perp-depth-bar 3.0.39 → 3.0.40
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 +100 -1
- package/ios/HybridPerpDepthBars.swift +97 -1
- package/ios/PerpColorParser.swift +8 -0
- package/lib/module/index.js +25 -2
- package/lib/module/index.js.map +1 -1
- package/lib/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
- package/lib/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +120 -0
- package/lib/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +16 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +32 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/Func_void_double.kt +80 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +56 -0
- package/lib/nitrogen/generated/android/perpdepthbarOnLoad.cpp +2 -0
- package/lib/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.cpp +8 -0
- package/lib/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.hpp +51 -0
- package/lib/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Umbrella.hpp +2 -0
- package/lib/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +55 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +40 -0
- package/lib/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
- package/lib/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +8 -0
- package/lib/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +121 -0
- package/lib/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +16 -0
- package/lib/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +18 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +96 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +10 -2
- package/lib/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +8 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +120 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +16 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +32 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/Func_void_double.kt +80 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +56 -0
- package/lib/nitrogen/nitrogen/generated/android/perpdepthbarOnLoad.cpp +2 -0
- package/lib/nitrogen/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.cpp +8 -0
- package/lib/nitrogen/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.hpp +51 -0
- package/lib/nitrogen/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Umbrella.hpp +2 -0
- package/lib/nitrogen/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +55 -0
- package/lib/nitrogen/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +40 -0
- package/lib/nitrogen/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
- package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +8 -0
- package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +121 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +16 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +18 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +96 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +10 -2
- package/lib/nitrogen/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +8 -0
- package/lib/typescript/src/PerpDepthBars.nitro.d.ts +20 -0
- package/lib/typescript/src/PerpDepthBars.nitro.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +7 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
- package/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +120 -0
- package/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +16 -0
- package/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/Func_void_double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +56 -0
- package/nitrogen/generated/android/perpdepthbarOnLoad.cpp +2 -0
- package/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Bridge.hpp +51 -0
- package/nitrogen/generated/ios/PerpDepthBar-Swift-Cxx-Umbrella.hpp +2 -0
- package/nitrogen/generated/ios/c++/HybridPerpDepthBarsSpecSwift.hpp +55 -0
- package/nitrogen/generated/ios/c++/views/HybridPerpDepthBarsComponent.mm +40 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +8 -0
- package/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +121 -0
- package/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.cpp +16 -0
- package/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +18 -0
- package/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.cpp +96 -0
- package/nitrogen/generated/shared/c++/views/HybridPerpDepthBarsComponent.hpp +10 -2
- package/nitrogen/generated/shared/json/PerpDepthBarsConfig.json +8 -0
- package/package.json +1 -1
- package/src/PerpDepthBars.nitro.ts +27 -0
- package/src/index.tsx +28 -2
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
"origin": true,
|
|
13
13
|
"reducedMotion": true,
|
|
14
14
|
"epoch": true,
|
|
15
|
+
"prices": true,
|
|
16
|
+
"sizes": true,
|
|
17
|
+
"priceColor": true,
|
|
18
|
+
"sizeColor": true,
|
|
19
|
+
"priceFontSize": true,
|
|
20
|
+
"sizeFontSize": true,
|
|
21
|
+
"textInset": true,
|
|
22
|
+
"onRowPress": true,
|
|
15
23
|
"hybridRef": true
|
|
16
24
|
}
|
|
17
25
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_double.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <functional>
|
|
14
|
+
#include <NitroModules/JNICallable.hpp>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::perpdepthbar {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Represents the Java/Kotlin callback `(rowIndex: Double) -> Unit`.
|
|
22
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
23
|
+
*/
|
|
24
|
+
struct JFunc_void_double: public jni::JavaClass<JFunc_void_double> {
|
|
25
|
+
public:
|
|
26
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/perpdepthbar/Func_void_double;";
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
/**
|
|
30
|
+
* Invokes the function this `JFunc_void_double` instance holds through JNI.
|
|
31
|
+
*/
|
|
32
|
+
void invoke(double rowIndex) const {
|
|
33
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* rowIndex */)>("invoke");
|
|
34
|
+
method(self(), rowIndex);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* An implementation of Func_void_double that is backed by a C++ implementation (using `std::function<...>`)
|
|
40
|
+
*/
|
|
41
|
+
class JFunc_void_double_cxx final: public jni::HybridClass<JFunc_void_double_cxx, JFunc_void_double> {
|
|
42
|
+
public:
|
|
43
|
+
static jni::local_ref<JFunc_void_double::javaobject> fromCpp(const std::function<void(double /* rowIndex */)>& func) {
|
|
44
|
+
return JFunc_void_double_cxx::newObjectCxxArgs(func);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
/**
|
|
49
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_double_cxx` instance holds.
|
|
50
|
+
*/
|
|
51
|
+
void invoke_cxx(double rowIndex) {
|
|
52
|
+
_func(rowIndex);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
[[nodiscard]]
|
|
57
|
+
inline const std::function<void(double /* rowIndex */)>& getFunction() const {
|
|
58
|
+
return _func;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/perpdepthbar/Func_void_double_cxx;";
|
|
63
|
+
static void registerNatives() {
|
|
64
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_double_cxx::invoke_cxx)});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private:
|
|
68
|
+
explicit JFunc_void_double_cxx(const std::function<void(double /* rowIndex */)>& func): _func(func) { }
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
friend HybridBase;
|
|
72
|
+
std::function<void(double /* rowIndex */)> _func;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::perpdepthbar
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
|
|
12
12
|
#include <vector>
|
|
13
13
|
#include <string>
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <optional>
|
|
16
|
+
#include "JFunc_void_double.hpp"
|
|
17
|
+
#include <NitroModules/JNICallable.hpp>
|
|
14
18
|
|
|
15
19
|
namespace margelo::nitro::perpdepthbar {
|
|
16
20
|
|
|
@@ -123,6 +127,122 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
123
127
|
static const auto method = javaClassStatic()->getMethod<void(double /* epoch */)>("setEpoch");
|
|
124
128
|
method(_javaPart, epoch);
|
|
125
129
|
}
|
|
130
|
+
std::vector<std::string> JHybridPerpDepthBarsSpec::getPrices() {
|
|
131
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<jni::JString>>()>("getPrices");
|
|
132
|
+
auto __result = method(_javaPart);
|
|
133
|
+
return [&]() {
|
|
134
|
+
size_t __size = __result->size();
|
|
135
|
+
std::vector<std::string> __vector;
|
|
136
|
+
__vector.reserve(__size);
|
|
137
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
138
|
+
auto __element = __result->getElement(__i);
|
|
139
|
+
__vector.push_back(__element->toStdString());
|
|
140
|
+
}
|
|
141
|
+
return __vector;
|
|
142
|
+
}();
|
|
143
|
+
}
|
|
144
|
+
void JHybridPerpDepthBarsSpec::setPrices(const std::vector<std::string>& prices) {
|
|
145
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<jni::JString>> /* prices */)>("setPrices");
|
|
146
|
+
method(_javaPart, [&]() {
|
|
147
|
+
size_t __size = prices.size();
|
|
148
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
|
|
149
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
150
|
+
const auto& __element = prices[__i];
|
|
151
|
+
auto __elementJni = jni::make_jstring(__element);
|
|
152
|
+
__array->setElement(__i, *__elementJni);
|
|
153
|
+
}
|
|
154
|
+
return __array;
|
|
155
|
+
}());
|
|
156
|
+
}
|
|
157
|
+
std::vector<std::string> JHybridPerpDepthBarsSpec::getSizes() {
|
|
158
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<jni::JString>>()>("getSizes");
|
|
159
|
+
auto __result = method(_javaPart);
|
|
160
|
+
return [&]() {
|
|
161
|
+
size_t __size = __result->size();
|
|
162
|
+
std::vector<std::string> __vector;
|
|
163
|
+
__vector.reserve(__size);
|
|
164
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
165
|
+
auto __element = __result->getElement(__i);
|
|
166
|
+
__vector.push_back(__element->toStdString());
|
|
167
|
+
}
|
|
168
|
+
return __vector;
|
|
169
|
+
}();
|
|
170
|
+
}
|
|
171
|
+
void JHybridPerpDepthBarsSpec::setSizes(const std::vector<std::string>& sizes) {
|
|
172
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JArrayClass<jni::JString>> /* sizes */)>("setSizes");
|
|
173
|
+
method(_javaPart, [&]() {
|
|
174
|
+
size_t __size = sizes.size();
|
|
175
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
|
|
176
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
177
|
+
const auto& __element = sizes[__i];
|
|
178
|
+
auto __elementJni = jni::make_jstring(__element);
|
|
179
|
+
__array->setElement(__i, *__elementJni);
|
|
180
|
+
}
|
|
181
|
+
return __array;
|
|
182
|
+
}());
|
|
183
|
+
}
|
|
184
|
+
std::string JHybridPerpDepthBarsSpec::getPriceColor() {
|
|
185
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getPriceColor");
|
|
186
|
+
auto __result = method(_javaPart);
|
|
187
|
+
return __result->toStdString();
|
|
188
|
+
}
|
|
189
|
+
void JHybridPerpDepthBarsSpec::setPriceColor(const std::string& priceColor) {
|
|
190
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* priceColor */)>("setPriceColor");
|
|
191
|
+
method(_javaPart, jni::make_jstring(priceColor));
|
|
192
|
+
}
|
|
193
|
+
std::string JHybridPerpDepthBarsSpec::getSizeColor() {
|
|
194
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getSizeColor");
|
|
195
|
+
auto __result = method(_javaPart);
|
|
196
|
+
return __result->toStdString();
|
|
197
|
+
}
|
|
198
|
+
void JHybridPerpDepthBarsSpec::setSizeColor(const std::string& sizeColor) {
|
|
199
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* sizeColor */)>("setSizeColor");
|
|
200
|
+
method(_javaPart, jni::make_jstring(sizeColor));
|
|
201
|
+
}
|
|
202
|
+
double JHybridPerpDepthBarsSpec::getPriceFontSize() {
|
|
203
|
+
static const auto method = javaClassStatic()->getMethod<double()>("getPriceFontSize");
|
|
204
|
+
auto __result = method(_javaPart);
|
|
205
|
+
return __result;
|
|
206
|
+
}
|
|
207
|
+
void JHybridPerpDepthBarsSpec::setPriceFontSize(double priceFontSize) {
|
|
208
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* priceFontSize */)>("setPriceFontSize");
|
|
209
|
+
method(_javaPart, priceFontSize);
|
|
210
|
+
}
|
|
211
|
+
double JHybridPerpDepthBarsSpec::getSizeFontSize() {
|
|
212
|
+
static const auto method = javaClassStatic()->getMethod<double()>("getSizeFontSize");
|
|
213
|
+
auto __result = method(_javaPart);
|
|
214
|
+
return __result;
|
|
215
|
+
}
|
|
216
|
+
void JHybridPerpDepthBarsSpec::setSizeFontSize(double sizeFontSize) {
|
|
217
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* sizeFontSize */)>("setSizeFontSize");
|
|
218
|
+
method(_javaPart, sizeFontSize);
|
|
219
|
+
}
|
|
220
|
+
double JHybridPerpDepthBarsSpec::getTextInset() {
|
|
221
|
+
static const auto method = javaClassStatic()->getMethod<double()>("getTextInset");
|
|
222
|
+
auto __result = method(_javaPart);
|
|
223
|
+
return __result;
|
|
224
|
+
}
|
|
225
|
+
void JHybridPerpDepthBarsSpec::setTextInset(double textInset) {
|
|
226
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* textInset */)>("setTextInset");
|
|
227
|
+
method(_javaPart, textInset);
|
|
228
|
+
}
|
|
229
|
+
std::optional<std::function<void(double /* rowIndex */)>> JHybridPerpDepthBarsSpec::getOnRowPress() {
|
|
230
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JFunc_void_double::javaobject>()>("getOnRowPress_cxx");
|
|
231
|
+
auto __result = method(_javaPart);
|
|
232
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(double /* rowIndex */)> {
|
|
233
|
+
if (__result->isInstanceOf(JFunc_void_double_cxx::javaClassStatic())) [[likely]] {
|
|
234
|
+
auto downcast = jni::static_ref_cast<JFunc_void_double_cxx::javaobject>(__result);
|
|
235
|
+
return downcast->cthis()->getFunction();
|
|
236
|
+
} else {
|
|
237
|
+
auto __resultRef = jni::make_global(__result);
|
|
238
|
+
return JNICallable<JFunc_void_double, void(double)>(std::move(__resultRef));
|
|
239
|
+
}
|
|
240
|
+
}()) : std::nullopt;
|
|
241
|
+
}
|
|
242
|
+
void JHybridPerpDepthBarsSpec::setOnRowPress(const std::optional<std::function<void(double /* rowIndex */)>>& onRowPress) {
|
|
243
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_double::javaobject> /* onRowPress */)>("setOnRowPress_cxx");
|
|
244
|
+
method(_javaPart, onRowPress.has_value() ? JFunc_void_double_cxx::fromCpp(onRowPress.value()) : nullptr);
|
|
245
|
+
}
|
|
126
246
|
|
|
127
247
|
// Methods
|
|
128
248
|
|
|
@@ -66,6 +66,22 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
66
66
|
void setReducedMotion(bool reducedMotion) override;
|
|
67
67
|
double getEpoch() override;
|
|
68
68
|
void setEpoch(double epoch) override;
|
|
69
|
+
std::vector<std::string> getPrices() override;
|
|
70
|
+
void setPrices(const std::vector<std::string>& prices) override;
|
|
71
|
+
std::vector<std::string> getSizes() override;
|
|
72
|
+
void setSizes(const std::vector<std::string>& sizes) override;
|
|
73
|
+
std::string getPriceColor() override;
|
|
74
|
+
void setPriceColor(const std::string& priceColor) override;
|
|
75
|
+
std::string getSizeColor() override;
|
|
76
|
+
void setSizeColor(const std::string& sizeColor) override;
|
|
77
|
+
double getPriceFontSize() override;
|
|
78
|
+
void setPriceFontSize(double priceFontSize) override;
|
|
79
|
+
double getSizeFontSize() override;
|
|
80
|
+
void setSizeFontSize(double sizeFontSize) override;
|
|
81
|
+
double getTextInset() override;
|
|
82
|
+
void setTextInset(double textInset) override;
|
|
83
|
+
std::optional<std::function<void(double /* rowIndex */)>> getOnRowPress() override;
|
|
84
|
+
void setOnRowPress(const std::optional<std::function<void(double /* rowIndex */)>>& onRowPress) override;
|
|
69
85
|
|
|
70
86
|
public:
|
|
71
87
|
// Methods
|
package/lib/nitrogen/nitrogen/generated/android/c++/views/JHybridPerpDepthBarsStateUpdater.cpp
CHANGED
|
@@ -68,6 +68,38 @@ void JHybridPerpDepthBarsStateUpdater::updateViewProps(jni::alias_ref<jni::JClas
|
|
|
68
68
|
view->setEpoch(props.epoch.value);
|
|
69
69
|
// TODO: Set isDirty = false
|
|
70
70
|
}
|
|
71
|
+
if (props.prices.isDirty) {
|
|
72
|
+
view->setPrices(props.prices.value);
|
|
73
|
+
// TODO: Set isDirty = false
|
|
74
|
+
}
|
|
75
|
+
if (props.sizes.isDirty) {
|
|
76
|
+
view->setSizes(props.sizes.value);
|
|
77
|
+
// TODO: Set isDirty = false
|
|
78
|
+
}
|
|
79
|
+
if (props.priceColor.isDirty) {
|
|
80
|
+
view->setPriceColor(props.priceColor.value);
|
|
81
|
+
// TODO: Set isDirty = false
|
|
82
|
+
}
|
|
83
|
+
if (props.sizeColor.isDirty) {
|
|
84
|
+
view->setSizeColor(props.sizeColor.value);
|
|
85
|
+
// TODO: Set isDirty = false
|
|
86
|
+
}
|
|
87
|
+
if (props.priceFontSize.isDirty) {
|
|
88
|
+
view->setPriceFontSize(props.priceFontSize.value);
|
|
89
|
+
// TODO: Set isDirty = false
|
|
90
|
+
}
|
|
91
|
+
if (props.sizeFontSize.isDirty) {
|
|
92
|
+
view->setSizeFontSize(props.sizeFontSize.value);
|
|
93
|
+
// TODO: Set isDirty = false
|
|
94
|
+
}
|
|
95
|
+
if (props.textInset.isDirty) {
|
|
96
|
+
view->setTextInset(props.textInset.value);
|
|
97
|
+
// TODO: Set isDirty = false
|
|
98
|
+
}
|
|
99
|
+
if (props.onRowPress.isDirty) {
|
|
100
|
+
view->setOnRowPress(props.onRowPress.value);
|
|
101
|
+
// TODO: Set isDirty = false
|
|
102
|
+
}
|
|
71
103
|
|
|
72
104
|
// Update hybridRef if it changed
|
|
73
105
|
if (props.hybridRef.isDirty) {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_double.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.perpdepthbar
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents the JavaScript callback `(rowIndex: number) => void`.
|
|
18
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
19
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
24
|
+
fun interface Func_void_double: (Double) -> Unit {
|
|
25
|
+
/**
|
|
26
|
+
* Call the given JS callback.
|
|
27
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
28
|
+
*/
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
override fun invoke(rowIndex: Double): Unit
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `(rowIndex: number) => void`.
|
|
36
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
37
|
+
* The callback might be coming from JS.
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress(
|
|
42
|
+
"KotlinJniMissingFunction", "unused",
|
|
43
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
44
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
45
|
+
)
|
|
46
|
+
class Func_void_double_cxx: Func_void_double {
|
|
47
|
+
@DoNotStrip
|
|
48
|
+
@Keep
|
|
49
|
+
private val mHybridData: HybridData
|
|
50
|
+
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
private constructor(hybridData: HybridData) {
|
|
54
|
+
mHybridData = hybridData
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
override fun invoke(rowIndex: Double): Unit
|
|
60
|
+
= invoke_cxx(rowIndex)
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(rowIndex: Double): Unit
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `(rowIndex: number) => void`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `(Double) -> Unit`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_void_double_java(private val function: (Double) -> Unit): Func_void_double {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(rowIndex: Double): Unit {
|
|
78
|
+
return this.function(rowIndex)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -89,6 +89,62 @@ abstract class HybridPerpDepthBarsSpec: HybridView() {
|
|
|
89
89
|
@set:DoNotStrip
|
|
90
90
|
@set:Keep
|
|
91
91
|
abstract var epoch: Double
|
|
92
|
+
|
|
93
|
+
@get:DoNotStrip
|
|
94
|
+
@get:Keep
|
|
95
|
+
@set:DoNotStrip
|
|
96
|
+
@set:Keep
|
|
97
|
+
abstract var prices: Array<String>
|
|
98
|
+
|
|
99
|
+
@get:DoNotStrip
|
|
100
|
+
@get:Keep
|
|
101
|
+
@set:DoNotStrip
|
|
102
|
+
@set:Keep
|
|
103
|
+
abstract var sizes: Array<String>
|
|
104
|
+
|
|
105
|
+
@get:DoNotStrip
|
|
106
|
+
@get:Keep
|
|
107
|
+
@set:DoNotStrip
|
|
108
|
+
@set:Keep
|
|
109
|
+
abstract var priceColor: String
|
|
110
|
+
|
|
111
|
+
@get:DoNotStrip
|
|
112
|
+
@get:Keep
|
|
113
|
+
@set:DoNotStrip
|
|
114
|
+
@set:Keep
|
|
115
|
+
abstract var sizeColor: String
|
|
116
|
+
|
|
117
|
+
@get:DoNotStrip
|
|
118
|
+
@get:Keep
|
|
119
|
+
@set:DoNotStrip
|
|
120
|
+
@set:Keep
|
|
121
|
+
abstract var priceFontSize: Double
|
|
122
|
+
|
|
123
|
+
@get:DoNotStrip
|
|
124
|
+
@get:Keep
|
|
125
|
+
@set:DoNotStrip
|
|
126
|
+
@set:Keep
|
|
127
|
+
abstract var sizeFontSize: Double
|
|
128
|
+
|
|
129
|
+
@get:DoNotStrip
|
|
130
|
+
@get:Keep
|
|
131
|
+
@set:DoNotStrip
|
|
132
|
+
@set:Keep
|
|
133
|
+
abstract var textInset: Double
|
|
134
|
+
|
|
135
|
+
abstract var onRowPress: ((rowIndex: Double) -> Unit)?
|
|
136
|
+
|
|
137
|
+
private var onRowPress_cxx: Func_void_double?
|
|
138
|
+
@Keep
|
|
139
|
+
@DoNotStrip
|
|
140
|
+
get() {
|
|
141
|
+
return onRowPress?.let { Func_void_double_java(it) }
|
|
142
|
+
}
|
|
143
|
+
@Keep
|
|
144
|
+
@DoNotStrip
|
|
145
|
+
set(value) {
|
|
146
|
+
onRowPress = value?.let { it }
|
|
147
|
+
}
|
|
92
148
|
|
|
93
149
|
// Methods
|
|
94
150
|
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
17
|
|
|
18
18
|
#include "JHybridPerpDepthBarsSpec.hpp"
|
|
19
|
+
#include "JFunc_void_double.hpp"
|
|
19
20
|
#include "views/JHybridPerpDepthBarsStateUpdater.hpp"
|
|
20
21
|
#include "JHybridPerpSideRatioSpec.hpp"
|
|
21
22
|
#include "views/JHybridPerpSideRatioStateUpdater.hpp"
|
|
@@ -31,6 +32,7 @@ int initialize(JavaVM* vm) {
|
|
|
31
32
|
return facebook::jni::initialize(vm, [] {
|
|
32
33
|
// Register native JNI methods
|
|
33
34
|
margelo::nitro::perpdepthbar::JHybridPerpDepthBarsSpec::registerNatives();
|
|
35
|
+
margelo::nitro::perpdepthbar::JFunc_void_double_cxx::registerNatives();
|
|
34
36
|
margelo::nitro::perpdepthbar::views::JHybridPerpDepthBarsStateUpdater::registerNatives();
|
|
35
37
|
margelo::nitro::perpdepthbar::JHybridPerpSideRatioSpec::registerNatives();
|
|
36
38
|
margelo::nitro::perpdepthbar::views::JHybridPerpSideRatioStateUpdater::registerNatives();
|
|
@@ -15,6 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
namespace margelo::nitro::perpdepthbar::bridge::swift {
|
|
17
17
|
|
|
18
|
+
// pragma MARK: std::function<void(double /* rowIndex */)>
|
|
19
|
+
Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
20
|
+
auto swiftClosure = PerpDepthBar::Func_void_double::fromUnsafe(swiftClosureWrapper);
|
|
21
|
+
return [swiftClosure = std::move(swiftClosure)](double rowIndex) mutable -> void {
|
|
22
|
+
swiftClosure.call(rowIndex);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
// pragma MARK: std::shared_ptr<HybridPerpDepthBarsSpec>
|
|
19
27
|
std::shared_ptr<HybridPerpDepthBarsSpec> create_std__shared_ptr_HybridPerpDepthBarsSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
20
28
|
PerpDepthBar::HybridPerpDepthBarsSpec_cxx swiftPart = PerpDepthBar::HybridPerpDepthBarsSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
@@ -22,7 +22,10 @@ namespace PerpDepthBar { class HybridPerpSideRatioSpec_cxx; }
|
|
|
22
22
|
// Include C++ defined types
|
|
23
23
|
#include "HybridPerpDepthBarsSpec.hpp"
|
|
24
24
|
#include "HybridPerpSideRatioSpec.hpp"
|
|
25
|
+
#include <functional>
|
|
25
26
|
#include <memory>
|
|
27
|
+
#include <optional>
|
|
28
|
+
#include <string>
|
|
26
29
|
#include <vector>
|
|
27
30
|
|
|
28
31
|
/**
|
|
@@ -42,6 +45,54 @@ namespace margelo::nitro::perpdepthbar::bridge::swift {
|
|
|
42
45
|
return vector;
|
|
43
46
|
}
|
|
44
47
|
|
|
48
|
+
// pragma MARK: std::vector<std::string>
|
|
49
|
+
/**
|
|
50
|
+
* Specialized version of `std::vector<std::string>`.
|
|
51
|
+
*/
|
|
52
|
+
using std__vector_std__string_ = std::vector<std::string>;
|
|
53
|
+
inline std::vector<std::string> create_std__vector_std__string_(size_t size) noexcept {
|
|
54
|
+
std::vector<std::string> vector;
|
|
55
|
+
vector.reserve(size);
|
|
56
|
+
return vector;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// pragma MARK: std::function<void(double /* rowIndex */)>
|
|
60
|
+
/**
|
|
61
|
+
* Specialized version of `std::function<void(double)>`.
|
|
62
|
+
*/
|
|
63
|
+
using Func_void_double = std::function<void(double /* rowIndex */)>;
|
|
64
|
+
/**
|
|
65
|
+
* Wrapper class for a `std::function<void(double / * rowIndex * /)>`, this can be used from Swift.
|
|
66
|
+
*/
|
|
67
|
+
class Func_void_double_Wrapper final {
|
|
68
|
+
public:
|
|
69
|
+
explicit Func_void_double_Wrapper(std::function<void(double /* rowIndex */)>&& func): _function(std::make_unique<std::function<void(double /* rowIndex */)>>(std::move(func))) {}
|
|
70
|
+
inline void call(double rowIndex) const noexcept {
|
|
71
|
+
_function->operator()(rowIndex);
|
|
72
|
+
}
|
|
73
|
+
private:
|
|
74
|
+
std::unique_ptr<std::function<void(double /* rowIndex */)>> _function;
|
|
75
|
+
} SWIFT_NONCOPYABLE;
|
|
76
|
+
Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
77
|
+
inline Func_void_double_Wrapper wrap_Func_void_double(Func_void_double value) noexcept {
|
|
78
|
+
return Func_void_double_Wrapper(std::move(value));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// pragma MARK: std::optional<std::function<void(double /* rowIndex */)>>
|
|
82
|
+
/**
|
|
83
|
+
* Specialized version of `std::optional<std::function<void(double / * rowIndex * /)>>`.
|
|
84
|
+
*/
|
|
85
|
+
using std__optional_std__function_void_double____rowIndex______ = std::optional<std::function<void(double /* rowIndex */)>>;
|
|
86
|
+
inline std::optional<std::function<void(double /* rowIndex */)>> create_std__optional_std__function_void_double____rowIndex______(const std::function<void(double /* rowIndex */)>& value) noexcept {
|
|
87
|
+
return std::optional<std::function<void(double /* rowIndex */)>>(value);
|
|
88
|
+
}
|
|
89
|
+
inline bool has_value_std__optional_std__function_void_double____rowIndex______(const std::optional<std::function<void(double /* rowIndex */)>>& optional) noexcept {
|
|
90
|
+
return optional.has_value();
|
|
91
|
+
}
|
|
92
|
+
inline std::function<void(double /* rowIndex */)> get_std__optional_std__function_void_double____rowIndex______(const std::optional<std::function<void(double /* rowIndex */)>>& optional) noexcept {
|
|
93
|
+
return *optional;
|
|
94
|
+
}
|
|
95
|
+
|
|
45
96
|
// pragma MARK: std::shared_ptr<HybridPerpDepthBarsSpec>
|
|
46
97
|
/**
|
|
47
98
|
* Specialized version of `std::shared_ptr<HybridPerpDepthBarsSpec>`.
|
|
@@ -16,7 +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 <functional>
|
|
19
20
|
#include <memory>
|
|
21
|
+
#include <optional>
|
|
20
22
|
#include <string>
|
|
21
23
|
#include <vector>
|
|
22
24
|
|
|
@@ -16,6 +16,8 @@ namespace PerpDepthBar { class HybridPerpDepthBarsSpec_cxx; }
|
|
|
16
16
|
|
|
17
17
|
#include <vector>
|
|
18
18
|
#include <string>
|
|
19
|
+
#include <functional>
|
|
20
|
+
#include <optional>
|
|
19
21
|
|
|
20
22
|
#include "PerpDepthBar-Swift-Cxx-Umbrella.hpp"
|
|
21
23
|
|
|
@@ -108,6 +110,59 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
108
110
|
inline void setEpoch(double epoch) noexcept override {
|
|
109
111
|
_swiftPart.setEpoch(std::forward<decltype(epoch)>(epoch));
|
|
110
112
|
}
|
|
113
|
+
inline std::vector<std::string> getPrices() noexcept override {
|
|
114
|
+
auto __result = _swiftPart.getPrices();
|
|
115
|
+
return __result;
|
|
116
|
+
}
|
|
117
|
+
inline void setPrices(const std::vector<std::string>& prices) noexcept override {
|
|
118
|
+
_swiftPart.setPrices(prices);
|
|
119
|
+
}
|
|
120
|
+
inline std::vector<std::string> getSizes() noexcept override {
|
|
121
|
+
auto __result = _swiftPart.getSizes();
|
|
122
|
+
return __result;
|
|
123
|
+
}
|
|
124
|
+
inline void setSizes(const std::vector<std::string>& sizes) noexcept override {
|
|
125
|
+
_swiftPart.setSizes(sizes);
|
|
126
|
+
}
|
|
127
|
+
inline std::string getPriceColor() noexcept override {
|
|
128
|
+
auto __result = _swiftPart.getPriceColor();
|
|
129
|
+
return __result;
|
|
130
|
+
}
|
|
131
|
+
inline void setPriceColor(const std::string& priceColor) noexcept override {
|
|
132
|
+
_swiftPart.setPriceColor(priceColor);
|
|
133
|
+
}
|
|
134
|
+
inline std::string getSizeColor() noexcept override {
|
|
135
|
+
auto __result = _swiftPart.getSizeColor();
|
|
136
|
+
return __result;
|
|
137
|
+
}
|
|
138
|
+
inline void setSizeColor(const std::string& sizeColor) noexcept override {
|
|
139
|
+
_swiftPart.setSizeColor(sizeColor);
|
|
140
|
+
}
|
|
141
|
+
inline double getPriceFontSize() noexcept override {
|
|
142
|
+
return _swiftPart.getPriceFontSize();
|
|
143
|
+
}
|
|
144
|
+
inline void setPriceFontSize(double priceFontSize) noexcept override {
|
|
145
|
+
_swiftPart.setPriceFontSize(std::forward<decltype(priceFontSize)>(priceFontSize));
|
|
146
|
+
}
|
|
147
|
+
inline double getSizeFontSize() noexcept override {
|
|
148
|
+
return _swiftPart.getSizeFontSize();
|
|
149
|
+
}
|
|
150
|
+
inline void setSizeFontSize(double sizeFontSize) noexcept override {
|
|
151
|
+
_swiftPart.setSizeFontSize(std::forward<decltype(sizeFontSize)>(sizeFontSize));
|
|
152
|
+
}
|
|
153
|
+
inline double getTextInset() noexcept override {
|
|
154
|
+
return _swiftPart.getTextInset();
|
|
155
|
+
}
|
|
156
|
+
inline void setTextInset(double textInset) noexcept override {
|
|
157
|
+
_swiftPart.setTextInset(std::forward<decltype(textInset)>(textInset));
|
|
158
|
+
}
|
|
159
|
+
inline std::optional<std::function<void(double /* rowIndex */)>> getOnRowPress() noexcept override {
|
|
160
|
+
auto __result = _swiftPart.getOnRowPress();
|
|
161
|
+
return __result;
|
|
162
|
+
}
|
|
163
|
+
inline void setOnRowPress(const std::optional<std::function<void(double /* rowIndex */)>>& onRowPress) noexcept override {
|
|
164
|
+
_swiftPart.setOnRowPress(onRowPress);
|
|
165
|
+
}
|
|
111
166
|
|
|
112
167
|
public:
|
|
113
168
|
// Methods
|
|
@@ -111,6 +111,46 @@ using namespace margelo::nitro::perpdepthbar::views;
|
|
|
111
111
|
swiftPart.setEpoch(newViewProps.epoch.value);
|
|
112
112
|
newViewProps.epoch.isDirty = false;
|
|
113
113
|
}
|
|
114
|
+
// prices: array
|
|
115
|
+
if (newViewProps.prices.isDirty) {
|
|
116
|
+
swiftPart.setPrices(newViewProps.prices.value);
|
|
117
|
+
newViewProps.prices.isDirty = false;
|
|
118
|
+
}
|
|
119
|
+
// sizes: array
|
|
120
|
+
if (newViewProps.sizes.isDirty) {
|
|
121
|
+
swiftPart.setSizes(newViewProps.sizes.value);
|
|
122
|
+
newViewProps.sizes.isDirty = false;
|
|
123
|
+
}
|
|
124
|
+
// priceColor: string
|
|
125
|
+
if (newViewProps.priceColor.isDirty) {
|
|
126
|
+
swiftPart.setPriceColor(newViewProps.priceColor.value);
|
|
127
|
+
newViewProps.priceColor.isDirty = false;
|
|
128
|
+
}
|
|
129
|
+
// sizeColor: string
|
|
130
|
+
if (newViewProps.sizeColor.isDirty) {
|
|
131
|
+
swiftPart.setSizeColor(newViewProps.sizeColor.value);
|
|
132
|
+
newViewProps.sizeColor.isDirty = false;
|
|
133
|
+
}
|
|
134
|
+
// priceFontSize: number
|
|
135
|
+
if (newViewProps.priceFontSize.isDirty) {
|
|
136
|
+
swiftPart.setPriceFontSize(newViewProps.priceFontSize.value);
|
|
137
|
+
newViewProps.priceFontSize.isDirty = false;
|
|
138
|
+
}
|
|
139
|
+
// sizeFontSize: number
|
|
140
|
+
if (newViewProps.sizeFontSize.isDirty) {
|
|
141
|
+
swiftPart.setSizeFontSize(newViewProps.sizeFontSize.value);
|
|
142
|
+
newViewProps.sizeFontSize.isDirty = false;
|
|
143
|
+
}
|
|
144
|
+
// textInset: number
|
|
145
|
+
if (newViewProps.textInset.isDirty) {
|
|
146
|
+
swiftPart.setTextInset(newViewProps.textInset.value);
|
|
147
|
+
newViewProps.textInset.isDirty = false;
|
|
148
|
+
}
|
|
149
|
+
// onRowPress: optional
|
|
150
|
+
if (newViewProps.onRowPress.isDirty) {
|
|
151
|
+
swiftPart.setOnRowPress(newViewProps.onRowPress.value);
|
|
152
|
+
newViewProps.onRowPress.isDirty = false;
|
|
153
|
+
}
|
|
114
154
|
|
|
115
155
|
swiftPart.afterUpdate();
|
|
116
156
|
|