@onekeyfe/react-native-perp-depth-bar 3.0.48 → 3.0.49
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 +23 -4
- package/android/src/main/java/com/margelo/nitro/perpdepthbar/HybridPerpSideRatio.kt +19 -0
- package/ios/HybridPerpDepthBars.swift +28 -0
- package/ios/HybridPerpSideRatio.swift +12 -0
- package/lib/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +7 -1
- package/lib/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +1 -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/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +4 -1
- 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 +10 -2
- package/lib/nitrogen/generated/ios/c++/HybridPerpSideRatioSpecSwift.hpp +6 -1
- package/lib/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +1 -1
- package/lib/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +11 -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 +1 -0
- package/lib/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +2 -1
- package/lib/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.cpp +1 -0
- package/lib/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.hpp +1 -1
- package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +7 -1
- package/lib/nitrogen/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +1 -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/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +4 -1
- 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 +10 -2
- package/lib/nitrogen/nitrogen/generated/ios/c++/HybridPerpSideRatioSpecSwift.hpp +6 -1
- package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +1 -1
- package/lib/nitrogen/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +11 -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 +1 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +2 -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/typescript/src/PerpDepthBars.nitro.d.ts +17 -0
- package/lib/typescript/src/PerpDepthBars.nitro.d.ts.map +1 -1
- package/lib/typescript/src/PerpSideRatio.nitro.d.ts +13 -0
- package/lib/typescript/src/PerpSideRatio.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.cpp +7 -1
- package/nitrogen/generated/android/c++/JHybridPerpDepthBarsSpec.hpp +1 -1
- package/nitrogen/generated/android/c++/JHybridPerpSideRatioSpec.cpp +4 -1
- package/nitrogen/generated/android/c++/JHybridPerpSideRatioSpec.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt +4 -1
- 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 +10 -2
- package/nitrogen/generated/ios/c++/HybridPerpSideRatioSpecSwift.hpp +6 -1
- package/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridPerpDepthBarsSpec_cxx.swift +11 -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 +1 -0
- package/nitrogen/generated/shared/c++/HybridPerpDepthBarsSpec.hpp +2 -1
- package/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridPerpSideRatioSpec.hpp +1 -1
- package/package.json +1 -1
- package/src/PerpDepthBars.nitro.ts +19 -1
- package/src/PerpSideRatio.nitro.ts +15 -1
|
@@ -7,6 +7,8 @@ import android.view.MotionEvent
|
|
|
7
7
|
import android.view.View
|
|
8
8
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
9
9
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
10
|
+
import com.margelo.nitro.core.ArrayBuffer
|
|
11
|
+
import java.nio.ByteOrder
|
|
10
12
|
import kotlin.math.abs
|
|
11
13
|
import kotlin.math.exp
|
|
12
14
|
|
|
@@ -168,14 +170,31 @@ class HybridPerpDepthBars(val context: ThemedReactContext) : HybridPerpDepthBars
|
|
|
168
170
|
override fun afterUpdate() {
|
|
169
171
|
super.afterUpdate()
|
|
170
172
|
if (isDisposed) return
|
|
171
|
-
syncTargets()
|
|
173
|
+
syncTargets(percents)
|
|
172
174
|
}
|
|
173
175
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
+
/**
|
|
177
|
+
* Imperative depth update — bypasses the high-frequency `percents` prop write
|
|
178
|
+
* path (props/JSICache lock contention, REACT-NATIVE-1JZ). `buffer` is a
|
|
179
|
+
* packed little-endian `Float32Array`: one float per row, each the row's depth
|
|
180
|
+
* percentage with the SAME 0..100 semantics as the `percents` prop. The parsed
|
|
181
|
+
* values flow through the identical [syncTargets] clamp/target/frame-loop logic
|
|
182
|
+
* the prop path uses — only the data source differs.
|
|
183
|
+
*/
|
|
184
|
+
override fun setDepth(buffer: ArrayBuffer) {
|
|
185
|
+
if (isDisposed) return
|
|
186
|
+
val byteBuffer = buffer.getBuffer(false)
|
|
187
|
+
val count = buffer.size / 4
|
|
188
|
+
val floats = byteBuffer.order(ByteOrder.LITTLE_ENDIAN).asFloatBuffer()
|
|
189
|
+
val depths = DoubleArray(count) { floats.get(it).toDouble() }
|
|
190
|
+
syncTargets(depths)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private fun syncTargets(depths: DoubleArray) {
|
|
194
|
+
val count = depths.size
|
|
176
195
|
val epochChanged = epoch != lastEpoch
|
|
177
196
|
val snap = !hasDrawn || reducedMotion || epochChanged
|
|
178
|
-
val newTarget = DoubleArray(count) { clampFrac(
|
|
197
|
+
val newTarget = DoubleArray(count) { clampFrac(depths[it]) }
|
|
179
198
|
|
|
180
199
|
if (snap) {
|
|
181
200
|
cancelFrameLoop()
|
|
@@ -87,6 +87,25 @@ class HybridPerpSideRatio(val context: ThemedReactContext) : HybridPerpSideRatio
|
|
|
87
87
|
view.invalidate()
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Imperative ratio update — bypasses the high-frequency
|
|
92
|
+
* `bidPercentage`/`askPercentage` prop write path (props/JSICache lock
|
|
93
|
+
* contention, REACT-NATIVE-1JZ). Companion to [HybridPerpDepthBars.setDepth].
|
|
94
|
+
* The two args carry the SAME 0..100 semantics as the props of the same name;
|
|
95
|
+
* we store them exactly like the prop setters and then route through the
|
|
96
|
+
* identical [afterUpdate] clamp/split/frame-loop logic the prop path uses —
|
|
97
|
+
* only the data source differs.
|
|
98
|
+
*/
|
|
99
|
+
override fun setRatio(bidPercentage: Double, askPercentage: Double) {
|
|
100
|
+
if (isDisposed) return
|
|
101
|
+
this.bidPercentage = bidPercentage
|
|
102
|
+
this.askPercentage = askPercentage
|
|
103
|
+
// Note: the prop path goes through the framework's beforeUpdate()/afterUpdate()
|
|
104
|
+
// pair; beforeUpdate() is an empty base-class hook, so calling afterUpdate()
|
|
105
|
+
// directly here is equivalent. If beforeUpdate() ever gains behavior, mirror it.
|
|
106
|
+
afterUpdate()
|
|
107
|
+
}
|
|
108
|
+
|
|
90
109
|
override fun afterUpdate() {
|
|
91
110
|
super.afterUpdate()
|
|
92
111
|
if (isDisposed) return
|
|
@@ -94,6 +94,34 @@ final class HybridPerpDepthBars: HybridPerpDepthBarsSpec {
|
|
|
94
94
|
stopDisplayLink()
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
// MARK: - Imperative depth update
|
|
98
|
+
/// Imperatively update the per-row depth percentages, bypassing the
|
|
99
|
+
/// high-frequency `percents` prop write path (props/JSICache lock contention,
|
|
100
|
+
/// REACT-NATIVE-1JZ). `buffer` is a packed little-endian `Float32Array`: one
|
|
101
|
+
/// float per row, each the row's depth percentage with the SAME 0..100
|
|
102
|
+
/// semantics as the `percents` prop. The parsed values are routed through the
|
|
103
|
+
/// exact same `performLayout` clamp (`clampScale`) / target / display-link
|
|
104
|
+
/// path the prop uses — only the data source differs.
|
|
105
|
+
func setDepth(buffer: ArrayBuffer) throws {
|
|
106
|
+
let count = buffer.size / 4
|
|
107
|
+
guard count > 0 else {
|
|
108
|
+
percents = []
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
// `buffer.data` is a `UInt8` pointer; reinterpret it as little-endian
|
|
112
|
+
// Float32. iOS (arm/x86) is little-endian and JS `Float32Array` is too, so
|
|
113
|
+
// an unaligned little-endian load matches the prop semantics exactly.
|
|
114
|
+
var depths = [Double](repeating: 0, count: count)
|
|
115
|
+
let raw = UnsafeRawPointer(buffer.data)
|
|
116
|
+
for i in 0..<count {
|
|
117
|
+
let bits = raw.loadUnaligned(fromByteOffset: i * 4, as: UInt32.self)
|
|
118
|
+
depths[i] = Double(Float(bitPattern: UInt32(littleEndian: bits)))
|
|
119
|
+
}
|
|
120
|
+
// Feed through the single source of truth so the clamp/target/easing logic
|
|
121
|
+
// is byte-for-byte identical to the `percents` prop path.
|
|
122
|
+
percents = depths
|
|
123
|
+
}
|
|
124
|
+
|
|
97
125
|
private func handleTap(atY y: CGFloat) {
|
|
98
126
|
let step = CGFloat(rowHeight + rowMarginTop)
|
|
99
127
|
guard step > 0 else { return }
|
|
@@ -58,6 +58,18 @@ final class HybridPerpSideRatio: HybridPerpSideRatioSpec {
|
|
|
58
58
|
stopDisplayLink()
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/// Imperative ratio update — bypasses the high-frequency
|
|
62
|
+
/// `bidPercentage`/`askPercentage` prop write path (props/JSICache lock
|
|
63
|
+
/// contention, REACT-NATIVE-1JZ). Companion to `HybridPerpDepthBars.setDepth`.
|
|
64
|
+
/// The two args carry the SAME 0..100 semantics as the props of the same
|
|
65
|
+
/// name; assigning them feeds through the identical `didSet` →
|
|
66
|
+
/// `scheduleLayout` → `performLayout` clamp/split/display-link path the prop
|
|
67
|
+
/// setters use — only the data source differs.
|
|
68
|
+
func setRatio(bidPercentage: Double, askPercentage: Double) throws {
|
|
69
|
+
self.bidPercentage = bidPercentage
|
|
70
|
+
self.askPercentage = askPercentage
|
|
71
|
+
}
|
|
72
|
+
|
|
61
73
|
private func scheduleLayout() {
|
|
62
74
|
view.setNeedsLayout()
|
|
63
75
|
}
|
|
@@ -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
|
|
|
@@ -245,6 +248,9 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
245
248
|
}
|
|
246
249
|
|
|
247
250
|
// Methods
|
|
248
|
-
|
|
251
|
+
void JHybridPerpDepthBarsSpec::setDepth(const std::shared_ptr<ArrayBuffer>& buffer) {
|
|
252
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JArrayBuffer::javaobject> /* buffer */)>("setDepth");
|
|
253
|
+
method(_javaPart, JArrayBuffer::wrap(buffer));
|
|
254
|
+
}
|
|
249
255
|
|
|
250
256
|
} // namespace margelo::nitro::perpdepthbar
|
|
@@ -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
|
|
@@ -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
|
/**
|
|
@@ -147,7 +148,9 @@ abstract class HybridPerpDepthBarsSpec: HybridView() {
|
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
// Methods
|
|
150
|
-
|
|
151
|
+
@DoNotStrip
|
|
152
|
+
@Keep
|
|
153
|
+
abstract fun setDepth(buffer: ArrayBuffer): Unit
|
|
151
154
|
|
|
152
155
|
private external fun initHybrid(): HybridData
|
|
153
156
|
|
|
@@ -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
|
|
|
@@ -166,7 +169,12 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
166
169
|
|
|
167
170
|
public:
|
|
168
171
|
// Methods
|
|
169
|
-
|
|
172
|
+
inline void setDepth(const std::shared_ptr<ArrayBuffer>& buffer) override {
|
|
173
|
+
auto __result = _swiftPart.setDepth(ArrayBufferHolder(buffer));
|
|
174
|
+
if (__result.hasError()) [[unlikely]] {
|
|
175
|
+
std::rethrow_exception(__result.error());
|
|
176
|
+
}
|
|
177
|
+
}
|
|
170
178
|
|
|
171
179
|
private:
|
|
172
180
|
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;
|
|
@@ -29,7 +29,7 @@ public protocol HybridPerpDepthBarsSpec_protocol: HybridObject, HybridView {
|
|
|
29
29
|
var onRowPress: ((_ rowIndex: Double) -> Void)? { get set }
|
|
30
30
|
|
|
31
31
|
// Methods
|
|
32
|
-
|
|
32
|
+
func setDepth(buffer: ArrayBuffer) throws -> Void
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
public extension HybridPerpDepthBarsSpec_protocol {
|
|
@@ -330,6 +330,17 @@ open class HybridPerpDepthBarsSpec_cxx {
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
// Methods
|
|
333
|
+
@inline(__always)
|
|
334
|
+
public final func setDepth(buffer: ArrayBuffer) -> bridge.Result_void_ {
|
|
335
|
+
do {
|
|
336
|
+
try self.__implementation.setDepth(buffer: buffer)
|
|
337
|
+
return bridge.create_Result_void_()
|
|
338
|
+
} catch (let __error) {
|
|
339
|
+
let __exceptionPtr = __error.toCpp()
|
|
340
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
333
344
|
public final func getView() -> UnsafeMutableRawPointer {
|
|
334
345
|
return Unmanaged.passRetained(__implementation.view).toOpaque()
|
|
335
346
|
}
|
|
@@ -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
|
}
|
|
@@ -46,6 +46,7 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
46
46
|
prototype.registerHybridSetter("textInset", &HybridPerpDepthBarsSpec::setTextInset);
|
|
47
47
|
prototype.registerHybridGetter("onRowPress", &HybridPerpDepthBarsSpec::getOnRowPress);
|
|
48
48
|
prototype.registerHybridSetter("onRowPress", &HybridPerpDepthBarsSpec::setOnRowPress);
|
|
49
|
+
prototype.registerHybridMethod("setDepth", &HybridPerpDepthBarsSpec::setDepth);
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -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
|
|
|
@@ -82,7 +83,7 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
82
83
|
|
|
83
84
|
public:
|
|
84
85
|
// Methods
|
|
85
|
-
|
|
86
|
+
virtual void setDepth(const std::shared_ptr<ArrayBuffer>& buffer) = 0;
|
|
86
87
|
|
|
87
88
|
protected:
|
|
88
89
|
// 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
|
|
|
@@ -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
|
|
|
@@ -245,6 +248,9 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
245
248
|
}
|
|
246
249
|
|
|
247
250
|
// Methods
|
|
248
|
-
|
|
251
|
+
void JHybridPerpDepthBarsSpec::setDepth(const std::shared_ptr<ArrayBuffer>& buffer) {
|
|
252
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JArrayBuffer::javaobject> /* buffer */)>("setDepth");
|
|
253
|
+
method(_javaPart, JArrayBuffer::wrap(buffer));
|
|
254
|
+
}
|
|
249
255
|
|
|
250
256
|
} // namespace margelo::nitro::perpdepthbar
|
|
@@ -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
|
|
@@ -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
|
/**
|
|
@@ -147,7 +148,9 @@ abstract class HybridPerpDepthBarsSpec: HybridView() {
|
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
// Methods
|
|
150
|
-
|
|
151
|
+
@DoNotStrip
|
|
152
|
+
@Keep
|
|
153
|
+
abstract fun setDepth(buffer: ArrayBuffer): Unit
|
|
151
154
|
|
|
152
155
|
private external fun initHybrid(): HybridData
|
|
153
156
|
|
|
@@ -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
|
|
|
@@ -166,7 +169,12 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
166
169
|
|
|
167
170
|
public:
|
|
168
171
|
// Methods
|
|
169
|
-
|
|
172
|
+
inline void setDepth(const std::shared_ptr<ArrayBuffer>& buffer) override {
|
|
173
|
+
auto __result = _swiftPart.setDepth(ArrayBufferHolder(buffer));
|
|
174
|
+
if (__result.hasError()) [[unlikely]] {
|
|
175
|
+
std::rethrow_exception(__result.error());
|
|
176
|
+
}
|
|
177
|
+
}
|
|
170
178
|
|
|
171
179
|
private:
|
|
172
180
|
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;
|
|
@@ -29,7 +29,7 @@ public protocol HybridPerpDepthBarsSpec_protocol: HybridObject, HybridView {
|
|
|
29
29
|
var onRowPress: ((_ rowIndex: Double) -> Void)? { get set }
|
|
30
30
|
|
|
31
31
|
// Methods
|
|
32
|
-
|
|
32
|
+
func setDepth(buffer: ArrayBuffer) throws -> Void
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
public extension HybridPerpDepthBarsSpec_protocol {
|
|
@@ -330,6 +330,17 @@ open class HybridPerpDepthBarsSpec_cxx {
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
// Methods
|
|
333
|
+
@inline(__always)
|
|
334
|
+
public final func setDepth(buffer: ArrayBuffer) -> bridge.Result_void_ {
|
|
335
|
+
do {
|
|
336
|
+
try self.__implementation.setDepth(buffer: buffer)
|
|
337
|
+
return bridge.create_Result_void_()
|
|
338
|
+
} catch (let __error) {
|
|
339
|
+
let __exceptionPtr = __error.toCpp()
|
|
340
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
333
344
|
public final func getView() -> UnsafeMutableRawPointer {
|
|
334
345
|
return Unmanaged.passRetained(__implementation.view).toOpaque()
|
|
335
346
|
}
|
|
@@ -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
|
}
|
|
@@ -46,6 +46,7 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
46
46
|
prototype.registerHybridSetter("textInset", &HybridPerpDepthBarsSpec::setTextInset);
|
|
47
47
|
prototype.registerHybridGetter("onRowPress", &HybridPerpDepthBarsSpec::getOnRowPress);
|
|
48
48
|
prototype.registerHybridSetter("onRowPress", &HybridPerpDepthBarsSpec::setOnRowPress);
|
|
49
|
+
prototype.registerHybridMethod("setDepth", &HybridPerpDepthBarsSpec::setDepth);
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -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
|
|
|
@@ -82,7 +83,7 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
82
83
|
|
|
83
84
|
public:
|
|
84
85
|
// Methods
|
|
85
|
-
|
|
86
|
+
virtual void setDepth(const std::shared_ptr<ArrayBuffer>& buffer) = 0;
|
|
86
87
|
|
|
87
88
|
protected:
|
|
88
89
|
// 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
|
|
|
@@ -52,6 +52,23 @@ export interface PerpDepthBarsProps extends HybridViewProps {
|
|
|
52
52
|
onRowPress?: (rowIndex: number) => void;
|
|
53
53
|
}
|
|
54
54
|
export interface PerpDepthBarsMethods extends HybridViewMethods {
|
|
55
|
+
/**
|
|
56
|
+
* Imperatively update the per-row depth percentages, bypassing the
|
|
57
|
+
* high-frequency `percents` prop write path (and its props/JSICache lock
|
|
58
|
+
* contention — REACT-NATIVE-1JZ).
|
|
59
|
+
*
|
|
60
|
+
* `buffer` is a packed `Float32Array` (little-endian): one float per row,
|
|
61
|
+
* each the row's depth percentage with the SAME semantics as the
|
|
62
|
+
* `percents: number[]` prop (0..100, clamped natively exactly like the prop
|
|
63
|
+
* setter). Row count == `buffer.byteLength / 4`. The native side rebuilds
|
|
64
|
+
* its animation targets from these values and reuses the identical
|
|
65
|
+
* clamp/target/frame-loop logic as the `percents` prop path — only the data
|
|
66
|
+
* source differs.
|
|
67
|
+
*
|
|
68
|
+
* The `percents` prop is retained for backward compatibility; callers may
|
|
69
|
+
* use either path.
|
|
70
|
+
*/
|
|
71
|
+
setDepth(buffer: ArrayBuffer): void;
|
|
55
72
|
}
|
|
56
73
|
export type PerpDepthBars = HybridView<PerpDepthBarsProps, PerpDepthBarsMethods>;
|
|
57
74
|
//# sourceMappingURL=PerpDepthBars.nitro.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PerpDepthBars.nitro.d.ts","sourceRoot":"","sources":["../../../src/PerpDepthBars.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,YAAY,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,aAAa,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAOd,sDAAsD;IACtD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,qDAAqD;IACrD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;
|
|
1
|
+
{"version":3,"file":"PerpDepthBars.nitro.d.ts","sourceRoot":"","sources":["../../../src/PerpDepthBars.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;GAUG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,YAAY,EAAE,MAAM,CAAC;IACrB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;IACd,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,aAAa,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAOd,sDAAsD;IACtD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,qDAAqD;IACrD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAElB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC"}
|
|
@@ -24,6 +24,19 @@ export interface PerpSideRatioProps extends HybridViewProps {
|
|
|
24
24
|
reducedMotion: boolean;
|
|
25
25
|
}
|
|
26
26
|
export interface PerpSideRatioMethods extends HybridViewMethods {
|
|
27
|
+
/**
|
|
28
|
+
* Imperatively update the bid/ask ratio, bypassing the high-frequency
|
|
29
|
+
* `bidPercentage`/`askPercentage` prop write path (and its props/JSICache
|
|
30
|
+
* lock contention — REACT-NATIVE-1JZ). Companion to `PerpDepthBars.setDepth`.
|
|
31
|
+
*
|
|
32
|
+
* `bidPercentage`/`askPercentage` carry the EXACT SAME semantics as the
|
|
33
|
+
* props of the same name (0..100 shares; the native side derives the split
|
|
34
|
+
* fraction identically). The native side routes these through the same
|
|
35
|
+
* clamp/target/animation path the prop setters use — only the data source
|
|
36
|
+
* differs. The `bidPercentage`/`askPercentage` props are retained for
|
|
37
|
+
* backward compatibility; callers may use either path.
|
|
38
|
+
*/
|
|
39
|
+
setRatio(bidPercentage: number, askPercentage: number): void;
|
|
27
40
|
}
|
|
28
41
|
export type PerpSideRatio = HybridView<PerpSideRatioProps, PerpSideRatioMethods>;
|
|
29
42
|
//# sourceMappingURL=PerpSideRatio.nitro.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PerpSideRatio.nitro.d.ts","sourceRoot":"","sources":["../../../src/PerpSideRatio.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,gCAAgC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;
|
|
1
|
+
{"version":3,"file":"PerpSideRatio.nitro.d.ts","sourceRoot":"","sources":["../../../src/PerpSideRatio.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,gCAAgC;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,qCAAqC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9D;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC"}
|
|
@@ -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
|
|
|
@@ -245,6 +248,9 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
245
248
|
}
|
|
246
249
|
|
|
247
250
|
// Methods
|
|
248
|
-
|
|
251
|
+
void JHybridPerpDepthBarsSpec::setDepth(const std::shared_ptr<ArrayBuffer>& buffer) {
|
|
252
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JArrayBuffer::javaobject> /* buffer */)>("setDepth");
|
|
253
|
+
method(_javaPart, JArrayBuffer::wrap(buffer));
|
|
254
|
+
}
|
|
249
255
|
|
|
250
256
|
} // namespace margelo::nitro::perpdepthbar
|
|
@@ -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/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpDepthBarsSpec.kt
CHANGED
|
@@ -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
|
/**
|
|
@@ -147,7 +148,9 @@ abstract class HybridPerpDepthBarsSpec: HybridView() {
|
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
// Methods
|
|
150
|
-
|
|
151
|
+
@DoNotStrip
|
|
152
|
+
@Keep
|
|
153
|
+
abstract fun setDepth(buffer: ArrayBuffer): Unit
|
|
151
154
|
|
|
152
155
|
private external fun initHybrid(): HybridData
|
|
153
156
|
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/perpdepthbar/HybridPerpSideRatioSpec.kt
CHANGED
|
@@ -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
|
|
|
@@ -166,7 +169,12 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
166
169
|
|
|
167
170
|
public:
|
|
168
171
|
// Methods
|
|
169
|
-
|
|
172
|
+
inline void setDepth(const std::shared_ptr<ArrayBuffer>& buffer) override {
|
|
173
|
+
auto __result = _swiftPart.setDepth(ArrayBufferHolder(buffer));
|
|
174
|
+
if (__result.hasError()) [[unlikely]] {
|
|
175
|
+
std::rethrow_exception(__result.error());
|
|
176
|
+
}
|
|
177
|
+
}
|
|
170
178
|
|
|
171
179
|
private:
|
|
172
180
|
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;
|
|
@@ -29,7 +29,7 @@ public protocol HybridPerpDepthBarsSpec_protocol: HybridObject, HybridView {
|
|
|
29
29
|
var onRowPress: ((_ rowIndex: Double) -> Void)? { get set }
|
|
30
30
|
|
|
31
31
|
// Methods
|
|
32
|
-
|
|
32
|
+
func setDepth(buffer: ArrayBuffer) throws -> Void
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
public extension HybridPerpDepthBarsSpec_protocol {
|
|
@@ -330,6 +330,17 @@ open class HybridPerpDepthBarsSpec_cxx {
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
// Methods
|
|
333
|
+
@inline(__always)
|
|
334
|
+
public final func setDepth(buffer: ArrayBuffer) -> bridge.Result_void_ {
|
|
335
|
+
do {
|
|
336
|
+
try self.__implementation.setDepth(buffer: buffer)
|
|
337
|
+
return bridge.create_Result_void_()
|
|
338
|
+
} catch (let __error) {
|
|
339
|
+
let __exceptionPtr = __error.toCpp()
|
|
340
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
333
344
|
public final func getView() -> UnsafeMutableRawPointer {
|
|
334
345
|
return Unmanaged.passRetained(__implementation.view).toOpaque()
|
|
335
346
|
}
|
|
@@ -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
|
}
|
|
@@ -46,6 +46,7 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
46
46
|
prototype.registerHybridSetter("textInset", &HybridPerpDepthBarsSpec::setTextInset);
|
|
47
47
|
prototype.registerHybridGetter("onRowPress", &HybridPerpDepthBarsSpec::getOnRowPress);
|
|
48
48
|
prototype.registerHybridSetter("onRowPress", &HybridPerpDepthBarsSpec::setOnRowPress);
|
|
49
|
+
prototype.registerHybridMethod("setDepth", &HybridPerpDepthBarsSpec::setDepth);
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -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
|
|
|
@@ -82,7 +83,7 @@ namespace margelo::nitro::perpdepthbar {
|
|
|
82
83
|
|
|
83
84
|
public:
|
|
84
85
|
// Methods
|
|
85
|
-
|
|
86
|
+
virtual void setDepth(const std::shared_ptr<ArrayBuffer>& buffer) = 0;
|
|
86
87
|
|
|
87
88
|
protected:
|
|
88
89
|
// 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
|
|
package/package.json
CHANGED
|
@@ -64,6 +64,24 @@ export interface PerpDepthBarsProps extends HybridViewProps {
|
|
|
64
64
|
onRowPress?: (rowIndex: number) => void;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
export interface PerpDepthBarsMethods extends HybridViewMethods {
|
|
67
|
+
export interface PerpDepthBarsMethods extends HybridViewMethods {
|
|
68
|
+
/**
|
|
69
|
+
* Imperatively update the per-row depth percentages, bypassing the
|
|
70
|
+
* high-frequency `percents` prop write path (and its props/JSICache lock
|
|
71
|
+
* contention — REACT-NATIVE-1JZ).
|
|
72
|
+
*
|
|
73
|
+
* `buffer` is a packed `Float32Array` (little-endian): one float per row,
|
|
74
|
+
* each the row's depth percentage with the SAME semantics as the
|
|
75
|
+
* `percents: number[]` prop (0..100, clamped natively exactly like the prop
|
|
76
|
+
* setter). Row count == `buffer.byteLength / 4`. The native side rebuilds
|
|
77
|
+
* its animation targets from these values and reuses the identical
|
|
78
|
+
* clamp/target/frame-loop logic as the `percents` prop path — only the data
|
|
79
|
+
* source differs.
|
|
80
|
+
*
|
|
81
|
+
* The `percents` prop is retained for backward compatibility; callers may
|
|
82
|
+
* use either path.
|
|
83
|
+
*/
|
|
84
|
+
setDepth(buffer: ArrayBuffer): void;
|
|
85
|
+
}
|
|
68
86
|
|
|
69
87
|
export type PerpDepthBars = HybridView<PerpDepthBarsProps, PerpDepthBarsMethods>;
|
|
@@ -29,6 +29,20 @@ export interface PerpSideRatioProps extends HybridViewProps {
|
|
|
29
29
|
reducedMotion: boolean;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export interface PerpSideRatioMethods extends HybridViewMethods {
|
|
32
|
+
export interface PerpSideRatioMethods extends HybridViewMethods {
|
|
33
|
+
/**
|
|
34
|
+
* Imperatively update the bid/ask ratio, bypassing the high-frequency
|
|
35
|
+
* `bidPercentage`/`askPercentage` prop write path (and its props/JSICache
|
|
36
|
+
* lock contention — REACT-NATIVE-1JZ). Companion to `PerpDepthBars.setDepth`.
|
|
37
|
+
*
|
|
38
|
+
* `bidPercentage`/`askPercentage` carry the EXACT SAME semantics as the
|
|
39
|
+
* props of the same name (0..100 shares; the native side derives the split
|
|
40
|
+
* fraction identically). The native side routes these through the same
|
|
41
|
+
* clamp/target/animation path the prop setters use — only the data source
|
|
42
|
+
* differs. The `bidPercentage`/`askPercentage` props are retained for
|
|
43
|
+
* backward compatibility; callers may use either path.
|
|
44
|
+
*/
|
|
45
|
+
setRatio(bidPercentage: number, askPercentage: number): void;
|
|
46
|
+
}
|
|
33
47
|
|
|
34
48
|
export type PerpSideRatio = HybridView<PerpSideRatioProps, PerpSideRatioMethods>;
|