@computools/react-native-template-controller 0.0.1 → 0.0.3
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/package.json +1 -1
- package/template/.bundle/config +2 -0
- package/template/.eslintrc.js +4 -0
- package/template/.prettierrc.js +7 -0
- package/template/.ruby-version +1 -0
- package/template/.watchmanconfig +1 -0
- package/template/App.tsx +118 -0
- package/template/Gemfile +6 -0
- package/template/__tests__/App-test.tsx +14 -0
- package/template/_node-version +1 -0
- package/template/android/app/build.gradle +170 -0
- package/template/android/app/debug.keystore +0 -0
- package/template/android/app/proguard-rules.pro +10 -0
- package/template/android/app/src/debug/AndroidManifest.xml +13 -0
- package/template/android/app/src/debug/java/com/reactnativetemplate/ReactNativeFlipper.java +75 -0
- package/template/android/app/src/main/AndroidManifest.xml +25 -0
- package/template/android/app/src/main/java/com/reactnativetemplate/MainActivity.java +35 -0
- package/template/android/app/src/main/java/com/reactnativetemplate/MainApplication.java +62 -0
- package/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/template/android/app/src/main/res/values/strings.xml +3 -0
- package/template/android/app/src/main/res/values/styles.xml +9 -0
- package/template/android/app/src/release/java/com/reactnativetemplate/ReactNativeFlipper.java +20 -0
- package/template/android/build.gradle +21 -0
- package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/template/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/template/android/gradle.properties +44 -0
- package/template/android/gradlew +234 -0
- package/template/android/gradlew.bat +89 -0
- package/template/android/settings.gradle +4 -0
- package/template/app.json +4 -0
- package/template/babel.config.js +3 -0
- package/template/index.js +9 -0
- package/template/ios/.xcode.env +1 -0
- package/template/ios/Podfile +60 -0
- package/template/ios/ReactNativeTemplate/AppDelegate.h +6 -0
- package/template/ios/ReactNativeTemplate/AppDelegate.mm +36 -0
- package/template/ios/ReactNativeTemplate/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- package/template/ios/ReactNativeTemplate/Images.xcassets/Contents.json +6 -0
- package/template/ios/ReactNativeTemplate/Info.plist +55 -0
- package/template/ios/ReactNativeTemplate/LaunchScreen.storyboard +47 -0
- package/template/ios/ReactNativeTemplate/main.m +10 -0
- package/template/ios/ReactNativeTemplate.xcodeproj/project.pbxproj +704 -0
- package/template/ios/ReactNativeTemplate.xcodeproj/xcshareddata/xcschemes/ReactNativeTemplate.xcscheme +88 -0
- package/template/ios/ReactNativeTemplateTests/Info.plist +24 -0
- package/template/ios/ReactNativeTemplateTests/ReactNativeTemplateTests.m +66 -0
- package/template/ios/_xcode.env +11 -0
- package/template/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec-generated.mm +1964 -0
- package/template/ios/build/generated/ios/FBReactNativeSpec/FBReactNativeSpec.h +2426 -0
- package/template/ios/build/generated/ios/FBReactNativeSpecJSI-generated.cpp +1457 -0
- package/template/ios/build/generated/ios/FBReactNativeSpecJSI.h +4920 -0
- package/template/ios/build/generated/ios/React-Codegen.podspec.json +1 -0
- package/template/metro.config.js +17 -0
- package/template/package.json +36 -0
- package/template/tsconfig.json +3 -0
- package/template.config.js +4 -0
|
@@ -0,0 +1,4920 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook {
|
|
16
|
+
namespace react {
|
|
17
|
+
|
|
18
|
+
class JSI_EXPORT NativeVibrationCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeVibrationCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
24
|
+
virtual void vibrate(jsi::Runtime &rt, double pattern) = 0;
|
|
25
|
+
virtual void vibrateByPattern(jsi::Runtime &rt, jsi::Array pattern, double repeat) = 0;
|
|
26
|
+
virtual void cancel(jsi::Runtime &rt) = 0;
|
|
27
|
+
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
template <typename T>
|
|
31
|
+
class JSI_EXPORT NativeVibrationCxxSpec : public TurboModule {
|
|
32
|
+
public:
|
|
33
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
34
|
+
return delegate_.get(rt, propName);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
protected:
|
|
38
|
+
NativeVibrationCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
39
|
+
: TurboModule("Vibration", jsInvoker),
|
|
40
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
41
|
+
|
|
42
|
+
private:
|
|
43
|
+
class Delegate : public NativeVibrationCxxSpecJSI {
|
|
44
|
+
public:
|
|
45
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
46
|
+
NativeVibrationCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
47
|
+
|
|
48
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
49
|
+
static_assert(
|
|
50
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
51
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
52
|
+
|
|
53
|
+
return bridging::callFromJs<jsi::Object>(
|
|
54
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
55
|
+
}
|
|
56
|
+
void vibrate(jsi::Runtime &rt, double pattern) override {
|
|
57
|
+
static_assert(
|
|
58
|
+
bridging::getParameterCount(&T::vibrate) == 2,
|
|
59
|
+
"Expected vibrate(...) to have 2 parameters");
|
|
60
|
+
|
|
61
|
+
return bridging::callFromJs<void>(
|
|
62
|
+
rt, &T::vibrate, jsInvoker_, instance_, std::move(pattern));
|
|
63
|
+
}
|
|
64
|
+
void vibrateByPattern(jsi::Runtime &rt, jsi::Array pattern, double repeat) override {
|
|
65
|
+
static_assert(
|
|
66
|
+
bridging::getParameterCount(&T::vibrateByPattern) == 3,
|
|
67
|
+
"Expected vibrateByPattern(...) to have 3 parameters");
|
|
68
|
+
|
|
69
|
+
return bridging::callFromJs<void>(
|
|
70
|
+
rt, &T::vibrateByPattern, jsInvoker_, instance_, std::move(pattern), std::move(repeat));
|
|
71
|
+
}
|
|
72
|
+
void cancel(jsi::Runtime &rt) override {
|
|
73
|
+
static_assert(
|
|
74
|
+
bridging::getParameterCount(&T::cancel) == 1,
|
|
75
|
+
"Expected cancel(...) to have 1 parameters");
|
|
76
|
+
|
|
77
|
+
return bridging::callFromJs<void>(
|
|
78
|
+
rt, &T::cancel, jsInvoker_, instance_);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private:
|
|
82
|
+
T *instance_;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
Delegate delegate_;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
class JSI_EXPORT NativeSettingsManagerCxxSpecJSI : public TurboModule {
|
|
89
|
+
protected:
|
|
90
|
+
NativeSettingsManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
91
|
+
|
|
92
|
+
public:
|
|
93
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
94
|
+
virtual void setValues(jsi::Runtime &rt, jsi::Object values) = 0;
|
|
95
|
+
virtual void deleteValues(jsi::Runtime &rt, jsi::Array values) = 0;
|
|
96
|
+
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
template <typename T>
|
|
100
|
+
class JSI_EXPORT NativeSettingsManagerCxxSpec : public TurboModule {
|
|
101
|
+
public:
|
|
102
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
103
|
+
return delegate_.get(rt, propName);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
protected:
|
|
107
|
+
NativeSettingsManagerCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
108
|
+
: TurboModule("SettingsManager", jsInvoker),
|
|
109
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
110
|
+
|
|
111
|
+
private:
|
|
112
|
+
class Delegate : public NativeSettingsManagerCxxSpecJSI {
|
|
113
|
+
public:
|
|
114
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
115
|
+
NativeSettingsManagerCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
116
|
+
|
|
117
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
118
|
+
static_assert(
|
|
119
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
120
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
121
|
+
|
|
122
|
+
return bridging::callFromJs<jsi::Object>(
|
|
123
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
124
|
+
}
|
|
125
|
+
void setValues(jsi::Runtime &rt, jsi::Object values) override {
|
|
126
|
+
static_assert(
|
|
127
|
+
bridging::getParameterCount(&T::setValues) == 2,
|
|
128
|
+
"Expected setValues(...) to have 2 parameters");
|
|
129
|
+
|
|
130
|
+
return bridging::callFromJs<void>(
|
|
131
|
+
rt, &T::setValues, jsInvoker_, instance_, std::move(values));
|
|
132
|
+
}
|
|
133
|
+
void deleteValues(jsi::Runtime &rt, jsi::Array values) override {
|
|
134
|
+
static_assert(
|
|
135
|
+
bridging::getParameterCount(&T::deleteValues) == 2,
|
|
136
|
+
"Expected deleteValues(...) to have 2 parameters");
|
|
137
|
+
|
|
138
|
+
return bridging::callFromJs<void>(
|
|
139
|
+
rt, &T::deleteValues, jsInvoker_, instance_, std::move(values));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private:
|
|
143
|
+
T *instance_;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
Delegate delegate_;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
class JSI_EXPORT NativeWebSocketModuleCxxSpecJSI : public TurboModule {
|
|
150
|
+
protected:
|
|
151
|
+
NativeWebSocketModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
152
|
+
|
|
153
|
+
public:
|
|
154
|
+
virtual void connect(jsi::Runtime &rt, jsi::String url, std::optional<jsi::Array> protocols, jsi::Object options, double socketID) = 0;
|
|
155
|
+
virtual void send(jsi::Runtime &rt, jsi::String message, double forSocketID) = 0;
|
|
156
|
+
virtual void sendBinary(jsi::Runtime &rt, jsi::String base64String, double forSocketID) = 0;
|
|
157
|
+
virtual void ping(jsi::Runtime &rt, double socketID) = 0;
|
|
158
|
+
virtual void close(jsi::Runtime &rt, double code, jsi::String reason, double socketID) = 0;
|
|
159
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
|
|
160
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
161
|
+
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
template <typename T>
|
|
165
|
+
class JSI_EXPORT NativeWebSocketModuleCxxSpec : public TurboModule {
|
|
166
|
+
public:
|
|
167
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
168
|
+
return delegate_.get(rt, propName);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
protected:
|
|
172
|
+
NativeWebSocketModuleCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
173
|
+
: TurboModule("WebSocketModule", jsInvoker),
|
|
174
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
175
|
+
|
|
176
|
+
private:
|
|
177
|
+
class Delegate : public NativeWebSocketModuleCxxSpecJSI {
|
|
178
|
+
public:
|
|
179
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
180
|
+
NativeWebSocketModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
181
|
+
|
|
182
|
+
void connect(jsi::Runtime &rt, jsi::String url, std::optional<jsi::Array> protocols, jsi::Object options, double socketID) override {
|
|
183
|
+
static_assert(
|
|
184
|
+
bridging::getParameterCount(&T::connect) == 5,
|
|
185
|
+
"Expected connect(...) to have 5 parameters");
|
|
186
|
+
|
|
187
|
+
return bridging::callFromJs<void>(
|
|
188
|
+
rt, &T::connect, jsInvoker_, instance_, std::move(url), std::move(protocols), std::move(options), std::move(socketID));
|
|
189
|
+
}
|
|
190
|
+
void send(jsi::Runtime &rt, jsi::String message, double forSocketID) override {
|
|
191
|
+
static_assert(
|
|
192
|
+
bridging::getParameterCount(&T::send) == 3,
|
|
193
|
+
"Expected send(...) to have 3 parameters");
|
|
194
|
+
|
|
195
|
+
return bridging::callFromJs<void>(
|
|
196
|
+
rt, &T::send, jsInvoker_, instance_, std::move(message), std::move(forSocketID));
|
|
197
|
+
}
|
|
198
|
+
void sendBinary(jsi::Runtime &rt, jsi::String base64String, double forSocketID) override {
|
|
199
|
+
static_assert(
|
|
200
|
+
bridging::getParameterCount(&T::sendBinary) == 3,
|
|
201
|
+
"Expected sendBinary(...) to have 3 parameters");
|
|
202
|
+
|
|
203
|
+
return bridging::callFromJs<void>(
|
|
204
|
+
rt, &T::sendBinary, jsInvoker_, instance_, std::move(base64String), std::move(forSocketID));
|
|
205
|
+
}
|
|
206
|
+
void ping(jsi::Runtime &rt, double socketID) override {
|
|
207
|
+
static_assert(
|
|
208
|
+
bridging::getParameterCount(&T::ping) == 2,
|
|
209
|
+
"Expected ping(...) to have 2 parameters");
|
|
210
|
+
|
|
211
|
+
return bridging::callFromJs<void>(
|
|
212
|
+
rt, &T::ping, jsInvoker_, instance_, std::move(socketID));
|
|
213
|
+
}
|
|
214
|
+
void close(jsi::Runtime &rt, double code, jsi::String reason, double socketID) override {
|
|
215
|
+
static_assert(
|
|
216
|
+
bridging::getParameterCount(&T::close) == 4,
|
|
217
|
+
"Expected close(...) to have 4 parameters");
|
|
218
|
+
|
|
219
|
+
return bridging::callFromJs<void>(
|
|
220
|
+
rt, &T::close, jsInvoker_, instance_, std::move(code), std::move(reason), std::move(socketID));
|
|
221
|
+
}
|
|
222
|
+
void addListener(jsi::Runtime &rt, jsi::String eventName) override {
|
|
223
|
+
static_assert(
|
|
224
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
225
|
+
"Expected addListener(...) to have 2 parameters");
|
|
226
|
+
|
|
227
|
+
return bridging::callFromJs<void>(
|
|
228
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
|
|
229
|
+
}
|
|
230
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
231
|
+
static_assert(
|
|
232
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
233
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
234
|
+
|
|
235
|
+
return bridging::callFromJs<void>(
|
|
236
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
private:
|
|
240
|
+
T *instance_;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
Delegate delegate_;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
#pragma mark - ExceptionsManagerBaseStackFrame
|
|
247
|
+
|
|
248
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4>
|
|
249
|
+
struct ExceptionsManagerBaseStackFrame {
|
|
250
|
+
P0 column;
|
|
251
|
+
P1 file;
|
|
252
|
+
P2 lineNumber;
|
|
253
|
+
P3 methodName;
|
|
254
|
+
P4 collapse;
|
|
255
|
+
bool operator==(const ExceptionsManagerBaseStackFrame &other) const {
|
|
256
|
+
return column == other.column && file == other.file && lineNumber == other.lineNumber && methodName == other.methodName && collapse == other.collapse;
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4>
|
|
261
|
+
struct ExceptionsManagerBaseStackFrameBridging {
|
|
262
|
+
static ExceptionsManagerBaseStackFrame<P0, P1, P2, P3, P4> fromJs(
|
|
263
|
+
jsi::Runtime &rt,
|
|
264
|
+
const jsi::Object &value,
|
|
265
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
266
|
+
ExceptionsManagerBaseStackFrame<P0, P1, P2, P3, P4> result{
|
|
267
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "column"), jsInvoker),
|
|
268
|
+
bridging::fromJs<P1>(rt, value.getProperty(rt, "file"), jsInvoker),
|
|
269
|
+
bridging::fromJs<P2>(rt, value.getProperty(rt, "lineNumber"), jsInvoker),
|
|
270
|
+
bridging::fromJs<P3>(rt, value.getProperty(rt, "methodName"), jsInvoker),
|
|
271
|
+
bridging::fromJs<P4>(rt, value.getProperty(rt, "collapse"), jsInvoker)};
|
|
272
|
+
return result;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
static jsi::Object toJs(
|
|
276
|
+
jsi::Runtime &rt,
|
|
277
|
+
const ExceptionsManagerBaseStackFrame<P0, P1, P2, P3, P4> &value) {
|
|
278
|
+
auto result = facebook::jsi::Object(rt);
|
|
279
|
+
result.setProperty(rt, "column", bridging::toJs(rt, value.column));
|
|
280
|
+
result.setProperty(rt, "file", bridging::toJs(rt, value.file));
|
|
281
|
+
result.setProperty(rt, "lineNumber", bridging::toJs(rt, value.lineNumber));
|
|
282
|
+
result.setProperty(rt, "methodName", bridging::toJs(rt, value.methodName));
|
|
283
|
+
if (value.collapse) {
|
|
284
|
+
result.setProperty(rt, "collapse", bridging::toJs(rt, value.collapse.value()));
|
|
285
|
+
}
|
|
286
|
+
return result;
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
#pragma mark - ExceptionsManagerBaseExceptionData
|
|
292
|
+
|
|
293
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
|
|
294
|
+
struct ExceptionsManagerBaseExceptionData {
|
|
295
|
+
P0 message;
|
|
296
|
+
P1 originalMessage;
|
|
297
|
+
P2 name;
|
|
298
|
+
P3 componentStack;
|
|
299
|
+
P4 stack;
|
|
300
|
+
P5 id;
|
|
301
|
+
P6 isFatal;
|
|
302
|
+
P7 extraData;
|
|
303
|
+
bool operator==(const ExceptionsManagerBaseExceptionData &other) const {
|
|
304
|
+
return message == other.message && originalMessage == other.originalMessage && name == other.name && componentStack == other.componentStack && stack == other.stack && id == other.id && isFatal == other.isFatal && extraData == other.extraData;
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
|
|
309
|
+
struct ExceptionsManagerBaseExceptionDataBridging {
|
|
310
|
+
static ExceptionsManagerBaseExceptionData<P0, P1, P2, P3, P4, P5, P6, P7> fromJs(
|
|
311
|
+
jsi::Runtime &rt,
|
|
312
|
+
const jsi::Object &value,
|
|
313
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
314
|
+
ExceptionsManagerBaseExceptionData<P0, P1, P2, P3, P4, P5, P6, P7> result{
|
|
315
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "message"), jsInvoker),
|
|
316
|
+
bridging::fromJs<P1>(rt, value.getProperty(rt, "originalMessage"), jsInvoker),
|
|
317
|
+
bridging::fromJs<P2>(rt, value.getProperty(rt, "name"), jsInvoker),
|
|
318
|
+
bridging::fromJs<P3>(rt, value.getProperty(rt, "componentStack"), jsInvoker),
|
|
319
|
+
bridging::fromJs<P4>(rt, value.getProperty(rt, "stack"), jsInvoker),
|
|
320
|
+
bridging::fromJs<P5>(rt, value.getProperty(rt, "id"), jsInvoker),
|
|
321
|
+
bridging::fromJs<P6>(rt, value.getProperty(rt, "isFatal"), jsInvoker),
|
|
322
|
+
bridging::fromJs<P7>(rt, value.getProperty(rt, "extraData"), jsInvoker)};
|
|
323
|
+
return result;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
static jsi::Object toJs(
|
|
327
|
+
jsi::Runtime &rt,
|
|
328
|
+
const ExceptionsManagerBaseExceptionData<P0, P1, P2, P3, P4, P5, P6, P7> &value) {
|
|
329
|
+
auto result = facebook::jsi::Object(rt);
|
|
330
|
+
result.setProperty(rt, "message", bridging::toJs(rt, value.message));
|
|
331
|
+
result.setProperty(rt, "originalMessage", bridging::toJs(rt, value.originalMessage));
|
|
332
|
+
result.setProperty(rt, "name", bridging::toJs(rt, value.name));
|
|
333
|
+
result.setProperty(rt, "componentStack", bridging::toJs(rt, value.componentStack));
|
|
334
|
+
result.setProperty(rt, "stack", bridging::toJs(rt, value.stack));
|
|
335
|
+
result.setProperty(rt, "id", bridging::toJs(rt, value.id));
|
|
336
|
+
result.setProperty(rt, "isFatal", bridging::toJs(rt, value.isFatal));
|
|
337
|
+
if (value.extraData) {
|
|
338
|
+
result.setProperty(rt, "extraData", bridging::toJs(rt, value.extraData.value()));
|
|
339
|
+
}
|
|
340
|
+
return result;
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
class JSI_EXPORT NativeExceptionsManagerCxxSpecJSI : public TurboModule {
|
|
345
|
+
protected:
|
|
346
|
+
NativeExceptionsManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
347
|
+
|
|
348
|
+
public:
|
|
349
|
+
virtual void reportFatalException(jsi::Runtime &rt, jsi::String message, jsi::Array stack, double exceptionId) = 0;
|
|
350
|
+
virtual void reportSoftException(jsi::Runtime &rt, jsi::String message, jsi::Array stack, double exceptionId) = 0;
|
|
351
|
+
virtual void reportException(jsi::Runtime &rt, jsi::Object data) = 0;
|
|
352
|
+
virtual void updateExceptionMessage(jsi::Runtime &rt, jsi::String message, jsi::Array stack, double exceptionId) = 0;
|
|
353
|
+
virtual void dismissRedbox(jsi::Runtime &rt) = 0;
|
|
354
|
+
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
template <typename T>
|
|
358
|
+
class JSI_EXPORT NativeExceptionsManagerCxxSpec : public TurboModule {
|
|
359
|
+
public:
|
|
360
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
361
|
+
return delegate_.get(rt, propName);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
protected:
|
|
365
|
+
NativeExceptionsManagerCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
366
|
+
: TurboModule("ExceptionsManager", jsInvoker),
|
|
367
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
368
|
+
|
|
369
|
+
private:
|
|
370
|
+
class Delegate : public NativeExceptionsManagerCxxSpecJSI {
|
|
371
|
+
public:
|
|
372
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
373
|
+
NativeExceptionsManagerCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
374
|
+
|
|
375
|
+
void reportFatalException(jsi::Runtime &rt, jsi::String message, jsi::Array stack, double exceptionId) override {
|
|
376
|
+
static_assert(
|
|
377
|
+
bridging::getParameterCount(&T::reportFatalException) == 4,
|
|
378
|
+
"Expected reportFatalException(...) to have 4 parameters");
|
|
379
|
+
|
|
380
|
+
return bridging::callFromJs<void>(
|
|
381
|
+
rt, &T::reportFatalException, jsInvoker_, instance_, std::move(message), std::move(stack), std::move(exceptionId));
|
|
382
|
+
}
|
|
383
|
+
void reportSoftException(jsi::Runtime &rt, jsi::String message, jsi::Array stack, double exceptionId) override {
|
|
384
|
+
static_assert(
|
|
385
|
+
bridging::getParameterCount(&T::reportSoftException) == 4,
|
|
386
|
+
"Expected reportSoftException(...) to have 4 parameters");
|
|
387
|
+
|
|
388
|
+
return bridging::callFromJs<void>(
|
|
389
|
+
rt, &T::reportSoftException, jsInvoker_, instance_, std::move(message), std::move(stack), std::move(exceptionId));
|
|
390
|
+
}
|
|
391
|
+
void reportException(jsi::Runtime &rt, jsi::Object data) override {
|
|
392
|
+
static_assert(
|
|
393
|
+
bridging::getParameterCount(&T::reportException) == 2,
|
|
394
|
+
"Expected reportException(...) to have 2 parameters");
|
|
395
|
+
|
|
396
|
+
return bridging::callFromJs<void>(
|
|
397
|
+
rt, &T::reportException, jsInvoker_, instance_, std::move(data));
|
|
398
|
+
}
|
|
399
|
+
void updateExceptionMessage(jsi::Runtime &rt, jsi::String message, jsi::Array stack, double exceptionId) override {
|
|
400
|
+
static_assert(
|
|
401
|
+
bridging::getParameterCount(&T::updateExceptionMessage) == 4,
|
|
402
|
+
"Expected updateExceptionMessage(...) to have 4 parameters");
|
|
403
|
+
|
|
404
|
+
return bridging::callFromJs<void>(
|
|
405
|
+
rt, &T::updateExceptionMessage, jsInvoker_, instance_, std::move(message), std::move(stack), std::move(exceptionId));
|
|
406
|
+
}
|
|
407
|
+
void dismissRedbox(jsi::Runtime &rt) override {
|
|
408
|
+
static_assert(
|
|
409
|
+
bridging::getParameterCount(&T::dismissRedbox) == 1,
|
|
410
|
+
"Expected dismissRedbox(...) to have 1 parameters");
|
|
411
|
+
|
|
412
|
+
return bridging::callFromJs<void>(
|
|
413
|
+
rt, &T::dismissRedbox, jsInvoker_, instance_);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
private:
|
|
417
|
+
T *instance_;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
Delegate delegate_;
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
class JSI_EXPORT NativeTimingCxxSpecJSI : public TurboModule {
|
|
424
|
+
protected:
|
|
425
|
+
NativeTimingCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
426
|
+
|
|
427
|
+
public:
|
|
428
|
+
virtual void createTimer(jsi::Runtime &rt, double callbackID, double duration, double jsSchedulingTime, bool repeats) = 0;
|
|
429
|
+
virtual void deleteTimer(jsi::Runtime &rt, double timerID) = 0;
|
|
430
|
+
virtual void setSendIdleEvents(jsi::Runtime &rt, bool sendIdleEvents) = 0;
|
|
431
|
+
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
template <typename T>
|
|
435
|
+
class JSI_EXPORT NativeTimingCxxSpec : public TurboModule {
|
|
436
|
+
public:
|
|
437
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
438
|
+
return delegate_.get(rt, propName);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
protected:
|
|
442
|
+
NativeTimingCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
443
|
+
: TurboModule("Timing", jsInvoker),
|
|
444
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
445
|
+
|
|
446
|
+
private:
|
|
447
|
+
class Delegate : public NativeTimingCxxSpecJSI {
|
|
448
|
+
public:
|
|
449
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
450
|
+
NativeTimingCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
451
|
+
|
|
452
|
+
void createTimer(jsi::Runtime &rt, double callbackID, double duration, double jsSchedulingTime, bool repeats) override {
|
|
453
|
+
static_assert(
|
|
454
|
+
bridging::getParameterCount(&T::createTimer) == 5,
|
|
455
|
+
"Expected createTimer(...) to have 5 parameters");
|
|
456
|
+
|
|
457
|
+
return bridging::callFromJs<void>(
|
|
458
|
+
rt, &T::createTimer, jsInvoker_, instance_, std::move(callbackID), std::move(duration), std::move(jsSchedulingTime), std::move(repeats));
|
|
459
|
+
}
|
|
460
|
+
void deleteTimer(jsi::Runtime &rt, double timerID) override {
|
|
461
|
+
static_assert(
|
|
462
|
+
bridging::getParameterCount(&T::deleteTimer) == 2,
|
|
463
|
+
"Expected deleteTimer(...) to have 2 parameters");
|
|
464
|
+
|
|
465
|
+
return bridging::callFromJs<void>(
|
|
466
|
+
rt, &T::deleteTimer, jsInvoker_, instance_, std::move(timerID));
|
|
467
|
+
}
|
|
468
|
+
void setSendIdleEvents(jsi::Runtime &rt, bool sendIdleEvents) override {
|
|
469
|
+
static_assert(
|
|
470
|
+
bridging::getParameterCount(&T::setSendIdleEvents) == 2,
|
|
471
|
+
"Expected setSendIdleEvents(...) to have 2 parameters");
|
|
472
|
+
|
|
473
|
+
return bridging::callFromJs<void>(
|
|
474
|
+
rt, &T::setSendIdleEvents, jsInvoker_, instance_, std::move(sendIdleEvents));
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
private:
|
|
478
|
+
T *instance_;
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
Delegate delegate_;
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
class JSI_EXPORT NativeSegmentFetcherCxxSpecJSI : public TurboModule {
|
|
485
|
+
protected:
|
|
486
|
+
NativeSegmentFetcherCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
487
|
+
|
|
488
|
+
public:
|
|
489
|
+
virtual void fetchSegment(jsi::Runtime &rt, double segmentId, jsi::Object options, jsi::Function callback) = 0;
|
|
490
|
+
virtual void getSegment(jsi::Runtime &rt, double segmentId, jsi::Object options, jsi::Function callback) = 0;
|
|
491
|
+
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
template <typename T>
|
|
495
|
+
class JSI_EXPORT NativeSegmentFetcherCxxSpec : public TurboModule {
|
|
496
|
+
public:
|
|
497
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
498
|
+
return delegate_.get(rt, propName);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
protected:
|
|
502
|
+
NativeSegmentFetcherCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
503
|
+
: TurboModule("SegmentFetcher", jsInvoker),
|
|
504
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
505
|
+
|
|
506
|
+
private:
|
|
507
|
+
class Delegate : public NativeSegmentFetcherCxxSpecJSI {
|
|
508
|
+
public:
|
|
509
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
510
|
+
NativeSegmentFetcherCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
511
|
+
|
|
512
|
+
void fetchSegment(jsi::Runtime &rt, double segmentId, jsi::Object options, jsi::Function callback) override {
|
|
513
|
+
static_assert(
|
|
514
|
+
bridging::getParameterCount(&T::fetchSegment) == 4,
|
|
515
|
+
"Expected fetchSegment(...) to have 4 parameters");
|
|
516
|
+
|
|
517
|
+
return bridging::callFromJs<void>(
|
|
518
|
+
rt, &T::fetchSegment, jsInvoker_, instance_, std::move(segmentId), std::move(options), std::move(callback));
|
|
519
|
+
}
|
|
520
|
+
void getSegment(jsi::Runtime &rt, double segmentId, jsi::Object options, jsi::Function callback) override {
|
|
521
|
+
static_assert(
|
|
522
|
+
bridging::getParameterCount(&T::getSegment) == 4,
|
|
523
|
+
"Expected getSegment(...) to have 4 parameters");
|
|
524
|
+
|
|
525
|
+
return bridging::callFromJs<void>(
|
|
526
|
+
rt, &T::getSegment, jsInvoker_, instance_, std::move(segmentId), std::move(options), std::move(callback));
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
private:
|
|
530
|
+
T *instance_;
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
Delegate delegate_;
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
class JSI_EXPORT NativePermissionsAndroidCxxSpecJSI : public TurboModule {
|
|
537
|
+
protected:
|
|
538
|
+
NativePermissionsAndroidCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
539
|
+
|
|
540
|
+
public:
|
|
541
|
+
virtual jsi::Value checkPermission(jsi::Runtime &rt, jsi::String permission) = 0;
|
|
542
|
+
virtual jsi::Value requestPermission(jsi::Runtime &rt, jsi::String permission) = 0;
|
|
543
|
+
virtual jsi::Value shouldShowRequestPermissionRationale(jsi::Runtime &rt, jsi::String permission) = 0;
|
|
544
|
+
virtual jsi::Value requestMultiplePermissions(jsi::Runtime &rt, jsi::Array permissions) = 0;
|
|
545
|
+
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
template <typename T>
|
|
549
|
+
class JSI_EXPORT NativePermissionsAndroidCxxSpec : public TurboModule {
|
|
550
|
+
public:
|
|
551
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
552
|
+
return delegate_.get(rt, propName);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
protected:
|
|
556
|
+
NativePermissionsAndroidCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
557
|
+
: TurboModule("PermissionsAndroid", jsInvoker),
|
|
558
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
559
|
+
|
|
560
|
+
private:
|
|
561
|
+
class Delegate : public NativePermissionsAndroidCxxSpecJSI {
|
|
562
|
+
public:
|
|
563
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
564
|
+
NativePermissionsAndroidCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
565
|
+
|
|
566
|
+
jsi::Value checkPermission(jsi::Runtime &rt, jsi::String permission) override {
|
|
567
|
+
static_assert(
|
|
568
|
+
bridging::getParameterCount(&T::checkPermission) == 2,
|
|
569
|
+
"Expected checkPermission(...) to have 2 parameters");
|
|
570
|
+
|
|
571
|
+
return bridging::callFromJs<jsi::Value>(
|
|
572
|
+
rt, &T::checkPermission, jsInvoker_, instance_, std::move(permission));
|
|
573
|
+
}
|
|
574
|
+
jsi::Value requestPermission(jsi::Runtime &rt, jsi::String permission) override {
|
|
575
|
+
static_assert(
|
|
576
|
+
bridging::getParameterCount(&T::requestPermission) == 2,
|
|
577
|
+
"Expected requestPermission(...) to have 2 parameters");
|
|
578
|
+
|
|
579
|
+
return bridging::callFromJs<jsi::Value>(
|
|
580
|
+
rt, &T::requestPermission, jsInvoker_, instance_, std::move(permission));
|
|
581
|
+
}
|
|
582
|
+
jsi::Value shouldShowRequestPermissionRationale(jsi::Runtime &rt, jsi::String permission) override {
|
|
583
|
+
static_assert(
|
|
584
|
+
bridging::getParameterCount(&T::shouldShowRequestPermissionRationale) == 2,
|
|
585
|
+
"Expected shouldShowRequestPermissionRationale(...) to have 2 parameters");
|
|
586
|
+
|
|
587
|
+
return bridging::callFromJs<jsi::Value>(
|
|
588
|
+
rt, &T::shouldShowRequestPermissionRationale, jsInvoker_, instance_, std::move(permission));
|
|
589
|
+
}
|
|
590
|
+
jsi::Value requestMultiplePermissions(jsi::Runtime &rt, jsi::Array permissions) override {
|
|
591
|
+
static_assert(
|
|
592
|
+
bridging::getParameterCount(&T::requestMultiplePermissions) == 2,
|
|
593
|
+
"Expected requestMultiplePermissions(...) to have 2 parameters");
|
|
594
|
+
|
|
595
|
+
return bridging::callFromJs<jsi::Value>(
|
|
596
|
+
rt, &T::requestMultiplePermissions, jsInvoker_, instance_, std::move(permissions));
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
private:
|
|
600
|
+
T *instance_;
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
Delegate delegate_;
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
#pragma mark - AlertManagerBaseArgs
|
|
607
|
+
|
|
608
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9>
|
|
609
|
+
struct AlertManagerBaseArgs {
|
|
610
|
+
P0 title;
|
|
611
|
+
P1 message;
|
|
612
|
+
P2 buttons;
|
|
613
|
+
P3 type;
|
|
614
|
+
P4 defaultValue;
|
|
615
|
+
P5 cancelButtonKey;
|
|
616
|
+
P6 destructiveButtonKey;
|
|
617
|
+
P7 preferredButtonKey;
|
|
618
|
+
P8 keyboardType;
|
|
619
|
+
P9 userInterfaceStyle;
|
|
620
|
+
bool operator==(const AlertManagerBaseArgs &other) const {
|
|
621
|
+
return title == other.title && message == other.message && buttons == other.buttons && type == other.type && defaultValue == other.defaultValue && cancelButtonKey == other.cancelButtonKey && destructiveButtonKey == other.destructiveButtonKey && preferredButtonKey == other.preferredButtonKey && keyboardType == other.keyboardType && userInterfaceStyle == other.userInterfaceStyle;
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9>
|
|
626
|
+
struct AlertManagerBaseArgsBridging {
|
|
627
|
+
static AlertManagerBaseArgs<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9> fromJs(
|
|
628
|
+
jsi::Runtime &rt,
|
|
629
|
+
const jsi::Object &value,
|
|
630
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
631
|
+
AlertManagerBaseArgs<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9> result{
|
|
632
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "title"), jsInvoker),
|
|
633
|
+
bridging::fromJs<P1>(rt, value.getProperty(rt, "message"), jsInvoker),
|
|
634
|
+
bridging::fromJs<P2>(rt, value.getProperty(rt, "buttons"), jsInvoker),
|
|
635
|
+
bridging::fromJs<P3>(rt, value.getProperty(rt, "type"), jsInvoker),
|
|
636
|
+
bridging::fromJs<P4>(rt, value.getProperty(rt, "defaultValue"), jsInvoker),
|
|
637
|
+
bridging::fromJs<P5>(rt, value.getProperty(rt, "cancelButtonKey"), jsInvoker),
|
|
638
|
+
bridging::fromJs<P6>(rt, value.getProperty(rt, "destructiveButtonKey"), jsInvoker),
|
|
639
|
+
bridging::fromJs<P7>(rt, value.getProperty(rt, "preferredButtonKey"), jsInvoker),
|
|
640
|
+
bridging::fromJs<P8>(rt, value.getProperty(rt, "keyboardType"), jsInvoker),
|
|
641
|
+
bridging::fromJs<P9>(rt, value.getProperty(rt, "userInterfaceStyle"), jsInvoker)};
|
|
642
|
+
return result;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
static jsi::Object toJs(
|
|
646
|
+
jsi::Runtime &rt,
|
|
647
|
+
const AlertManagerBaseArgs<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9> &value) {
|
|
648
|
+
auto result = facebook::jsi::Object(rt);
|
|
649
|
+
if (value.title) {
|
|
650
|
+
result.setProperty(rt, "title", bridging::toJs(rt, value.title.value()));
|
|
651
|
+
}
|
|
652
|
+
if (value.message) {
|
|
653
|
+
result.setProperty(rt, "message", bridging::toJs(rt, value.message.value()));
|
|
654
|
+
}
|
|
655
|
+
if (value.buttons) {
|
|
656
|
+
result.setProperty(rt, "buttons", bridging::toJs(rt, value.buttons.value()));
|
|
657
|
+
}
|
|
658
|
+
if (value.type) {
|
|
659
|
+
result.setProperty(rt, "type", bridging::toJs(rt, value.type.value()));
|
|
660
|
+
}
|
|
661
|
+
if (value.defaultValue) {
|
|
662
|
+
result.setProperty(rt, "defaultValue", bridging::toJs(rt, value.defaultValue.value()));
|
|
663
|
+
}
|
|
664
|
+
if (value.cancelButtonKey) {
|
|
665
|
+
result.setProperty(rt, "cancelButtonKey", bridging::toJs(rt, value.cancelButtonKey.value()));
|
|
666
|
+
}
|
|
667
|
+
if (value.destructiveButtonKey) {
|
|
668
|
+
result.setProperty(rt, "destructiveButtonKey", bridging::toJs(rt, value.destructiveButtonKey.value()));
|
|
669
|
+
}
|
|
670
|
+
if (value.preferredButtonKey) {
|
|
671
|
+
result.setProperty(rt, "preferredButtonKey", bridging::toJs(rt, value.preferredButtonKey.value()));
|
|
672
|
+
}
|
|
673
|
+
if (value.keyboardType) {
|
|
674
|
+
result.setProperty(rt, "keyboardType", bridging::toJs(rt, value.keyboardType.value()));
|
|
675
|
+
}
|
|
676
|
+
if (value.userInterfaceStyle) {
|
|
677
|
+
result.setProperty(rt, "userInterfaceStyle", bridging::toJs(rt, value.userInterfaceStyle.value()));
|
|
678
|
+
}
|
|
679
|
+
return result;
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
class JSI_EXPORT NativeAlertManagerCxxSpecJSI : public TurboModule {
|
|
684
|
+
protected:
|
|
685
|
+
NativeAlertManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
686
|
+
|
|
687
|
+
public:
|
|
688
|
+
virtual void alertWithArgs(jsi::Runtime &rt, jsi::Object args, jsi::Function callback) = 0;
|
|
689
|
+
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
template <typename T>
|
|
693
|
+
class JSI_EXPORT NativeAlertManagerCxxSpec : public TurboModule {
|
|
694
|
+
public:
|
|
695
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
696
|
+
return delegate_.get(rt, propName);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
protected:
|
|
700
|
+
NativeAlertManagerCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
701
|
+
: TurboModule("AlertManager", jsInvoker),
|
|
702
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
703
|
+
|
|
704
|
+
private:
|
|
705
|
+
class Delegate : public NativeAlertManagerCxxSpecJSI {
|
|
706
|
+
public:
|
|
707
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
708
|
+
NativeAlertManagerCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
709
|
+
|
|
710
|
+
void alertWithArgs(jsi::Runtime &rt, jsi::Object args, jsi::Function callback) override {
|
|
711
|
+
static_assert(
|
|
712
|
+
bridging::getParameterCount(&T::alertWithArgs) == 3,
|
|
713
|
+
"Expected alertWithArgs(...) to have 3 parameters");
|
|
714
|
+
|
|
715
|
+
return bridging::callFromJs<void>(
|
|
716
|
+
rt, &T::alertWithArgs, jsInvoker_, instance_, std::move(args), std::move(callback));
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
private:
|
|
720
|
+
T *instance_;
|
|
721
|
+
};
|
|
722
|
+
|
|
723
|
+
Delegate delegate_;
|
|
724
|
+
};
|
|
725
|
+
|
|
726
|
+
class JSI_EXPORT NativeActionSheetManagerCxxSpecJSI : public TurboModule {
|
|
727
|
+
protected:
|
|
728
|
+
NativeActionSheetManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
729
|
+
|
|
730
|
+
public:
|
|
731
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
732
|
+
virtual void showActionSheetWithOptions(jsi::Runtime &rt, jsi::Object options, jsi::Function callback) = 0;
|
|
733
|
+
virtual void showShareActionSheetWithOptions(jsi::Runtime &rt, jsi::Object options, jsi::Function failureCallback, jsi::Function successCallback) = 0;
|
|
734
|
+
virtual void dismissActionSheet(jsi::Runtime &rt) = 0;
|
|
735
|
+
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
template <typename T>
|
|
739
|
+
class JSI_EXPORT NativeActionSheetManagerCxxSpec : public TurboModule {
|
|
740
|
+
public:
|
|
741
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
742
|
+
return delegate_.get(rt, propName);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
protected:
|
|
746
|
+
NativeActionSheetManagerCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
747
|
+
: TurboModule("ActionSheetManager", jsInvoker),
|
|
748
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
749
|
+
|
|
750
|
+
private:
|
|
751
|
+
class Delegate : public NativeActionSheetManagerCxxSpecJSI {
|
|
752
|
+
public:
|
|
753
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
754
|
+
NativeActionSheetManagerCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
755
|
+
|
|
756
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
757
|
+
static_assert(
|
|
758
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
759
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
760
|
+
|
|
761
|
+
return bridging::callFromJs<jsi::Object>(
|
|
762
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
763
|
+
}
|
|
764
|
+
void showActionSheetWithOptions(jsi::Runtime &rt, jsi::Object options, jsi::Function callback) override {
|
|
765
|
+
static_assert(
|
|
766
|
+
bridging::getParameterCount(&T::showActionSheetWithOptions) == 3,
|
|
767
|
+
"Expected showActionSheetWithOptions(...) to have 3 parameters");
|
|
768
|
+
|
|
769
|
+
return bridging::callFromJs<void>(
|
|
770
|
+
rt, &T::showActionSheetWithOptions, jsInvoker_, instance_, std::move(options), std::move(callback));
|
|
771
|
+
}
|
|
772
|
+
void showShareActionSheetWithOptions(jsi::Runtime &rt, jsi::Object options, jsi::Function failureCallback, jsi::Function successCallback) override {
|
|
773
|
+
static_assert(
|
|
774
|
+
bridging::getParameterCount(&T::showShareActionSheetWithOptions) == 4,
|
|
775
|
+
"Expected showShareActionSheetWithOptions(...) to have 4 parameters");
|
|
776
|
+
|
|
777
|
+
return bridging::callFromJs<void>(
|
|
778
|
+
rt, &T::showShareActionSheetWithOptions, jsInvoker_, instance_, std::move(options), std::move(failureCallback), std::move(successCallback));
|
|
779
|
+
}
|
|
780
|
+
void dismissActionSheet(jsi::Runtime &rt) override {
|
|
781
|
+
static_assert(
|
|
782
|
+
bridging::getParameterCount(&T::dismissActionSheet) == 1,
|
|
783
|
+
"Expected dismissActionSheet(...) to have 1 parameters");
|
|
784
|
+
|
|
785
|
+
return bridging::callFromJs<void>(
|
|
786
|
+
rt, &T::dismissActionSheet, jsInvoker_, instance_);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
private:
|
|
790
|
+
T *instance_;
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
Delegate delegate_;
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
#pragma mark - DialogManagerAndroidBaseDialogOptions
|
|
797
|
+
|
|
798
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
|
|
799
|
+
struct DialogManagerAndroidBaseDialogOptions {
|
|
800
|
+
P0 title;
|
|
801
|
+
P1 message;
|
|
802
|
+
P2 buttonPositive;
|
|
803
|
+
P3 buttonNegative;
|
|
804
|
+
P4 buttonNeutral;
|
|
805
|
+
P5 items;
|
|
806
|
+
P6 cancelable;
|
|
807
|
+
bool operator==(const DialogManagerAndroidBaseDialogOptions &other) const {
|
|
808
|
+
return title == other.title && message == other.message && buttonPositive == other.buttonPositive && buttonNegative == other.buttonNegative && buttonNeutral == other.buttonNeutral && items == other.items && cancelable == other.cancelable;
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
|
|
813
|
+
struct DialogManagerAndroidBaseDialogOptionsBridging {
|
|
814
|
+
static DialogManagerAndroidBaseDialogOptions<P0, P1, P2, P3, P4, P5, P6> fromJs(
|
|
815
|
+
jsi::Runtime &rt,
|
|
816
|
+
const jsi::Object &value,
|
|
817
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
818
|
+
DialogManagerAndroidBaseDialogOptions<P0, P1, P2, P3, P4, P5, P6> result{
|
|
819
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "title"), jsInvoker),
|
|
820
|
+
bridging::fromJs<P1>(rt, value.getProperty(rt, "message"), jsInvoker),
|
|
821
|
+
bridging::fromJs<P2>(rt, value.getProperty(rt, "buttonPositive"), jsInvoker),
|
|
822
|
+
bridging::fromJs<P3>(rt, value.getProperty(rt, "buttonNegative"), jsInvoker),
|
|
823
|
+
bridging::fromJs<P4>(rt, value.getProperty(rt, "buttonNeutral"), jsInvoker),
|
|
824
|
+
bridging::fromJs<P5>(rt, value.getProperty(rt, "items"), jsInvoker),
|
|
825
|
+
bridging::fromJs<P6>(rt, value.getProperty(rt, "cancelable"), jsInvoker)};
|
|
826
|
+
return result;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
static jsi::Object toJs(
|
|
830
|
+
jsi::Runtime &rt,
|
|
831
|
+
const DialogManagerAndroidBaseDialogOptions<P0, P1, P2, P3, P4, P5, P6> &value) {
|
|
832
|
+
auto result = facebook::jsi::Object(rt);
|
|
833
|
+
if (value.title) {
|
|
834
|
+
result.setProperty(rt, "title", bridging::toJs(rt, value.title.value()));
|
|
835
|
+
}
|
|
836
|
+
if (value.message) {
|
|
837
|
+
result.setProperty(rt, "message", bridging::toJs(rt, value.message.value()));
|
|
838
|
+
}
|
|
839
|
+
if (value.buttonPositive) {
|
|
840
|
+
result.setProperty(rt, "buttonPositive", bridging::toJs(rt, value.buttonPositive.value()));
|
|
841
|
+
}
|
|
842
|
+
if (value.buttonNegative) {
|
|
843
|
+
result.setProperty(rt, "buttonNegative", bridging::toJs(rt, value.buttonNegative.value()));
|
|
844
|
+
}
|
|
845
|
+
if (value.buttonNeutral) {
|
|
846
|
+
result.setProperty(rt, "buttonNeutral", bridging::toJs(rt, value.buttonNeutral.value()));
|
|
847
|
+
}
|
|
848
|
+
if (value.items) {
|
|
849
|
+
result.setProperty(rt, "items", bridging::toJs(rt, value.items.value()));
|
|
850
|
+
}
|
|
851
|
+
if (value.cancelable) {
|
|
852
|
+
result.setProperty(rt, "cancelable", bridging::toJs(rt, value.cancelable.value()));
|
|
853
|
+
}
|
|
854
|
+
return result;
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
class JSI_EXPORT NativeDialogManagerAndroidCxxSpecJSI : public TurboModule {
|
|
859
|
+
protected:
|
|
860
|
+
NativeDialogManagerAndroidCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
861
|
+
|
|
862
|
+
public:
|
|
863
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
864
|
+
virtual void showAlert(jsi::Runtime &rt, jsi::Object config, jsi::Function onError, jsi::Function onAction) = 0;
|
|
865
|
+
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
template <typename T>
|
|
869
|
+
class JSI_EXPORT NativeDialogManagerAndroidCxxSpec : public TurboModule {
|
|
870
|
+
public:
|
|
871
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
872
|
+
return delegate_.get(rt, propName);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
protected:
|
|
876
|
+
NativeDialogManagerAndroidCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
877
|
+
: TurboModule("DialogManagerAndroid", jsInvoker),
|
|
878
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
879
|
+
|
|
880
|
+
private:
|
|
881
|
+
class Delegate : public NativeDialogManagerAndroidCxxSpecJSI {
|
|
882
|
+
public:
|
|
883
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
884
|
+
NativeDialogManagerAndroidCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
885
|
+
|
|
886
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
887
|
+
static_assert(
|
|
888
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
889
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
890
|
+
|
|
891
|
+
return bridging::callFromJs<jsi::Object>(
|
|
892
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
893
|
+
}
|
|
894
|
+
void showAlert(jsi::Runtime &rt, jsi::Object config, jsi::Function onError, jsi::Function onAction) override {
|
|
895
|
+
static_assert(
|
|
896
|
+
bridging::getParameterCount(&T::showAlert) == 4,
|
|
897
|
+
"Expected showAlert(...) to have 4 parameters");
|
|
898
|
+
|
|
899
|
+
return bridging::callFromJs<void>(
|
|
900
|
+
rt, &T::showAlert, jsInvoker_, instance_, std::move(config), std::move(onError), std::move(onAction));
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
private:
|
|
904
|
+
T *instance_;
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
Delegate delegate_;
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
class JSI_EXPORT NativeSourceCodeCxxSpecJSI : public TurboModule {
|
|
911
|
+
protected:
|
|
912
|
+
NativeSourceCodeCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
913
|
+
|
|
914
|
+
public:
|
|
915
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
916
|
+
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
template <typename T>
|
|
920
|
+
class JSI_EXPORT NativeSourceCodeCxxSpec : public TurboModule {
|
|
921
|
+
public:
|
|
922
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
923
|
+
return delegate_.get(rt, propName);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
protected:
|
|
927
|
+
NativeSourceCodeCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
928
|
+
: TurboModule("SourceCode", jsInvoker),
|
|
929
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
930
|
+
|
|
931
|
+
private:
|
|
932
|
+
class Delegate : public NativeSourceCodeCxxSpecJSI {
|
|
933
|
+
public:
|
|
934
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
935
|
+
NativeSourceCodeCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
936
|
+
|
|
937
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
938
|
+
static_assert(
|
|
939
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
940
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
941
|
+
|
|
942
|
+
return bridging::callFromJs<jsi::Object>(
|
|
943
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
private:
|
|
947
|
+
T *instance_;
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
Delegate delegate_;
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
class JSI_EXPORT NativeDevMenuCxxSpecJSI : public TurboModule {
|
|
954
|
+
protected:
|
|
955
|
+
NativeDevMenuCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
956
|
+
|
|
957
|
+
public:
|
|
958
|
+
virtual void show(jsi::Runtime &rt) = 0;
|
|
959
|
+
virtual void reload(jsi::Runtime &rt) = 0;
|
|
960
|
+
virtual void debugRemotely(jsi::Runtime &rt, bool enableDebug) = 0;
|
|
961
|
+
virtual void setProfilingEnabled(jsi::Runtime &rt, bool enabled) = 0;
|
|
962
|
+
virtual void setHotLoadingEnabled(jsi::Runtime &rt, bool enabled) = 0;
|
|
963
|
+
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
template <typename T>
|
|
967
|
+
class JSI_EXPORT NativeDevMenuCxxSpec : public TurboModule {
|
|
968
|
+
public:
|
|
969
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
970
|
+
return delegate_.get(rt, propName);
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
protected:
|
|
974
|
+
NativeDevMenuCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
975
|
+
: TurboModule("DevMenu", jsInvoker),
|
|
976
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
977
|
+
|
|
978
|
+
private:
|
|
979
|
+
class Delegate : public NativeDevMenuCxxSpecJSI {
|
|
980
|
+
public:
|
|
981
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
982
|
+
NativeDevMenuCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
983
|
+
|
|
984
|
+
void show(jsi::Runtime &rt) override {
|
|
985
|
+
static_assert(
|
|
986
|
+
bridging::getParameterCount(&T::show) == 1,
|
|
987
|
+
"Expected show(...) to have 1 parameters");
|
|
988
|
+
|
|
989
|
+
return bridging::callFromJs<void>(
|
|
990
|
+
rt, &T::show, jsInvoker_, instance_);
|
|
991
|
+
}
|
|
992
|
+
void reload(jsi::Runtime &rt) override {
|
|
993
|
+
static_assert(
|
|
994
|
+
bridging::getParameterCount(&T::reload) == 1,
|
|
995
|
+
"Expected reload(...) to have 1 parameters");
|
|
996
|
+
|
|
997
|
+
return bridging::callFromJs<void>(
|
|
998
|
+
rt, &T::reload, jsInvoker_, instance_);
|
|
999
|
+
}
|
|
1000
|
+
void debugRemotely(jsi::Runtime &rt, bool enableDebug) override {
|
|
1001
|
+
static_assert(
|
|
1002
|
+
bridging::getParameterCount(&T::debugRemotely) == 2,
|
|
1003
|
+
"Expected debugRemotely(...) to have 2 parameters");
|
|
1004
|
+
|
|
1005
|
+
return bridging::callFromJs<void>(
|
|
1006
|
+
rt, &T::debugRemotely, jsInvoker_, instance_, std::move(enableDebug));
|
|
1007
|
+
}
|
|
1008
|
+
void setProfilingEnabled(jsi::Runtime &rt, bool enabled) override {
|
|
1009
|
+
static_assert(
|
|
1010
|
+
bridging::getParameterCount(&T::setProfilingEnabled) == 2,
|
|
1011
|
+
"Expected setProfilingEnabled(...) to have 2 parameters");
|
|
1012
|
+
|
|
1013
|
+
return bridging::callFromJs<void>(
|
|
1014
|
+
rt, &T::setProfilingEnabled, jsInvoker_, instance_, std::move(enabled));
|
|
1015
|
+
}
|
|
1016
|
+
void setHotLoadingEnabled(jsi::Runtime &rt, bool enabled) override {
|
|
1017
|
+
static_assert(
|
|
1018
|
+
bridging::getParameterCount(&T::setHotLoadingEnabled) == 2,
|
|
1019
|
+
"Expected setHotLoadingEnabled(...) to have 2 parameters");
|
|
1020
|
+
|
|
1021
|
+
return bridging::callFromJs<void>(
|
|
1022
|
+
rt, &T::setHotLoadingEnabled, jsInvoker_, instance_, std::move(enabled));
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
private:
|
|
1026
|
+
T *instance_;
|
|
1027
|
+
};
|
|
1028
|
+
|
|
1029
|
+
Delegate delegate_;
|
|
1030
|
+
};
|
|
1031
|
+
|
|
1032
|
+
class JSI_EXPORT NativeRedBoxCxxSpecJSI : public TurboModule {
|
|
1033
|
+
protected:
|
|
1034
|
+
NativeRedBoxCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
1035
|
+
|
|
1036
|
+
public:
|
|
1037
|
+
virtual void setExtraData(jsi::Runtime &rt, jsi::Object extraData, jsi::String forIdentifier) = 0;
|
|
1038
|
+
virtual void dismiss(jsi::Runtime &rt) = 0;
|
|
1039
|
+
|
|
1040
|
+
};
|
|
1041
|
+
|
|
1042
|
+
template <typename T>
|
|
1043
|
+
class JSI_EXPORT NativeRedBoxCxxSpec : public TurboModule {
|
|
1044
|
+
public:
|
|
1045
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
1046
|
+
return delegate_.get(rt, propName);
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
protected:
|
|
1050
|
+
NativeRedBoxCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
1051
|
+
: TurboModule("RedBox", jsInvoker),
|
|
1052
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
1053
|
+
|
|
1054
|
+
private:
|
|
1055
|
+
class Delegate : public NativeRedBoxCxxSpecJSI {
|
|
1056
|
+
public:
|
|
1057
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
1058
|
+
NativeRedBoxCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
1059
|
+
|
|
1060
|
+
void setExtraData(jsi::Runtime &rt, jsi::Object extraData, jsi::String forIdentifier) override {
|
|
1061
|
+
static_assert(
|
|
1062
|
+
bridging::getParameterCount(&T::setExtraData) == 3,
|
|
1063
|
+
"Expected setExtraData(...) to have 3 parameters");
|
|
1064
|
+
|
|
1065
|
+
return bridging::callFromJs<void>(
|
|
1066
|
+
rt, &T::setExtraData, jsInvoker_, instance_, std::move(extraData), std::move(forIdentifier));
|
|
1067
|
+
}
|
|
1068
|
+
void dismiss(jsi::Runtime &rt) override {
|
|
1069
|
+
static_assert(
|
|
1070
|
+
bridging::getParameterCount(&T::dismiss) == 1,
|
|
1071
|
+
"Expected dismiss(...) to have 1 parameters");
|
|
1072
|
+
|
|
1073
|
+
return bridging::callFromJs<void>(
|
|
1074
|
+
rt, &T::dismiss, jsInvoker_, instance_);
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
private:
|
|
1078
|
+
T *instance_;
|
|
1079
|
+
};
|
|
1080
|
+
|
|
1081
|
+
Delegate delegate_;
|
|
1082
|
+
};
|
|
1083
|
+
|
|
1084
|
+
class JSI_EXPORT NativeAnimationsDebugModuleCxxSpecJSI : public TurboModule {
|
|
1085
|
+
protected:
|
|
1086
|
+
NativeAnimationsDebugModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
1087
|
+
|
|
1088
|
+
public:
|
|
1089
|
+
virtual void startRecordingFps(jsi::Runtime &rt) = 0;
|
|
1090
|
+
virtual void stopRecordingFps(jsi::Runtime &rt, double animationStopTimeMs) = 0;
|
|
1091
|
+
|
|
1092
|
+
};
|
|
1093
|
+
|
|
1094
|
+
template <typename T>
|
|
1095
|
+
class JSI_EXPORT NativeAnimationsDebugModuleCxxSpec : public TurboModule {
|
|
1096
|
+
public:
|
|
1097
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
1098
|
+
return delegate_.get(rt, propName);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
protected:
|
|
1102
|
+
NativeAnimationsDebugModuleCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
1103
|
+
: TurboModule("AnimationsDebugModule", jsInvoker),
|
|
1104
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
1105
|
+
|
|
1106
|
+
private:
|
|
1107
|
+
class Delegate : public NativeAnimationsDebugModuleCxxSpecJSI {
|
|
1108
|
+
public:
|
|
1109
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
1110
|
+
NativeAnimationsDebugModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
1111
|
+
|
|
1112
|
+
void startRecordingFps(jsi::Runtime &rt) override {
|
|
1113
|
+
static_assert(
|
|
1114
|
+
bridging::getParameterCount(&T::startRecordingFps) == 1,
|
|
1115
|
+
"Expected startRecordingFps(...) to have 1 parameters");
|
|
1116
|
+
|
|
1117
|
+
return bridging::callFromJs<void>(
|
|
1118
|
+
rt, &T::startRecordingFps, jsInvoker_, instance_);
|
|
1119
|
+
}
|
|
1120
|
+
void stopRecordingFps(jsi::Runtime &rt, double animationStopTimeMs) override {
|
|
1121
|
+
static_assert(
|
|
1122
|
+
bridging::getParameterCount(&T::stopRecordingFps) == 2,
|
|
1123
|
+
"Expected stopRecordingFps(...) to have 2 parameters");
|
|
1124
|
+
|
|
1125
|
+
return bridging::callFromJs<void>(
|
|
1126
|
+
rt, &T::stopRecordingFps, jsInvoker_, instance_, std::move(animationStopTimeMs));
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
private:
|
|
1130
|
+
T *instance_;
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1133
|
+
Delegate delegate_;
|
|
1134
|
+
};
|
|
1135
|
+
|
|
1136
|
+
class JSI_EXPORT NativeLogBoxCxxSpecJSI : public TurboModule {
|
|
1137
|
+
protected:
|
|
1138
|
+
NativeLogBoxCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
1139
|
+
|
|
1140
|
+
public:
|
|
1141
|
+
virtual void show(jsi::Runtime &rt) = 0;
|
|
1142
|
+
virtual void hide(jsi::Runtime &rt) = 0;
|
|
1143
|
+
|
|
1144
|
+
};
|
|
1145
|
+
|
|
1146
|
+
template <typename T>
|
|
1147
|
+
class JSI_EXPORT NativeLogBoxCxxSpec : public TurboModule {
|
|
1148
|
+
public:
|
|
1149
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
1150
|
+
return delegate_.get(rt, propName);
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
protected:
|
|
1154
|
+
NativeLogBoxCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
1155
|
+
: TurboModule("LogBox", jsInvoker),
|
|
1156
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
1157
|
+
|
|
1158
|
+
private:
|
|
1159
|
+
class Delegate : public NativeLogBoxCxxSpecJSI {
|
|
1160
|
+
public:
|
|
1161
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
1162
|
+
NativeLogBoxCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
1163
|
+
|
|
1164
|
+
void show(jsi::Runtime &rt) override {
|
|
1165
|
+
static_assert(
|
|
1166
|
+
bridging::getParameterCount(&T::show) == 1,
|
|
1167
|
+
"Expected show(...) to have 1 parameters");
|
|
1168
|
+
|
|
1169
|
+
return bridging::callFromJs<void>(
|
|
1170
|
+
rt, &T::show, jsInvoker_, instance_);
|
|
1171
|
+
}
|
|
1172
|
+
void hide(jsi::Runtime &rt) override {
|
|
1173
|
+
static_assert(
|
|
1174
|
+
bridging::getParameterCount(&T::hide) == 1,
|
|
1175
|
+
"Expected hide(...) to have 1 parameters");
|
|
1176
|
+
|
|
1177
|
+
return bridging::callFromJs<void>(
|
|
1178
|
+
rt, &T::hide, jsInvoker_, instance_);
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
private:
|
|
1182
|
+
T *instance_;
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
Delegate delegate_;
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1188
|
+
class JSI_EXPORT NativeDeviceEventManagerCxxSpecJSI : public TurboModule {
|
|
1189
|
+
protected:
|
|
1190
|
+
NativeDeviceEventManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
1191
|
+
|
|
1192
|
+
public:
|
|
1193
|
+
virtual void invokeDefaultBackPressHandler(jsi::Runtime &rt) = 0;
|
|
1194
|
+
|
|
1195
|
+
};
|
|
1196
|
+
|
|
1197
|
+
template <typename T>
|
|
1198
|
+
class JSI_EXPORT NativeDeviceEventManagerCxxSpec : public TurboModule {
|
|
1199
|
+
public:
|
|
1200
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
1201
|
+
return delegate_.get(rt, propName);
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
protected:
|
|
1205
|
+
NativeDeviceEventManagerCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
1206
|
+
: TurboModule("DeviceEventManager", jsInvoker),
|
|
1207
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
1208
|
+
|
|
1209
|
+
private:
|
|
1210
|
+
class Delegate : public NativeDeviceEventManagerCxxSpecJSI {
|
|
1211
|
+
public:
|
|
1212
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
1213
|
+
NativeDeviceEventManagerCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
1214
|
+
|
|
1215
|
+
void invokeDefaultBackPressHandler(jsi::Runtime &rt) override {
|
|
1216
|
+
static_assert(
|
|
1217
|
+
bridging::getParameterCount(&T::invokeDefaultBackPressHandler) == 1,
|
|
1218
|
+
"Expected invokeDefaultBackPressHandler(...) to have 1 parameters");
|
|
1219
|
+
|
|
1220
|
+
return bridging::callFromJs<void>(
|
|
1221
|
+
rt, &T::invokeDefaultBackPressHandler, jsInvoker_, instance_);
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
private:
|
|
1225
|
+
T *instance_;
|
|
1226
|
+
};
|
|
1227
|
+
|
|
1228
|
+
Delegate delegate_;
|
|
1229
|
+
};
|
|
1230
|
+
|
|
1231
|
+
class JSI_EXPORT NativeDevSettingsCxxSpecJSI : public TurboModule {
|
|
1232
|
+
protected:
|
|
1233
|
+
NativeDevSettingsCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
1234
|
+
|
|
1235
|
+
public:
|
|
1236
|
+
virtual void reload(jsi::Runtime &rt) = 0;
|
|
1237
|
+
virtual void reloadWithReason(jsi::Runtime &rt, jsi::String reason) = 0;
|
|
1238
|
+
virtual void onFastRefresh(jsi::Runtime &rt) = 0;
|
|
1239
|
+
virtual void setHotLoadingEnabled(jsi::Runtime &rt, bool isHotLoadingEnabled) = 0;
|
|
1240
|
+
virtual void setIsDebuggingRemotely(jsi::Runtime &rt, bool isDebuggingRemotelyEnabled) = 0;
|
|
1241
|
+
virtual void setProfilingEnabled(jsi::Runtime &rt, bool isProfilingEnabled) = 0;
|
|
1242
|
+
virtual void toggleElementInspector(jsi::Runtime &rt) = 0;
|
|
1243
|
+
virtual void addMenuItem(jsi::Runtime &rt, jsi::String title) = 0;
|
|
1244
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
|
|
1245
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
1246
|
+
virtual void setIsShakeToShowDevMenuEnabled(jsi::Runtime &rt, bool enabled) = 0;
|
|
1247
|
+
|
|
1248
|
+
};
|
|
1249
|
+
|
|
1250
|
+
template <typename T>
|
|
1251
|
+
class JSI_EXPORT NativeDevSettingsCxxSpec : public TurboModule {
|
|
1252
|
+
public:
|
|
1253
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
1254
|
+
return delegate_.get(rt, propName);
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
protected:
|
|
1258
|
+
NativeDevSettingsCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
1259
|
+
: TurboModule("DevSettings", jsInvoker),
|
|
1260
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
1261
|
+
|
|
1262
|
+
private:
|
|
1263
|
+
class Delegate : public NativeDevSettingsCxxSpecJSI {
|
|
1264
|
+
public:
|
|
1265
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
1266
|
+
NativeDevSettingsCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
1267
|
+
|
|
1268
|
+
void reload(jsi::Runtime &rt) override {
|
|
1269
|
+
static_assert(
|
|
1270
|
+
bridging::getParameterCount(&T::reload) == 1,
|
|
1271
|
+
"Expected reload(...) to have 1 parameters");
|
|
1272
|
+
|
|
1273
|
+
return bridging::callFromJs<void>(
|
|
1274
|
+
rt, &T::reload, jsInvoker_, instance_);
|
|
1275
|
+
}
|
|
1276
|
+
void reloadWithReason(jsi::Runtime &rt, jsi::String reason) override {
|
|
1277
|
+
static_assert(
|
|
1278
|
+
bridging::getParameterCount(&T::reloadWithReason) == 2,
|
|
1279
|
+
"Expected reloadWithReason(...) to have 2 parameters");
|
|
1280
|
+
|
|
1281
|
+
return bridging::callFromJs<void>(
|
|
1282
|
+
rt, &T::reloadWithReason, jsInvoker_, instance_, std::move(reason));
|
|
1283
|
+
}
|
|
1284
|
+
void onFastRefresh(jsi::Runtime &rt) override {
|
|
1285
|
+
static_assert(
|
|
1286
|
+
bridging::getParameterCount(&T::onFastRefresh) == 1,
|
|
1287
|
+
"Expected onFastRefresh(...) to have 1 parameters");
|
|
1288
|
+
|
|
1289
|
+
return bridging::callFromJs<void>(
|
|
1290
|
+
rt, &T::onFastRefresh, jsInvoker_, instance_);
|
|
1291
|
+
}
|
|
1292
|
+
void setHotLoadingEnabled(jsi::Runtime &rt, bool isHotLoadingEnabled) override {
|
|
1293
|
+
static_assert(
|
|
1294
|
+
bridging::getParameterCount(&T::setHotLoadingEnabled) == 2,
|
|
1295
|
+
"Expected setHotLoadingEnabled(...) to have 2 parameters");
|
|
1296
|
+
|
|
1297
|
+
return bridging::callFromJs<void>(
|
|
1298
|
+
rt, &T::setHotLoadingEnabled, jsInvoker_, instance_, std::move(isHotLoadingEnabled));
|
|
1299
|
+
}
|
|
1300
|
+
void setIsDebuggingRemotely(jsi::Runtime &rt, bool isDebuggingRemotelyEnabled) override {
|
|
1301
|
+
static_assert(
|
|
1302
|
+
bridging::getParameterCount(&T::setIsDebuggingRemotely) == 2,
|
|
1303
|
+
"Expected setIsDebuggingRemotely(...) to have 2 parameters");
|
|
1304
|
+
|
|
1305
|
+
return bridging::callFromJs<void>(
|
|
1306
|
+
rt, &T::setIsDebuggingRemotely, jsInvoker_, instance_, std::move(isDebuggingRemotelyEnabled));
|
|
1307
|
+
}
|
|
1308
|
+
void setProfilingEnabled(jsi::Runtime &rt, bool isProfilingEnabled) override {
|
|
1309
|
+
static_assert(
|
|
1310
|
+
bridging::getParameterCount(&T::setProfilingEnabled) == 2,
|
|
1311
|
+
"Expected setProfilingEnabled(...) to have 2 parameters");
|
|
1312
|
+
|
|
1313
|
+
return bridging::callFromJs<void>(
|
|
1314
|
+
rt, &T::setProfilingEnabled, jsInvoker_, instance_, std::move(isProfilingEnabled));
|
|
1315
|
+
}
|
|
1316
|
+
void toggleElementInspector(jsi::Runtime &rt) override {
|
|
1317
|
+
static_assert(
|
|
1318
|
+
bridging::getParameterCount(&T::toggleElementInspector) == 1,
|
|
1319
|
+
"Expected toggleElementInspector(...) to have 1 parameters");
|
|
1320
|
+
|
|
1321
|
+
return bridging::callFromJs<void>(
|
|
1322
|
+
rt, &T::toggleElementInspector, jsInvoker_, instance_);
|
|
1323
|
+
}
|
|
1324
|
+
void addMenuItem(jsi::Runtime &rt, jsi::String title) override {
|
|
1325
|
+
static_assert(
|
|
1326
|
+
bridging::getParameterCount(&T::addMenuItem) == 2,
|
|
1327
|
+
"Expected addMenuItem(...) to have 2 parameters");
|
|
1328
|
+
|
|
1329
|
+
return bridging::callFromJs<void>(
|
|
1330
|
+
rt, &T::addMenuItem, jsInvoker_, instance_, std::move(title));
|
|
1331
|
+
}
|
|
1332
|
+
void addListener(jsi::Runtime &rt, jsi::String eventName) override {
|
|
1333
|
+
static_assert(
|
|
1334
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
1335
|
+
"Expected addListener(...) to have 2 parameters");
|
|
1336
|
+
|
|
1337
|
+
return bridging::callFromJs<void>(
|
|
1338
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
|
|
1339
|
+
}
|
|
1340
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
1341
|
+
static_assert(
|
|
1342
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
1343
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
1344
|
+
|
|
1345
|
+
return bridging::callFromJs<void>(
|
|
1346
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
1347
|
+
}
|
|
1348
|
+
void setIsShakeToShowDevMenuEnabled(jsi::Runtime &rt, bool enabled) override {
|
|
1349
|
+
static_assert(
|
|
1350
|
+
bridging::getParameterCount(&T::setIsShakeToShowDevMenuEnabled) == 2,
|
|
1351
|
+
"Expected setIsShakeToShowDevMenuEnabled(...) to have 2 parameters");
|
|
1352
|
+
|
|
1353
|
+
return bridging::callFromJs<void>(
|
|
1354
|
+
rt, &T::setIsShakeToShowDevMenuEnabled, jsInvoker_, instance_, std::move(enabled));
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
private:
|
|
1358
|
+
T *instance_;
|
|
1359
|
+
};
|
|
1360
|
+
|
|
1361
|
+
Delegate delegate_;
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
class JSI_EXPORT NativeNetworkingAndroidCxxSpecJSI : public TurboModule {
|
|
1365
|
+
protected:
|
|
1366
|
+
NativeNetworkingAndroidCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
1367
|
+
|
|
1368
|
+
public:
|
|
1369
|
+
virtual void sendRequest(jsi::Runtime &rt, jsi::String method, jsi::String url, double requestId, jsi::Array headers, jsi::Object data, jsi::String responseType, bool useIncrementalUpdates, double timeout, bool withCredentials) = 0;
|
|
1370
|
+
virtual void abortRequest(jsi::Runtime &rt, double requestId) = 0;
|
|
1371
|
+
virtual void clearCookies(jsi::Runtime &rt, jsi::Function callback) = 0;
|
|
1372
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
|
|
1373
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
1374
|
+
|
|
1375
|
+
};
|
|
1376
|
+
|
|
1377
|
+
template <typename T>
|
|
1378
|
+
class JSI_EXPORT NativeNetworkingAndroidCxxSpec : public TurboModule {
|
|
1379
|
+
public:
|
|
1380
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
1381
|
+
return delegate_.get(rt, propName);
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
protected:
|
|
1385
|
+
NativeNetworkingAndroidCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
1386
|
+
: TurboModule("Networking", jsInvoker),
|
|
1387
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
1388
|
+
|
|
1389
|
+
private:
|
|
1390
|
+
class Delegate : public NativeNetworkingAndroidCxxSpecJSI {
|
|
1391
|
+
public:
|
|
1392
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
1393
|
+
NativeNetworkingAndroidCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
1394
|
+
|
|
1395
|
+
void sendRequest(jsi::Runtime &rt, jsi::String method, jsi::String url, double requestId, jsi::Array headers, jsi::Object data, jsi::String responseType, bool useIncrementalUpdates, double timeout, bool withCredentials) override {
|
|
1396
|
+
static_assert(
|
|
1397
|
+
bridging::getParameterCount(&T::sendRequest) == 10,
|
|
1398
|
+
"Expected sendRequest(...) to have 10 parameters");
|
|
1399
|
+
|
|
1400
|
+
return bridging::callFromJs<void>(
|
|
1401
|
+
rt, &T::sendRequest, jsInvoker_, instance_, std::move(method), std::move(url), std::move(requestId), std::move(headers), std::move(data), std::move(responseType), std::move(useIncrementalUpdates), std::move(timeout), std::move(withCredentials));
|
|
1402
|
+
}
|
|
1403
|
+
void abortRequest(jsi::Runtime &rt, double requestId) override {
|
|
1404
|
+
static_assert(
|
|
1405
|
+
bridging::getParameterCount(&T::abortRequest) == 2,
|
|
1406
|
+
"Expected abortRequest(...) to have 2 parameters");
|
|
1407
|
+
|
|
1408
|
+
return bridging::callFromJs<void>(
|
|
1409
|
+
rt, &T::abortRequest, jsInvoker_, instance_, std::move(requestId));
|
|
1410
|
+
}
|
|
1411
|
+
void clearCookies(jsi::Runtime &rt, jsi::Function callback) override {
|
|
1412
|
+
static_assert(
|
|
1413
|
+
bridging::getParameterCount(&T::clearCookies) == 2,
|
|
1414
|
+
"Expected clearCookies(...) to have 2 parameters");
|
|
1415
|
+
|
|
1416
|
+
return bridging::callFromJs<void>(
|
|
1417
|
+
rt, &T::clearCookies, jsInvoker_, instance_, std::move(callback));
|
|
1418
|
+
}
|
|
1419
|
+
void addListener(jsi::Runtime &rt, jsi::String eventName) override {
|
|
1420
|
+
static_assert(
|
|
1421
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
1422
|
+
"Expected addListener(...) to have 2 parameters");
|
|
1423
|
+
|
|
1424
|
+
return bridging::callFromJs<void>(
|
|
1425
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
|
|
1426
|
+
}
|
|
1427
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
1428
|
+
static_assert(
|
|
1429
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
1430
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
1431
|
+
|
|
1432
|
+
return bridging::callFromJs<void>(
|
|
1433
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
private:
|
|
1437
|
+
T *instance_;
|
|
1438
|
+
};
|
|
1439
|
+
|
|
1440
|
+
Delegate delegate_;
|
|
1441
|
+
};
|
|
1442
|
+
|
|
1443
|
+
class JSI_EXPORT NativeNetworkingIOSCxxSpecJSI : public TurboModule {
|
|
1444
|
+
protected:
|
|
1445
|
+
NativeNetworkingIOSCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
1446
|
+
|
|
1447
|
+
public:
|
|
1448
|
+
virtual void sendRequest(jsi::Runtime &rt, jsi::Object query, jsi::Function callback) = 0;
|
|
1449
|
+
virtual void abortRequest(jsi::Runtime &rt, double requestId) = 0;
|
|
1450
|
+
virtual void clearCookies(jsi::Runtime &rt, jsi::Function callback) = 0;
|
|
1451
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
|
|
1452
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
1453
|
+
|
|
1454
|
+
};
|
|
1455
|
+
|
|
1456
|
+
template <typename T>
|
|
1457
|
+
class JSI_EXPORT NativeNetworkingIOSCxxSpec : public TurboModule {
|
|
1458
|
+
public:
|
|
1459
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
1460
|
+
return delegate_.get(rt, propName);
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
protected:
|
|
1464
|
+
NativeNetworkingIOSCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
1465
|
+
: TurboModule("Networking", jsInvoker),
|
|
1466
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
1467
|
+
|
|
1468
|
+
private:
|
|
1469
|
+
class Delegate : public NativeNetworkingIOSCxxSpecJSI {
|
|
1470
|
+
public:
|
|
1471
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
1472
|
+
NativeNetworkingIOSCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
1473
|
+
|
|
1474
|
+
void sendRequest(jsi::Runtime &rt, jsi::Object query, jsi::Function callback) override {
|
|
1475
|
+
static_assert(
|
|
1476
|
+
bridging::getParameterCount(&T::sendRequest) == 3,
|
|
1477
|
+
"Expected sendRequest(...) to have 3 parameters");
|
|
1478
|
+
|
|
1479
|
+
return bridging::callFromJs<void>(
|
|
1480
|
+
rt, &T::sendRequest, jsInvoker_, instance_, std::move(query), std::move(callback));
|
|
1481
|
+
}
|
|
1482
|
+
void abortRequest(jsi::Runtime &rt, double requestId) override {
|
|
1483
|
+
static_assert(
|
|
1484
|
+
bridging::getParameterCount(&T::abortRequest) == 2,
|
|
1485
|
+
"Expected abortRequest(...) to have 2 parameters");
|
|
1486
|
+
|
|
1487
|
+
return bridging::callFromJs<void>(
|
|
1488
|
+
rt, &T::abortRequest, jsInvoker_, instance_, std::move(requestId));
|
|
1489
|
+
}
|
|
1490
|
+
void clearCookies(jsi::Runtime &rt, jsi::Function callback) override {
|
|
1491
|
+
static_assert(
|
|
1492
|
+
bridging::getParameterCount(&T::clearCookies) == 2,
|
|
1493
|
+
"Expected clearCookies(...) to have 2 parameters");
|
|
1494
|
+
|
|
1495
|
+
return bridging::callFromJs<void>(
|
|
1496
|
+
rt, &T::clearCookies, jsInvoker_, instance_, std::move(callback));
|
|
1497
|
+
}
|
|
1498
|
+
void addListener(jsi::Runtime &rt, jsi::String eventName) override {
|
|
1499
|
+
static_assert(
|
|
1500
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
1501
|
+
"Expected addListener(...) to have 2 parameters");
|
|
1502
|
+
|
|
1503
|
+
return bridging::callFromJs<void>(
|
|
1504
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
|
|
1505
|
+
}
|
|
1506
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
1507
|
+
static_assert(
|
|
1508
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
1509
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
1510
|
+
|
|
1511
|
+
return bridging::callFromJs<void>(
|
|
1512
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
private:
|
|
1516
|
+
T *instance_;
|
|
1517
|
+
};
|
|
1518
|
+
|
|
1519
|
+
Delegate delegate_;
|
|
1520
|
+
};
|
|
1521
|
+
|
|
1522
|
+
class JSI_EXPORT NativeImageLoaderIOSCxxSpecJSI : public TurboModule {
|
|
1523
|
+
protected:
|
|
1524
|
+
NativeImageLoaderIOSCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
1525
|
+
|
|
1526
|
+
public:
|
|
1527
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
1528
|
+
virtual jsi::Value getSize(jsi::Runtime &rt, jsi::String uri) = 0;
|
|
1529
|
+
virtual jsi::Value getSizeWithHeaders(jsi::Runtime &rt, jsi::String uri, jsi::Object headers) = 0;
|
|
1530
|
+
virtual jsi::Value prefetchImage(jsi::Runtime &rt, jsi::String uri) = 0;
|
|
1531
|
+
virtual jsi::Value prefetchImageWithMetadata(jsi::Runtime &rt, jsi::String uri, jsi::String queryRootName, double rootTag) = 0;
|
|
1532
|
+
virtual jsi::Value queryCache(jsi::Runtime &rt, jsi::Array uris) = 0;
|
|
1533
|
+
|
|
1534
|
+
};
|
|
1535
|
+
|
|
1536
|
+
template <typename T>
|
|
1537
|
+
class JSI_EXPORT NativeImageLoaderIOSCxxSpec : public TurboModule {
|
|
1538
|
+
public:
|
|
1539
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
1540
|
+
return delegate_.get(rt, propName);
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
protected:
|
|
1544
|
+
NativeImageLoaderIOSCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
1545
|
+
: TurboModule("ImageLoader", jsInvoker),
|
|
1546
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
1547
|
+
|
|
1548
|
+
private:
|
|
1549
|
+
class Delegate : public NativeImageLoaderIOSCxxSpecJSI {
|
|
1550
|
+
public:
|
|
1551
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
1552
|
+
NativeImageLoaderIOSCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
1553
|
+
|
|
1554
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
1555
|
+
static_assert(
|
|
1556
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
1557
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
1558
|
+
|
|
1559
|
+
return bridging::callFromJs<jsi::Object>(
|
|
1560
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
1561
|
+
}
|
|
1562
|
+
jsi::Value getSize(jsi::Runtime &rt, jsi::String uri) override {
|
|
1563
|
+
static_assert(
|
|
1564
|
+
bridging::getParameterCount(&T::getSize) == 2,
|
|
1565
|
+
"Expected getSize(...) to have 2 parameters");
|
|
1566
|
+
|
|
1567
|
+
return bridging::callFromJs<jsi::Value>(
|
|
1568
|
+
rt, &T::getSize, jsInvoker_, instance_, std::move(uri));
|
|
1569
|
+
}
|
|
1570
|
+
jsi::Value getSizeWithHeaders(jsi::Runtime &rt, jsi::String uri, jsi::Object headers) override {
|
|
1571
|
+
static_assert(
|
|
1572
|
+
bridging::getParameterCount(&T::getSizeWithHeaders) == 3,
|
|
1573
|
+
"Expected getSizeWithHeaders(...) to have 3 parameters");
|
|
1574
|
+
|
|
1575
|
+
return bridging::callFromJs<jsi::Value>(
|
|
1576
|
+
rt, &T::getSizeWithHeaders, jsInvoker_, instance_, std::move(uri), std::move(headers));
|
|
1577
|
+
}
|
|
1578
|
+
jsi::Value prefetchImage(jsi::Runtime &rt, jsi::String uri) override {
|
|
1579
|
+
static_assert(
|
|
1580
|
+
bridging::getParameterCount(&T::prefetchImage) == 2,
|
|
1581
|
+
"Expected prefetchImage(...) to have 2 parameters");
|
|
1582
|
+
|
|
1583
|
+
return bridging::callFromJs<jsi::Value>(
|
|
1584
|
+
rt, &T::prefetchImage, jsInvoker_, instance_, std::move(uri));
|
|
1585
|
+
}
|
|
1586
|
+
jsi::Value prefetchImageWithMetadata(jsi::Runtime &rt, jsi::String uri, jsi::String queryRootName, double rootTag) override {
|
|
1587
|
+
static_assert(
|
|
1588
|
+
bridging::getParameterCount(&T::prefetchImageWithMetadata) == 4,
|
|
1589
|
+
"Expected prefetchImageWithMetadata(...) to have 4 parameters");
|
|
1590
|
+
|
|
1591
|
+
return bridging::callFromJs<jsi::Value>(
|
|
1592
|
+
rt, &T::prefetchImageWithMetadata, jsInvoker_, instance_, std::move(uri), std::move(queryRootName), std::move(rootTag));
|
|
1593
|
+
}
|
|
1594
|
+
jsi::Value queryCache(jsi::Runtime &rt, jsi::Array uris) override {
|
|
1595
|
+
static_assert(
|
|
1596
|
+
bridging::getParameterCount(&T::queryCache) == 2,
|
|
1597
|
+
"Expected queryCache(...) to have 2 parameters");
|
|
1598
|
+
|
|
1599
|
+
return bridging::callFromJs<jsi::Value>(
|
|
1600
|
+
rt, &T::queryCache, jsInvoker_, instance_, std::move(uris));
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
private:
|
|
1604
|
+
T *instance_;
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
Delegate delegate_;
|
|
1608
|
+
};
|
|
1609
|
+
|
|
1610
|
+
#pragma mark - ImageEditingManagerBaseOptions
|
|
1611
|
+
|
|
1612
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4>
|
|
1613
|
+
struct ImageEditingManagerBaseOptions {
|
|
1614
|
+
P0 offset;
|
|
1615
|
+
P1 size;
|
|
1616
|
+
P2 displaySize;
|
|
1617
|
+
P3 resizeMode;
|
|
1618
|
+
P4 allowExternalStorage;
|
|
1619
|
+
bool operator==(const ImageEditingManagerBaseOptions &other) const {
|
|
1620
|
+
return offset == other.offset && size == other.size && displaySize == other.displaySize && resizeMode == other.resizeMode && allowExternalStorage == other.allowExternalStorage;
|
|
1621
|
+
}
|
|
1622
|
+
};
|
|
1623
|
+
|
|
1624
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4>
|
|
1625
|
+
struct ImageEditingManagerBaseOptionsBridging {
|
|
1626
|
+
static ImageEditingManagerBaseOptions<P0, P1, P2, P3, P4> fromJs(
|
|
1627
|
+
jsi::Runtime &rt,
|
|
1628
|
+
const jsi::Object &value,
|
|
1629
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
1630
|
+
ImageEditingManagerBaseOptions<P0, P1, P2, P3, P4> result{
|
|
1631
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "offset"), jsInvoker),
|
|
1632
|
+
bridging::fromJs<P1>(rt, value.getProperty(rt, "size"), jsInvoker),
|
|
1633
|
+
bridging::fromJs<P2>(rt, value.getProperty(rt, "displaySize"), jsInvoker),
|
|
1634
|
+
bridging::fromJs<P3>(rt, value.getProperty(rt, "resizeMode"), jsInvoker),
|
|
1635
|
+
bridging::fromJs<P4>(rt, value.getProperty(rt, "allowExternalStorage"), jsInvoker)};
|
|
1636
|
+
return result;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
static jsi::Object toJs(
|
|
1640
|
+
jsi::Runtime &rt,
|
|
1641
|
+
const ImageEditingManagerBaseOptions<P0, P1, P2, P3, P4> &value) {
|
|
1642
|
+
auto result = facebook::jsi::Object(rt);
|
|
1643
|
+
result.setProperty(rt, "offset", bridging::toJs(rt, value.offset));
|
|
1644
|
+
result.setProperty(rt, "size", bridging::toJs(rt, value.size));
|
|
1645
|
+
if (value.displaySize) {
|
|
1646
|
+
result.setProperty(rt, "displaySize", bridging::toJs(rt, value.displaySize.value()));
|
|
1647
|
+
}
|
|
1648
|
+
if (value.resizeMode) {
|
|
1649
|
+
result.setProperty(rt, "resizeMode", bridging::toJs(rt, value.resizeMode.value()));
|
|
1650
|
+
}
|
|
1651
|
+
if (value.allowExternalStorage) {
|
|
1652
|
+
result.setProperty(rt, "allowExternalStorage", bridging::toJs(rt, value.allowExternalStorage.value()));
|
|
1653
|
+
}
|
|
1654
|
+
return result;
|
|
1655
|
+
}
|
|
1656
|
+
};
|
|
1657
|
+
|
|
1658
|
+
class JSI_EXPORT NativeImageEditorCxxSpecJSI : public TurboModule {
|
|
1659
|
+
protected:
|
|
1660
|
+
NativeImageEditorCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
1661
|
+
|
|
1662
|
+
public:
|
|
1663
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
1664
|
+
virtual void cropImage(jsi::Runtime &rt, jsi::String uri, jsi::Object cropData, jsi::Function successCallback, jsi::Function errorCallback) = 0;
|
|
1665
|
+
|
|
1666
|
+
};
|
|
1667
|
+
|
|
1668
|
+
template <typename T>
|
|
1669
|
+
class JSI_EXPORT NativeImageEditorCxxSpec : public TurboModule {
|
|
1670
|
+
public:
|
|
1671
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
1672
|
+
return delegate_.get(rt, propName);
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
protected:
|
|
1676
|
+
NativeImageEditorCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
1677
|
+
: TurboModule("ImageEditingManager", jsInvoker),
|
|
1678
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
1679
|
+
|
|
1680
|
+
private:
|
|
1681
|
+
class Delegate : public NativeImageEditorCxxSpecJSI {
|
|
1682
|
+
public:
|
|
1683
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
1684
|
+
NativeImageEditorCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
1685
|
+
|
|
1686
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
1687
|
+
static_assert(
|
|
1688
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
1689
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
1690
|
+
|
|
1691
|
+
return bridging::callFromJs<jsi::Object>(
|
|
1692
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
1693
|
+
}
|
|
1694
|
+
void cropImage(jsi::Runtime &rt, jsi::String uri, jsi::Object cropData, jsi::Function successCallback, jsi::Function errorCallback) override {
|
|
1695
|
+
static_assert(
|
|
1696
|
+
bridging::getParameterCount(&T::cropImage) == 5,
|
|
1697
|
+
"Expected cropImage(...) to have 5 parameters");
|
|
1698
|
+
|
|
1699
|
+
return bridging::callFromJs<void>(
|
|
1700
|
+
rt, &T::cropImage, jsInvoker_, instance_, std::move(uri), std::move(cropData), std::move(successCallback), std::move(errorCallback));
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
private:
|
|
1704
|
+
T *instance_;
|
|
1705
|
+
};
|
|
1706
|
+
|
|
1707
|
+
Delegate delegate_;
|
|
1708
|
+
};
|
|
1709
|
+
|
|
1710
|
+
class JSI_EXPORT NativeImageStoreIOSCxxSpecJSI : public TurboModule {
|
|
1711
|
+
protected:
|
|
1712
|
+
NativeImageStoreIOSCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
1713
|
+
|
|
1714
|
+
public:
|
|
1715
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
1716
|
+
virtual void getBase64ForTag(jsi::Runtime &rt, jsi::String uri, jsi::Function successCallback, jsi::Function errorCallback) = 0;
|
|
1717
|
+
virtual void hasImageForTag(jsi::Runtime &rt, jsi::String uri, jsi::Function callback) = 0;
|
|
1718
|
+
virtual void removeImageForTag(jsi::Runtime &rt, jsi::String uri) = 0;
|
|
1719
|
+
virtual void addImageFromBase64(jsi::Runtime &rt, jsi::String base64ImageData, jsi::Function successCallback, jsi::Function errorCallback) = 0;
|
|
1720
|
+
|
|
1721
|
+
};
|
|
1722
|
+
|
|
1723
|
+
template <typename T>
|
|
1724
|
+
class JSI_EXPORT NativeImageStoreIOSCxxSpec : public TurboModule {
|
|
1725
|
+
public:
|
|
1726
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
1727
|
+
return delegate_.get(rt, propName);
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
protected:
|
|
1731
|
+
NativeImageStoreIOSCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
1732
|
+
: TurboModule("ImageStoreManager", jsInvoker),
|
|
1733
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
1734
|
+
|
|
1735
|
+
private:
|
|
1736
|
+
class Delegate : public NativeImageStoreIOSCxxSpecJSI {
|
|
1737
|
+
public:
|
|
1738
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
1739
|
+
NativeImageStoreIOSCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
1740
|
+
|
|
1741
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
1742
|
+
static_assert(
|
|
1743
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
1744
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
1745
|
+
|
|
1746
|
+
return bridging::callFromJs<jsi::Object>(
|
|
1747
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
1748
|
+
}
|
|
1749
|
+
void getBase64ForTag(jsi::Runtime &rt, jsi::String uri, jsi::Function successCallback, jsi::Function errorCallback) override {
|
|
1750
|
+
static_assert(
|
|
1751
|
+
bridging::getParameterCount(&T::getBase64ForTag) == 4,
|
|
1752
|
+
"Expected getBase64ForTag(...) to have 4 parameters");
|
|
1753
|
+
|
|
1754
|
+
return bridging::callFromJs<void>(
|
|
1755
|
+
rt, &T::getBase64ForTag, jsInvoker_, instance_, std::move(uri), std::move(successCallback), std::move(errorCallback));
|
|
1756
|
+
}
|
|
1757
|
+
void hasImageForTag(jsi::Runtime &rt, jsi::String uri, jsi::Function callback) override {
|
|
1758
|
+
static_assert(
|
|
1759
|
+
bridging::getParameterCount(&T::hasImageForTag) == 3,
|
|
1760
|
+
"Expected hasImageForTag(...) to have 3 parameters");
|
|
1761
|
+
|
|
1762
|
+
return bridging::callFromJs<void>(
|
|
1763
|
+
rt, &T::hasImageForTag, jsInvoker_, instance_, std::move(uri), std::move(callback));
|
|
1764
|
+
}
|
|
1765
|
+
void removeImageForTag(jsi::Runtime &rt, jsi::String uri) override {
|
|
1766
|
+
static_assert(
|
|
1767
|
+
bridging::getParameterCount(&T::removeImageForTag) == 2,
|
|
1768
|
+
"Expected removeImageForTag(...) to have 2 parameters");
|
|
1769
|
+
|
|
1770
|
+
return bridging::callFromJs<void>(
|
|
1771
|
+
rt, &T::removeImageForTag, jsInvoker_, instance_, std::move(uri));
|
|
1772
|
+
}
|
|
1773
|
+
void addImageFromBase64(jsi::Runtime &rt, jsi::String base64ImageData, jsi::Function successCallback, jsi::Function errorCallback) override {
|
|
1774
|
+
static_assert(
|
|
1775
|
+
bridging::getParameterCount(&T::addImageFromBase64) == 4,
|
|
1776
|
+
"Expected addImageFromBase64(...) to have 4 parameters");
|
|
1777
|
+
|
|
1778
|
+
return bridging::callFromJs<void>(
|
|
1779
|
+
rt, &T::addImageFromBase64, jsInvoker_, instance_, std::move(base64ImageData), std::move(successCallback), std::move(errorCallback));
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
private:
|
|
1783
|
+
T *instance_;
|
|
1784
|
+
};
|
|
1785
|
+
|
|
1786
|
+
Delegate delegate_;
|
|
1787
|
+
};
|
|
1788
|
+
|
|
1789
|
+
class JSI_EXPORT NativeImageLoaderAndroidCxxSpecJSI : public TurboModule {
|
|
1790
|
+
protected:
|
|
1791
|
+
NativeImageLoaderAndroidCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
1792
|
+
|
|
1793
|
+
public:
|
|
1794
|
+
virtual void abortRequest(jsi::Runtime &rt, double requestId) = 0;
|
|
1795
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
1796
|
+
virtual jsi::Value getSize(jsi::Runtime &rt, jsi::String uri) = 0;
|
|
1797
|
+
virtual jsi::Value getSizeWithHeaders(jsi::Runtime &rt, jsi::String uri, jsi::Object headers) = 0;
|
|
1798
|
+
virtual jsi::Value prefetchImage(jsi::Runtime &rt, jsi::String uri, double requestId) = 0;
|
|
1799
|
+
virtual jsi::Value queryCache(jsi::Runtime &rt, jsi::Array uris) = 0;
|
|
1800
|
+
|
|
1801
|
+
};
|
|
1802
|
+
|
|
1803
|
+
template <typename T>
|
|
1804
|
+
class JSI_EXPORT NativeImageLoaderAndroidCxxSpec : public TurboModule {
|
|
1805
|
+
public:
|
|
1806
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
1807
|
+
return delegate_.get(rt, propName);
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
protected:
|
|
1811
|
+
NativeImageLoaderAndroidCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
1812
|
+
: TurboModule("ImageLoader", jsInvoker),
|
|
1813
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
1814
|
+
|
|
1815
|
+
private:
|
|
1816
|
+
class Delegate : public NativeImageLoaderAndroidCxxSpecJSI {
|
|
1817
|
+
public:
|
|
1818
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
1819
|
+
NativeImageLoaderAndroidCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
1820
|
+
|
|
1821
|
+
void abortRequest(jsi::Runtime &rt, double requestId) override {
|
|
1822
|
+
static_assert(
|
|
1823
|
+
bridging::getParameterCount(&T::abortRequest) == 2,
|
|
1824
|
+
"Expected abortRequest(...) to have 2 parameters");
|
|
1825
|
+
|
|
1826
|
+
return bridging::callFromJs<void>(
|
|
1827
|
+
rt, &T::abortRequest, jsInvoker_, instance_, std::move(requestId));
|
|
1828
|
+
}
|
|
1829
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
1830
|
+
static_assert(
|
|
1831
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
1832
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
1833
|
+
|
|
1834
|
+
return bridging::callFromJs<jsi::Object>(
|
|
1835
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
1836
|
+
}
|
|
1837
|
+
jsi::Value getSize(jsi::Runtime &rt, jsi::String uri) override {
|
|
1838
|
+
static_assert(
|
|
1839
|
+
bridging::getParameterCount(&T::getSize) == 2,
|
|
1840
|
+
"Expected getSize(...) to have 2 parameters");
|
|
1841
|
+
|
|
1842
|
+
return bridging::callFromJs<jsi::Value>(
|
|
1843
|
+
rt, &T::getSize, jsInvoker_, instance_, std::move(uri));
|
|
1844
|
+
}
|
|
1845
|
+
jsi::Value getSizeWithHeaders(jsi::Runtime &rt, jsi::String uri, jsi::Object headers) override {
|
|
1846
|
+
static_assert(
|
|
1847
|
+
bridging::getParameterCount(&T::getSizeWithHeaders) == 3,
|
|
1848
|
+
"Expected getSizeWithHeaders(...) to have 3 parameters");
|
|
1849
|
+
|
|
1850
|
+
return bridging::callFromJs<jsi::Value>(
|
|
1851
|
+
rt, &T::getSizeWithHeaders, jsInvoker_, instance_, std::move(uri), std::move(headers));
|
|
1852
|
+
}
|
|
1853
|
+
jsi::Value prefetchImage(jsi::Runtime &rt, jsi::String uri, double requestId) override {
|
|
1854
|
+
static_assert(
|
|
1855
|
+
bridging::getParameterCount(&T::prefetchImage) == 3,
|
|
1856
|
+
"Expected prefetchImage(...) to have 3 parameters");
|
|
1857
|
+
|
|
1858
|
+
return bridging::callFromJs<jsi::Value>(
|
|
1859
|
+
rt, &T::prefetchImage, jsInvoker_, instance_, std::move(uri), std::move(requestId));
|
|
1860
|
+
}
|
|
1861
|
+
jsi::Value queryCache(jsi::Runtime &rt, jsi::Array uris) override {
|
|
1862
|
+
static_assert(
|
|
1863
|
+
bridging::getParameterCount(&T::queryCache) == 2,
|
|
1864
|
+
"Expected queryCache(...) to have 2 parameters");
|
|
1865
|
+
|
|
1866
|
+
return bridging::callFromJs<jsi::Value>(
|
|
1867
|
+
rt, &T::queryCache, jsInvoker_, instance_, std::move(uris));
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
private:
|
|
1871
|
+
T *instance_;
|
|
1872
|
+
};
|
|
1873
|
+
|
|
1874
|
+
Delegate delegate_;
|
|
1875
|
+
};
|
|
1876
|
+
|
|
1877
|
+
class JSI_EXPORT NativeImageStoreAndroidCxxSpecJSI : public TurboModule {
|
|
1878
|
+
protected:
|
|
1879
|
+
NativeImageStoreAndroidCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
1880
|
+
|
|
1881
|
+
public:
|
|
1882
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
1883
|
+
virtual void getBase64ForTag(jsi::Runtime &rt, jsi::String uri, jsi::Function successCallback, jsi::Function errorCallback) = 0;
|
|
1884
|
+
|
|
1885
|
+
};
|
|
1886
|
+
|
|
1887
|
+
template <typename T>
|
|
1888
|
+
class JSI_EXPORT NativeImageStoreAndroidCxxSpec : public TurboModule {
|
|
1889
|
+
public:
|
|
1890
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
1891
|
+
return delegate_.get(rt, propName);
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
protected:
|
|
1895
|
+
NativeImageStoreAndroidCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
1896
|
+
: TurboModule("ImageStoreManager", jsInvoker),
|
|
1897
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
1898
|
+
|
|
1899
|
+
private:
|
|
1900
|
+
class Delegate : public NativeImageStoreAndroidCxxSpecJSI {
|
|
1901
|
+
public:
|
|
1902
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
1903
|
+
NativeImageStoreAndroidCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
1904
|
+
|
|
1905
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
1906
|
+
static_assert(
|
|
1907
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
1908
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
1909
|
+
|
|
1910
|
+
return bridging::callFromJs<jsi::Object>(
|
|
1911
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
1912
|
+
}
|
|
1913
|
+
void getBase64ForTag(jsi::Runtime &rt, jsi::String uri, jsi::Function successCallback, jsi::Function errorCallback) override {
|
|
1914
|
+
static_assert(
|
|
1915
|
+
bridging::getParameterCount(&T::getBase64ForTag) == 4,
|
|
1916
|
+
"Expected getBase64ForTag(...) to have 4 parameters");
|
|
1917
|
+
|
|
1918
|
+
return bridging::callFromJs<void>(
|
|
1919
|
+
rt, &T::getBase64ForTag, jsInvoker_, instance_, std::move(uri), std::move(successCallback), std::move(errorCallback));
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
private:
|
|
1923
|
+
T *instance_;
|
|
1924
|
+
};
|
|
1925
|
+
|
|
1926
|
+
Delegate delegate_;
|
|
1927
|
+
};
|
|
1928
|
+
|
|
1929
|
+
#pragma mark - DeviceInfoBaseDisplayMetrics
|
|
1930
|
+
|
|
1931
|
+
template <typename P0, typename P1, typename P2, typename P3>
|
|
1932
|
+
struct DeviceInfoBaseDisplayMetrics {
|
|
1933
|
+
P0 width;
|
|
1934
|
+
P1 height;
|
|
1935
|
+
P2 scale;
|
|
1936
|
+
P3 fontScale;
|
|
1937
|
+
bool operator==(const DeviceInfoBaseDisplayMetrics &other) const {
|
|
1938
|
+
return width == other.width && height == other.height && scale == other.scale && fontScale == other.fontScale;
|
|
1939
|
+
}
|
|
1940
|
+
};
|
|
1941
|
+
|
|
1942
|
+
template <typename P0, typename P1, typename P2, typename P3>
|
|
1943
|
+
struct DeviceInfoBaseDisplayMetricsBridging {
|
|
1944
|
+
static DeviceInfoBaseDisplayMetrics<P0, P1, P2, P3> fromJs(
|
|
1945
|
+
jsi::Runtime &rt,
|
|
1946
|
+
const jsi::Object &value,
|
|
1947
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
1948
|
+
DeviceInfoBaseDisplayMetrics<P0, P1, P2, P3> result{
|
|
1949
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "width"), jsInvoker),
|
|
1950
|
+
bridging::fromJs<P1>(rt, value.getProperty(rt, "height"), jsInvoker),
|
|
1951
|
+
bridging::fromJs<P2>(rt, value.getProperty(rt, "scale"), jsInvoker),
|
|
1952
|
+
bridging::fromJs<P3>(rt, value.getProperty(rt, "fontScale"), jsInvoker)};
|
|
1953
|
+
return result;
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
static jsi::Object toJs(
|
|
1957
|
+
jsi::Runtime &rt,
|
|
1958
|
+
const DeviceInfoBaseDisplayMetrics<P0, P1, P2, P3> &value) {
|
|
1959
|
+
auto result = facebook::jsi::Object(rt);
|
|
1960
|
+
result.setProperty(rt, "width", bridging::toJs(rt, value.width));
|
|
1961
|
+
result.setProperty(rt, "height", bridging::toJs(rt, value.height));
|
|
1962
|
+
result.setProperty(rt, "scale", bridging::toJs(rt, value.scale));
|
|
1963
|
+
result.setProperty(rt, "fontScale", bridging::toJs(rt, value.fontScale));
|
|
1964
|
+
return result;
|
|
1965
|
+
}
|
|
1966
|
+
};
|
|
1967
|
+
|
|
1968
|
+
|
|
1969
|
+
#pragma mark - DeviceInfoBaseDisplayMetricsAndroid
|
|
1970
|
+
|
|
1971
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4>
|
|
1972
|
+
struct DeviceInfoBaseDisplayMetricsAndroid {
|
|
1973
|
+
P0 width;
|
|
1974
|
+
P1 height;
|
|
1975
|
+
P2 scale;
|
|
1976
|
+
P3 fontScale;
|
|
1977
|
+
P4 densityDpi;
|
|
1978
|
+
bool operator==(const DeviceInfoBaseDisplayMetricsAndroid &other) const {
|
|
1979
|
+
return width == other.width && height == other.height && scale == other.scale && fontScale == other.fontScale && densityDpi == other.densityDpi;
|
|
1980
|
+
}
|
|
1981
|
+
};
|
|
1982
|
+
|
|
1983
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4>
|
|
1984
|
+
struct DeviceInfoBaseDisplayMetricsAndroidBridging {
|
|
1985
|
+
static DeviceInfoBaseDisplayMetricsAndroid<P0, P1, P2, P3, P4> fromJs(
|
|
1986
|
+
jsi::Runtime &rt,
|
|
1987
|
+
const jsi::Object &value,
|
|
1988
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
1989
|
+
DeviceInfoBaseDisplayMetricsAndroid<P0, P1, P2, P3, P4> result{
|
|
1990
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "width"), jsInvoker),
|
|
1991
|
+
bridging::fromJs<P1>(rt, value.getProperty(rt, "height"), jsInvoker),
|
|
1992
|
+
bridging::fromJs<P2>(rt, value.getProperty(rt, "scale"), jsInvoker),
|
|
1993
|
+
bridging::fromJs<P3>(rt, value.getProperty(rt, "fontScale"), jsInvoker),
|
|
1994
|
+
bridging::fromJs<P4>(rt, value.getProperty(rt, "densityDpi"), jsInvoker)};
|
|
1995
|
+
return result;
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
static jsi::Object toJs(
|
|
1999
|
+
jsi::Runtime &rt,
|
|
2000
|
+
const DeviceInfoBaseDisplayMetricsAndroid<P0, P1, P2, P3, P4> &value) {
|
|
2001
|
+
auto result = facebook::jsi::Object(rt);
|
|
2002
|
+
result.setProperty(rt, "width", bridging::toJs(rt, value.width));
|
|
2003
|
+
result.setProperty(rt, "height", bridging::toJs(rt, value.height));
|
|
2004
|
+
result.setProperty(rt, "scale", bridging::toJs(rt, value.scale));
|
|
2005
|
+
result.setProperty(rt, "fontScale", bridging::toJs(rt, value.fontScale));
|
|
2006
|
+
result.setProperty(rt, "densityDpi", bridging::toJs(rt, value.densityDpi));
|
|
2007
|
+
return result;
|
|
2008
|
+
}
|
|
2009
|
+
};
|
|
2010
|
+
|
|
2011
|
+
|
|
2012
|
+
#pragma mark - DeviceInfoBaseDimensionsPayload
|
|
2013
|
+
|
|
2014
|
+
template <typename P0, typename P1, typename P2, typename P3>
|
|
2015
|
+
struct DeviceInfoBaseDimensionsPayload {
|
|
2016
|
+
P0 window;
|
|
2017
|
+
P1 screen;
|
|
2018
|
+
P2 windowPhysicalPixels;
|
|
2019
|
+
P3 screenPhysicalPixels;
|
|
2020
|
+
bool operator==(const DeviceInfoBaseDimensionsPayload &other) const {
|
|
2021
|
+
return window == other.window && screen == other.screen && windowPhysicalPixels == other.windowPhysicalPixels && screenPhysicalPixels == other.screenPhysicalPixels;
|
|
2022
|
+
}
|
|
2023
|
+
};
|
|
2024
|
+
|
|
2025
|
+
template <typename P0, typename P1, typename P2, typename P3>
|
|
2026
|
+
struct DeviceInfoBaseDimensionsPayloadBridging {
|
|
2027
|
+
static DeviceInfoBaseDimensionsPayload<P0, P1, P2, P3> fromJs(
|
|
2028
|
+
jsi::Runtime &rt,
|
|
2029
|
+
const jsi::Object &value,
|
|
2030
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
2031
|
+
DeviceInfoBaseDimensionsPayload<P0, P1, P2, P3> result{
|
|
2032
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "window"), jsInvoker),
|
|
2033
|
+
bridging::fromJs<P1>(rt, value.getProperty(rt, "screen"), jsInvoker),
|
|
2034
|
+
bridging::fromJs<P2>(rt, value.getProperty(rt, "windowPhysicalPixels"), jsInvoker),
|
|
2035
|
+
bridging::fromJs<P3>(rt, value.getProperty(rt, "screenPhysicalPixels"), jsInvoker)};
|
|
2036
|
+
return result;
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
static jsi::Object toJs(
|
|
2040
|
+
jsi::Runtime &rt,
|
|
2041
|
+
const DeviceInfoBaseDimensionsPayload<P0, P1, P2, P3> &value) {
|
|
2042
|
+
auto result = facebook::jsi::Object(rt);
|
|
2043
|
+
if (value.window) {
|
|
2044
|
+
result.setProperty(rt, "window", bridging::toJs(rt, value.window.value()));
|
|
2045
|
+
}
|
|
2046
|
+
if (value.screen) {
|
|
2047
|
+
result.setProperty(rt, "screen", bridging::toJs(rt, value.screen.value()));
|
|
2048
|
+
}
|
|
2049
|
+
if (value.windowPhysicalPixels) {
|
|
2050
|
+
result.setProperty(rt, "windowPhysicalPixels", bridging::toJs(rt, value.windowPhysicalPixels.value()));
|
|
2051
|
+
}
|
|
2052
|
+
if (value.screenPhysicalPixels) {
|
|
2053
|
+
result.setProperty(rt, "screenPhysicalPixels", bridging::toJs(rt, value.screenPhysicalPixels.value()));
|
|
2054
|
+
}
|
|
2055
|
+
return result;
|
|
2056
|
+
}
|
|
2057
|
+
};
|
|
2058
|
+
|
|
2059
|
+
class JSI_EXPORT NativeDeviceInfoCxxSpecJSI : public TurboModule {
|
|
2060
|
+
protected:
|
|
2061
|
+
NativeDeviceInfoCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2062
|
+
|
|
2063
|
+
public:
|
|
2064
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
2065
|
+
|
|
2066
|
+
};
|
|
2067
|
+
|
|
2068
|
+
template <typename T>
|
|
2069
|
+
class JSI_EXPORT NativeDeviceInfoCxxSpec : public TurboModule {
|
|
2070
|
+
public:
|
|
2071
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2072
|
+
return delegate_.get(rt, propName);
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
protected:
|
|
2076
|
+
NativeDeviceInfoCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2077
|
+
: TurboModule("DeviceInfo", jsInvoker),
|
|
2078
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2079
|
+
|
|
2080
|
+
private:
|
|
2081
|
+
class Delegate : public NativeDeviceInfoCxxSpecJSI {
|
|
2082
|
+
public:
|
|
2083
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2084
|
+
NativeDeviceInfoCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2085
|
+
|
|
2086
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
2087
|
+
static_assert(
|
|
2088
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
2089
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
2090
|
+
|
|
2091
|
+
return bridging::callFromJs<jsi::Object>(
|
|
2092
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
private:
|
|
2096
|
+
T *instance_;
|
|
2097
|
+
};
|
|
2098
|
+
|
|
2099
|
+
Delegate delegate_;
|
|
2100
|
+
};
|
|
2101
|
+
|
|
2102
|
+
class JSI_EXPORT NativePlatformConstantsIOSCxxSpecJSI : public TurboModule {
|
|
2103
|
+
protected:
|
|
2104
|
+
NativePlatformConstantsIOSCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2105
|
+
|
|
2106
|
+
public:
|
|
2107
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
2108
|
+
|
|
2109
|
+
};
|
|
2110
|
+
|
|
2111
|
+
template <typename T>
|
|
2112
|
+
class JSI_EXPORT NativePlatformConstantsIOSCxxSpec : public TurboModule {
|
|
2113
|
+
public:
|
|
2114
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2115
|
+
return delegate_.get(rt, propName);
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
protected:
|
|
2119
|
+
NativePlatformConstantsIOSCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2120
|
+
: TurboModule("PlatformConstants", jsInvoker),
|
|
2121
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2122
|
+
|
|
2123
|
+
private:
|
|
2124
|
+
class Delegate : public NativePlatformConstantsIOSCxxSpecJSI {
|
|
2125
|
+
public:
|
|
2126
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2127
|
+
NativePlatformConstantsIOSCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2128
|
+
|
|
2129
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
2130
|
+
static_assert(
|
|
2131
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
2132
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
2133
|
+
|
|
2134
|
+
return bridging::callFromJs<jsi::Object>(
|
|
2135
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
private:
|
|
2139
|
+
T *instance_;
|
|
2140
|
+
};
|
|
2141
|
+
|
|
2142
|
+
Delegate delegate_;
|
|
2143
|
+
};
|
|
2144
|
+
|
|
2145
|
+
class JSI_EXPORT NativeDevLoadingViewCxxSpecJSI : public TurboModule {
|
|
2146
|
+
protected:
|
|
2147
|
+
NativeDevLoadingViewCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2148
|
+
|
|
2149
|
+
public:
|
|
2150
|
+
virtual void showMessage(jsi::Runtime &rt, jsi::String message, std::optional<double> withColor, std::optional<double> withBackgroundColor) = 0;
|
|
2151
|
+
virtual void hide(jsi::Runtime &rt) = 0;
|
|
2152
|
+
|
|
2153
|
+
};
|
|
2154
|
+
|
|
2155
|
+
template <typename T>
|
|
2156
|
+
class JSI_EXPORT NativeDevLoadingViewCxxSpec : public TurboModule {
|
|
2157
|
+
public:
|
|
2158
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2159
|
+
return delegate_.get(rt, propName);
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
protected:
|
|
2163
|
+
NativeDevLoadingViewCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2164
|
+
: TurboModule("DevLoadingView", jsInvoker),
|
|
2165
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2166
|
+
|
|
2167
|
+
private:
|
|
2168
|
+
class Delegate : public NativeDevLoadingViewCxxSpecJSI {
|
|
2169
|
+
public:
|
|
2170
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2171
|
+
NativeDevLoadingViewCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2172
|
+
|
|
2173
|
+
void showMessage(jsi::Runtime &rt, jsi::String message, std::optional<double> withColor, std::optional<double> withBackgroundColor) override {
|
|
2174
|
+
static_assert(
|
|
2175
|
+
bridging::getParameterCount(&T::showMessage) == 4,
|
|
2176
|
+
"Expected showMessage(...) to have 4 parameters");
|
|
2177
|
+
|
|
2178
|
+
return bridging::callFromJs<void>(
|
|
2179
|
+
rt, &T::showMessage, jsInvoker_, instance_, std::move(message), std::move(withColor), std::move(withBackgroundColor));
|
|
2180
|
+
}
|
|
2181
|
+
void hide(jsi::Runtime &rt) override {
|
|
2182
|
+
static_assert(
|
|
2183
|
+
bridging::getParameterCount(&T::hide) == 1,
|
|
2184
|
+
"Expected hide(...) to have 1 parameters");
|
|
2185
|
+
|
|
2186
|
+
return bridging::callFromJs<void>(
|
|
2187
|
+
rt, &T::hide, jsInvoker_, instance_);
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
private:
|
|
2191
|
+
T *instance_;
|
|
2192
|
+
};
|
|
2193
|
+
|
|
2194
|
+
Delegate delegate_;
|
|
2195
|
+
};
|
|
2196
|
+
|
|
2197
|
+
class JSI_EXPORT NativeAppearanceCxxSpecJSI : public TurboModule {
|
|
2198
|
+
protected:
|
|
2199
|
+
NativeAppearanceCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2200
|
+
|
|
2201
|
+
public:
|
|
2202
|
+
virtual std::optional<jsi::String> getColorScheme(jsi::Runtime &rt) = 0;
|
|
2203
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
|
|
2204
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
2205
|
+
|
|
2206
|
+
};
|
|
2207
|
+
|
|
2208
|
+
template <typename T>
|
|
2209
|
+
class JSI_EXPORT NativeAppearanceCxxSpec : public TurboModule {
|
|
2210
|
+
public:
|
|
2211
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2212
|
+
return delegate_.get(rt, propName);
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
protected:
|
|
2216
|
+
NativeAppearanceCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2217
|
+
: TurboModule("Appearance", jsInvoker),
|
|
2218
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2219
|
+
|
|
2220
|
+
private:
|
|
2221
|
+
class Delegate : public NativeAppearanceCxxSpecJSI {
|
|
2222
|
+
public:
|
|
2223
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2224
|
+
NativeAppearanceCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2225
|
+
|
|
2226
|
+
std::optional<jsi::String> getColorScheme(jsi::Runtime &rt) override {
|
|
2227
|
+
static_assert(
|
|
2228
|
+
bridging::getParameterCount(&T::getColorScheme) == 1,
|
|
2229
|
+
"Expected getColorScheme(...) to have 1 parameters");
|
|
2230
|
+
|
|
2231
|
+
return bridging::callFromJs<std::optional<jsi::String>>(
|
|
2232
|
+
rt, &T::getColorScheme, jsInvoker_, instance_);
|
|
2233
|
+
}
|
|
2234
|
+
void addListener(jsi::Runtime &rt, jsi::String eventName) override {
|
|
2235
|
+
static_assert(
|
|
2236
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
2237
|
+
"Expected addListener(...) to have 2 parameters");
|
|
2238
|
+
|
|
2239
|
+
return bridging::callFromJs<void>(
|
|
2240
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
|
|
2241
|
+
}
|
|
2242
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
2243
|
+
static_assert(
|
|
2244
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
2245
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
2246
|
+
|
|
2247
|
+
return bridging::callFromJs<void>(
|
|
2248
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
private:
|
|
2252
|
+
T *instance_;
|
|
2253
|
+
};
|
|
2254
|
+
|
|
2255
|
+
Delegate delegate_;
|
|
2256
|
+
};
|
|
2257
|
+
|
|
2258
|
+
class JSI_EXPORT NativePlatformConstantsAndroidCxxSpecJSI : public TurboModule {
|
|
2259
|
+
protected:
|
|
2260
|
+
NativePlatformConstantsAndroidCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2261
|
+
|
|
2262
|
+
public:
|
|
2263
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
2264
|
+
virtual jsi::String getAndroidID(jsi::Runtime &rt) = 0;
|
|
2265
|
+
|
|
2266
|
+
};
|
|
2267
|
+
|
|
2268
|
+
template <typename T>
|
|
2269
|
+
class JSI_EXPORT NativePlatformConstantsAndroidCxxSpec : public TurboModule {
|
|
2270
|
+
public:
|
|
2271
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2272
|
+
return delegate_.get(rt, propName);
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
protected:
|
|
2276
|
+
NativePlatformConstantsAndroidCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2277
|
+
: TurboModule("PlatformConstants", jsInvoker),
|
|
2278
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2279
|
+
|
|
2280
|
+
private:
|
|
2281
|
+
class Delegate : public NativePlatformConstantsAndroidCxxSpecJSI {
|
|
2282
|
+
public:
|
|
2283
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2284
|
+
NativePlatformConstantsAndroidCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2285
|
+
|
|
2286
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
2287
|
+
static_assert(
|
|
2288
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
2289
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
2290
|
+
|
|
2291
|
+
return bridging::callFromJs<jsi::Object>(
|
|
2292
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
2293
|
+
}
|
|
2294
|
+
jsi::String getAndroidID(jsi::Runtime &rt) override {
|
|
2295
|
+
static_assert(
|
|
2296
|
+
bridging::getParameterCount(&T::getAndroidID) == 1,
|
|
2297
|
+
"Expected getAndroidID(...) to have 1 parameters");
|
|
2298
|
+
|
|
2299
|
+
return bridging::callFromJs<jsi::String>(
|
|
2300
|
+
rt, &T::getAndroidID, jsInvoker_, instance_);
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
private:
|
|
2304
|
+
T *instance_;
|
|
2305
|
+
};
|
|
2306
|
+
|
|
2307
|
+
Delegate delegate_;
|
|
2308
|
+
};
|
|
2309
|
+
|
|
2310
|
+
class JSI_EXPORT NativeDevSplitBundleLoaderCxxSpecJSI : public TurboModule {
|
|
2311
|
+
protected:
|
|
2312
|
+
NativeDevSplitBundleLoaderCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2313
|
+
|
|
2314
|
+
public:
|
|
2315
|
+
virtual jsi::Value loadBundle(jsi::Runtime &rt, jsi::String bundlePath) = 0;
|
|
2316
|
+
|
|
2317
|
+
};
|
|
2318
|
+
|
|
2319
|
+
template <typename T>
|
|
2320
|
+
class JSI_EXPORT NativeDevSplitBundleLoaderCxxSpec : public TurboModule {
|
|
2321
|
+
public:
|
|
2322
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2323
|
+
return delegate_.get(rt, propName);
|
|
2324
|
+
}
|
|
2325
|
+
|
|
2326
|
+
protected:
|
|
2327
|
+
NativeDevSplitBundleLoaderCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2328
|
+
: TurboModule("DevSplitBundleLoader", jsInvoker),
|
|
2329
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2330
|
+
|
|
2331
|
+
private:
|
|
2332
|
+
class Delegate : public NativeDevSplitBundleLoaderCxxSpecJSI {
|
|
2333
|
+
public:
|
|
2334
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2335
|
+
NativeDevSplitBundleLoaderCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2336
|
+
|
|
2337
|
+
jsi::Value loadBundle(jsi::Runtime &rt, jsi::String bundlePath) override {
|
|
2338
|
+
static_assert(
|
|
2339
|
+
bridging::getParameterCount(&T::loadBundle) == 2,
|
|
2340
|
+
"Expected loadBundle(...) to have 2 parameters");
|
|
2341
|
+
|
|
2342
|
+
return bridging::callFromJs<jsi::Value>(
|
|
2343
|
+
rt, &T::loadBundle, jsInvoker_, instance_, std::move(bundlePath));
|
|
2344
|
+
}
|
|
2345
|
+
|
|
2346
|
+
private:
|
|
2347
|
+
T *instance_;
|
|
2348
|
+
};
|
|
2349
|
+
|
|
2350
|
+
Delegate delegate_;
|
|
2351
|
+
};
|
|
2352
|
+
|
|
2353
|
+
class JSI_EXPORT NativeStatusBarManagerIOSCxxSpecJSI : public TurboModule {
|
|
2354
|
+
protected:
|
|
2355
|
+
NativeStatusBarManagerIOSCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2356
|
+
|
|
2357
|
+
public:
|
|
2358
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
2359
|
+
virtual void getHeight(jsi::Runtime &rt, jsi::Function callback) = 0;
|
|
2360
|
+
virtual void setNetworkActivityIndicatorVisible(jsi::Runtime &rt, bool visible) = 0;
|
|
2361
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventType) = 0;
|
|
2362
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
2363
|
+
virtual void setStyle(jsi::Runtime &rt, std::optional<jsi::String> statusBarStyle, bool animated) = 0;
|
|
2364
|
+
virtual void setHidden(jsi::Runtime &rt, bool hidden, jsi::String withAnimation) = 0;
|
|
2365
|
+
|
|
2366
|
+
};
|
|
2367
|
+
|
|
2368
|
+
template <typename T>
|
|
2369
|
+
class JSI_EXPORT NativeStatusBarManagerIOSCxxSpec : public TurboModule {
|
|
2370
|
+
public:
|
|
2371
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2372
|
+
return delegate_.get(rt, propName);
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
protected:
|
|
2376
|
+
NativeStatusBarManagerIOSCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2377
|
+
: TurboModule("StatusBarManager", jsInvoker),
|
|
2378
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2379
|
+
|
|
2380
|
+
private:
|
|
2381
|
+
class Delegate : public NativeStatusBarManagerIOSCxxSpecJSI {
|
|
2382
|
+
public:
|
|
2383
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2384
|
+
NativeStatusBarManagerIOSCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2385
|
+
|
|
2386
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
2387
|
+
static_assert(
|
|
2388
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
2389
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
2390
|
+
|
|
2391
|
+
return bridging::callFromJs<jsi::Object>(
|
|
2392
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
2393
|
+
}
|
|
2394
|
+
void getHeight(jsi::Runtime &rt, jsi::Function callback) override {
|
|
2395
|
+
static_assert(
|
|
2396
|
+
bridging::getParameterCount(&T::getHeight) == 2,
|
|
2397
|
+
"Expected getHeight(...) to have 2 parameters");
|
|
2398
|
+
|
|
2399
|
+
return bridging::callFromJs<void>(
|
|
2400
|
+
rt, &T::getHeight, jsInvoker_, instance_, std::move(callback));
|
|
2401
|
+
}
|
|
2402
|
+
void setNetworkActivityIndicatorVisible(jsi::Runtime &rt, bool visible) override {
|
|
2403
|
+
static_assert(
|
|
2404
|
+
bridging::getParameterCount(&T::setNetworkActivityIndicatorVisible) == 2,
|
|
2405
|
+
"Expected setNetworkActivityIndicatorVisible(...) to have 2 parameters");
|
|
2406
|
+
|
|
2407
|
+
return bridging::callFromJs<void>(
|
|
2408
|
+
rt, &T::setNetworkActivityIndicatorVisible, jsInvoker_, instance_, std::move(visible));
|
|
2409
|
+
}
|
|
2410
|
+
void addListener(jsi::Runtime &rt, jsi::String eventType) override {
|
|
2411
|
+
static_assert(
|
|
2412
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
2413
|
+
"Expected addListener(...) to have 2 parameters");
|
|
2414
|
+
|
|
2415
|
+
return bridging::callFromJs<void>(
|
|
2416
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventType));
|
|
2417
|
+
}
|
|
2418
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
2419
|
+
static_assert(
|
|
2420
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
2421
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
2422
|
+
|
|
2423
|
+
return bridging::callFromJs<void>(
|
|
2424
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
2425
|
+
}
|
|
2426
|
+
void setStyle(jsi::Runtime &rt, std::optional<jsi::String> statusBarStyle, bool animated) override {
|
|
2427
|
+
static_assert(
|
|
2428
|
+
bridging::getParameterCount(&T::setStyle) == 3,
|
|
2429
|
+
"Expected setStyle(...) to have 3 parameters");
|
|
2430
|
+
|
|
2431
|
+
return bridging::callFromJs<void>(
|
|
2432
|
+
rt, &T::setStyle, jsInvoker_, instance_, std::move(statusBarStyle), std::move(animated));
|
|
2433
|
+
}
|
|
2434
|
+
void setHidden(jsi::Runtime &rt, bool hidden, jsi::String withAnimation) override {
|
|
2435
|
+
static_assert(
|
|
2436
|
+
bridging::getParameterCount(&T::setHidden) == 3,
|
|
2437
|
+
"Expected setHidden(...) to have 3 parameters");
|
|
2438
|
+
|
|
2439
|
+
return bridging::callFromJs<void>(
|
|
2440
|
+
rt, &T::setHidden, jsInvoker_, instance_, std::move(hidden), std::move(withAnimation));
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
private:
|
|
2444
|
+
T *instance_;
|
|
2445
|
+
};
|
|
2446
|
+
|
|
2447
|
+
Delegate delegate_;
|
|
2448
|
+
};
|
|
2449
|
+
|
|
2450
|
+
class JSI_EXPORT NativeStatusBarManagerAndroidCxxSpecJSI : public TurboModule {
|
|
2451
|
+
protected:
|
|
2452
|
+
NativeStatusBarManagerAndroidCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2453
|
+
|
|
2454
|
+
public:
|
|
2455
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
2456
|
+
virtual void setColor(jsi::Runtime &rt, double color, bool animated) = 0;
|
|
2457
|
+
virtual void setTranslucent(jsi::Runtime &rt, bool translucent) = 0;
|
|
2458
|
+
virtual void setStyle(jsi::Runtime &rt, std::optional<jsi::String> statusBarStyle) = 0;
|
|
2459
|
+
virtual void setHidden(jsi::Runtime &rt, bool hidden) = 0;
|
|
2460
|
+
|
|
2461
|
+
};
|
|
2462
|
+
|
|
2463
|
+
template <typename T>
|
|
2464
|
+
class JSI_EXPORT NativeStatusBarManagerAndroidCxxSpec : public TurboModule {
|
|
2465
|
+
public:
|
|
2466
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2467
|
+
return delegate_.get(rt, propName);
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
protected:
|
|
2471
|
+
NativeStatusBarManagerAndroidCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2472
|
+
: TurboModule("StatusBarManager", jsInvoker),
|
|
2473
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2474
|
+
|
|
2475
|
+
private:
|
|
2476
|
+
class Delegate : public NativeStatusBarManagerAndroidCxxSpecJSI {
|
|
2477
|
+
public:
|
|
2478
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2479
|
+
NativeStatusBarManagerAndroidCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2480
|
+
|
|
2481
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
2482
|
+
static_assert(
|
|
2483
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
2484
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
2485
|
+
|
|
2486
|
+
return bridging::callFromJs<jsi::Object>(
|
|
2487
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
2488
|
+
}
|
|
2489
|
+
void setColor(jsi::Runtime &rt, double color, bool animated) override {
|
|
2490
|
+
static_assert(
|
|
2491
|
+
bridging::getParameterCount(&T::setColor) == 3,
|
|
2492
|
+
"Expected setColor(...) to have 3 parameters");
|
|
2493
|
+
|
|
2494
|
+
return bridging::callFromJs<void>(
|
|
2495
|
+
rt, &T::setColor, jsInvoker_, instance_, std::move(color), std::move(animated));
|
|
2496
|
+
}
|
|
2497
|
+
void setTranslucent(jsi::Runtime &rt, bool translucent) override {
|
|
2498
|
+
static_assert(
|
|
2499
|
+
bridging::getParameterCount(&T::setTranslucent) == 2,
|
|
2500
|
+
"Expected setTranslucent(...) to have 2 parameters");
|
|
2501
|
+
|
|
2502
|
+
return bridging::callFromJs<void>(
|
|
2503
|
+
rt, &T::setTranslucent, jsInvoker_, instance_, std::move(translucent));
|
|
2504
|
+
}
|
|
2505
|
+
void setStyle(jsi::Runtime &rt, std::optional<jsi::String> statusBarStyle) override {
|
|
2506
|
+
static_assert(
|
|
2507
|
+
bridging::getParameterCount(&T::setStyle) == 2,
|
|
2508
|
+
"Expected setStyle(...) to have 2 parameters");
|
|
2509
|
+
|
|
2510
|
+
return bridging::callFromJs<void>(
|
|
2511
|
+
rt, &T::setStyle, jsInvoker_, instance_, std::move(statusBarStyle));
|
|
2512
|
+
}
|
|
2513
|
+
void setHidden(jsi::Runtime &rt, bool hidden) override {
|
|
2514
|
+
static_assert(
|
|
2515
|
+
bridging::getParameterCount(&T::setHidden) == 2,
|
|
2516
|
+
"Expected setHidden(...) to have 2 parameters");
|
|
2517
|
+
|
|
2518
|
+
return bridging::callFromJs<void>(
|
|
2519
|
+
rt, &T::setHidden, jsInvoker_, instance_, std::move(hidden));
|
|
2520
|
+
}
|
|
2521
|
+
|
|
2522
|
+
private:
|
|
2523
|
+
T *instance_;
|
|
2524
|
+
};
|
|
2525
|
+
|
|
2526
|
+
Delegate delegate_;
|
|
2527
|
+
};
|
|
2528
|
+
|
|
2529
|
+
class JSI_EXPORT NativeDatePickerAndroidCxxSpecJSI : public TurboModule {
|
|
2530
|
+
protected:
|
|
2531
|
+
NativeDatePickerAndroidCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2532
|
+
|
|
2533
|
+
public:
|
|
2534
|
+
virtual jsi::Value open(jsi::Runtime &rt, jsi::Object options) = 0;
|
|
2535
|
+
|
|
2536
|
+
};
|
|
2537
|
+
|
|
2538
|
+
template <typename T>
|
|
2539
|
+
class JSI_EXPORT NativeDatePickerAndroidCxxSpec : public TurboModule {
|
|
2540
|
+
public:
|
|
2541
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2542
|
+
return delegate_.get(rt, propName);
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
protected:
|
|
2546
|
+
NativeDatePickerAndroidCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2547
|
+
: TurboModule("DatePickerAndroid", jsInvoker),
|
|
2548
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2549
|
+
|
|
2550
|
+
private:
|
|
2551
|
+
class Delegate : public NativeDatePickerAndroidCxxSpecJSI {
|
|
2552
|
+
public:
|
|
2553
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2554
|
+
NativeDatePickerAndroidCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2555
|
+
|
|
2556
|
+
jsi::Value open(jsi::Runtime &rt, jsi::Object options) override {
|
|
2557
|
+
static_assert(
|
|
2558
|
+
bridging::getParameterCount(&T::open) == 2,
|
|
2559
|
+
"Expected open(...) to have 2 parameters");
|
|
2560
|
+
|
|
2561
|
+
return bridging::callFromJs<jsi::Value>(
|
|
2562
|
+
rt, &T::open, jsInvoker_, instance_, std::move(options));
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
private:
|
|
2566
|
+
T *instance_;
|
|
2567
|
+
};
|
|
2568
|
+
|
|
2569
|
+
Delegate delegate_;
|
|
2570
|
+
};
|
|
2571
|
+
|
|
2572
|
+
class JSI_EXPORT NativeAccessibilityManagerCxxSpecJSI : public TurboModule {
|
|
2573
|
+
protected:
|
|
2574
|
+
NativeAccessibilityManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2575
|
+
|
|
2576
|
+
public:
|
|
2577
|
+
virtual void getCurrentBoldTextState(jsi::Runtime &rt, jsi::Function onSuccess, jsi::Function onError) = 0;
|
|
2578
|
+
virtual void getCurrentGrayscaleState(jsi::Runtime &rt, jsi::Function onSuccess, jsi::Function onError) = 0;
|
|
2579
|
+
virtual void getCurrentInvertColorsState(jsi::Runtime &rt, jsi::Function onSuccess, jsi::Function onError) = 0;
|
|
2580
|
+
virtual void getCurrentReduceMotionState(jsi::Runtime &rt, jsi::Function onSuccess, jsi::Function onError) = 0;
|
|
2581
|
+
virtual void getCurrentPrefersCrossFadeTransitionsState(jsi::Runtime &rt, jsi::Function onSuccess, jsi::Function onError) = 0;
|
|
2582
|
+
virtual void getCurrentReduceTransparencyState(jsi::Runtime &rt, jsi::Function onSuccess, jsi::Function onError) = 0;
|
|
2583
|
+
virtual void getCurrentVoiceOverState(jsi::Runtime &rt, jsi::Function onSuccess, jsi::Function onError) = 0;
|
|
2584
|
+
virtual void setAccessibilityContentSizeMultipliers(jsi::Runtime &rt, jsi::Object JSMultipliers) = 0;
|
|
2585
|
+
virtual void setAccessibilityFocus(jsi::Runtime &rt, double reactTag) = 0;
|
|
2586
|
+
virtual void announceForAccessibility(jsi::Runtime &rt, jsi::String announcement) = 0;
|
|
2587
|
+
virtual void announceForAccessibilityWithOptions(jsi::Runtime &rt, jsi::String announcement, jsi::Object options) = 0;
|
|
2588
|
+
|
|
2589
|
+
};
|
|
2590
|
+
|
|
2591
|
+
template <typename T>
|
|
2592
|
+
class JSI_EXPORT NativeAccessibilityManagerCxxSpec : public TurboModule {
|
|
2593
|
+
public:
|
|
2594
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2595
|
+
return delegate_.get(rt, propName);
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2598
|
+
protected:
|
|
2599
|
+
NativeAccessibilityManagerCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2600
|
+
: TurboModule("AccessibilityManager", jsInvoker),
|
|
2601
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2602
|
+
|
|
2603
|
+
private:
|
|
2604
|
+
class Delegate : public NativeAccessibilityManagerCxxSpecJSI {
|
|
2605
|
+
public:
|
|
2606
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2607
|
+
NativeAccessibilityManagerCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2608
|
+
|
|
2609
|
+
void getCurrentBoldTextState(jsi::Runtime &rt, jsi::Function onSuccess, jsi::Function onError) override {
|
|
2610
|
+
static_assert(
|
|
2611
|
+
bridging::getParameterCount(&T::getCurrentBoldTextState) == 3,
|
|
2612
|
+
"Expected getCurrentBoldTextState(...) to have 3 parameters");
|
|
2613
|
+
|
|
2614
|
+
return bridging::callFromJs<void>(
|
|
2615
|
+
rt, &T::getCurrentBoldTextState, jsInvoker_, instance_, std::move(onSuccess), std::move(onError));
|
|
2616
|
+
}
|
|
2617
|
+
void getCurrentGrayscaleState(jsi::Runtime &rt, jsi::Function onSuccess, jsi::Function onError) override {
|
|
2618
|
+
static_assert(
|
|
2619
|
+
bridging::getParameterCount(&T::getCurrentGrayscaleState) == 3,
|
|
2620
|
+
"Expected getCurrentGrayscaleState(...) to have 3 parameters");
|
|
2621
|
+
|
|
2622
|
+
return bridging::callFromJs<void>(
|
|
2623
|
+
rt, &T::getCurrentGrayscaleState, jsInvoker_, instance_, std::move(onSuccess), std::move(onError));
|
|
2624
|
+
}
|
|
2625
|
+
void getCurrentInvertColorsState(jsi::Runtime &rt, jsi::Function onSuccess, jsi::Function onError) override {
|
|
2626
|
+
static_assert(
|
|
2627
|
+
bridging::getParameterCount(&T::getCurrentInvertColorsState) == 3,
|
|
2628
|
+
"Expected getCurrentInvertColorsState(...) to have 3 parameters");
|
|
2629
|
+
|
|
2630
|
+
return bridging::callFromJs<void>(
|
|
2631
|
+
rt, &T::getCurrentInvertColorsState, jsInvoker_, instance_, std::move(onSuccess), std::move(onError));
|
|
2632
|
+
}
|
|
2633
|
+
void getCurrentReduceMotionState(jsi::Runtime &rt, jsi::Function onSuccess, jsi::Function onError) override {
|
|
2634
|
+
static_assert(
|
|
2635
|
+
bridging::getParameterCount(&T::getCurrentReduceMotionState) == 3,
|
|
2636
|
+
"Expected getCurrentReduceMotionState(...) to have 3 parameters");
|
|
2637
|
+
|
|
2638
|
+
return bridging::callFromJs<void>(
|
|
2639
|
+
rt, &T::getCurrentReduceMotionState, jsInvoker_, instance_, std::move(onSuccess), std::move(onError));
|
|
2640
|
+
}
|
|
2641
|
+
void getCurrentPrefersCrossFadeTransitionsState(jsi::Runtime &rt, jsi::Function onSuccess, jsi::Function onError) override {
|
|
2642
|
+
static_assert(
|
|
2643
|
+
bridging::getParameterCount(&T::getCurrentPrefersCrossFadeTransitionsState) == 3,
|
|
2644
|
+
"Expected getCurrentPrefersCrossFadeTransitionsState(...) to have 3 parameters");
|
|
2645
|
+
|
|
2646
|
+
return bridging::callFromJs<void>(
|
|
2647
|
+
rt, &T::getCurrentPrefersCrossFadeTransitionsState, jsInvoker_, instance_, std::move(onSuccess), std::move(onError));
|
|
2648
|
+
}
|
|
2649
|
+
void getCurrentReduceTransparencyState(jsi::Runtime &rt, jsi::Function onSuccess, jsi::Function onError) override {
|
|
2650
|
+
static_assert(
|
|
2651
|
+
bridging::getParameterCount(&T::getCurrentReduceTransparencyState) == 3,
|
|
2652
|
+
"Expected getCurrentReduceTransparencyState(...) to have 3 parameters");
|
|
2653
|
+
|
|
2654
|
+
return bridging::callFromJs<void>(
|
|
2655
|
+
rt, &T::getCurrentReduceTransparencyState, jsInvoker_, instance_, std::move(onSuccess), std::move(onError));
|
|
2656
|
+
}
|
|
2657
|
+
void getCurrentVoiceOverState(jsi::Runtime &rt, jsi::Function onSuccess, jsi::Function onError) override {
|
|
2658
|
+
static_assert(
|
|
2659
|
+
bridging::getParameterCount(&T::getCurrentVoiceOverState) == 3,
|
|
2660
|
+
"Expected getCurrentVoiceOverState(...) to have 3 parameters");
|
|
2661
|
+
|
|
2662
|
+
return bridging::callFromJs<void>(
|
|
2663
|
+
rt, &T::getCurrentVoiceOverState, jsInvoker_, instance_, std::move(onSuccess), std::move(onError));
|
|
2664
|
+
}
|
|
2665
|
+
void setAccessibilityContentSizeMultipliers(jsi::Runtime &rt, jsi::Object JSMultipliers) override {
|
|
2666
|
+
static_assert(
|
|
2667
|
+
bridging::getParameterCount(&T::setAccessibilityContentSizeMultipliers) == 2,
|
|
2668
|
+
"Expected setAccessibilityContentSizeMultipliers(...) to have 2 parameters");
|
|
2669
|
+
|
|
2670
|
+
return bridging::callFromJs<void>(
|
|
2671
|
+
rt, &T::setAccessibilityContentSizeMultipliers, jsInvoker_, instance_, std::move(JSMultipliers));
|
|
2672
|
+
}
|
|
2673
|
+
void setAccessibilityFocus(jsi::Runtime &rt, double reactTag) override {
|
|
2674
|
+
static_assert(
|
|
2675
|
+
bridging::getParameterCount(&T::setAccessibilityFocus) == 2,
|
|
2676
|
+
"Expected setAccessibilityFocus(...) to have 2 parameters");
|
|
2677
|
+
|
|
2678
|
+
return bridging::callFromJs<void>(
|
|
2679
|
+
rt, &T::setAccessibilityFocus, jsInvoker_, instance_, std::move(reactTag));
|
|
2680
|
+
}
|
|
2681
|
+
void announceForAccessibility(jsi::Runtime &rt, jsi::String announcement) override {
|
|
2682
|
+
static_assert(
|
|
2683
|
+
bridging::getParameterCount(&T::announceForAccessibility) == 2,
|
|
2684
|
+
"Expected announceForAccessibility(...) to have 2 parameters");
|
|
2685
|
+
|
|
2686
|
+
return bridging::callFromJs<void>(
|
|
2687
|
+
rt, &T::announceForAccessibility, jsInvoker_, instance_, std::move(announcement));
|
|
2688
|
+
}
|
|
2689
|
+
void announceForAccessibilityWithOptions(jsi::Runtime &rt, jsi::String announcement, jsi::Object options) override {
|
|
2690
|
+
static_assert(
|
|
2691
|
+
bridging::getParameterCount(&T::announceForAccessibilityWithOptions) == 3,
|
|
2692
|
+
"Expected announceForAccessibilityWithOptions(...) to have 3 parameters");
|
|
2693
|
+
|
|
2694
|
+
return bridging::callFromJs<void>(
|
|
2695
|
+
rt, &T::announceForAccessibilityWithOptions, jsInvoker_, instance_, std::move(announcement), std::move(options));
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
private:
|
|
2699
|
+
T *instance_;
|
|
2700
|
+
};
|
|
2701
|
+
|
|
2702
|
+
Delegate delegate_;
|
|
2703
|
+
};
|
|
2704
|
+
|
|
2705
|
+
class JSI_EXPORT NativeAccessibilityInfoCxxSpecJSI : public TurboModule {
|
|
2706
|
+
protected:
|
|
2707
|
+
NativeAccessibilityInfoCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2708
|
+
|
|
2709
|
+
public:
|
|
2710
|
+
virtual void isReduceMotionEnabled(jsi::Runtime &rt, jsi::Function onSuccess) = 0;
|
|
2711
|
+
virtual void isTouchExplorationEnabled(jsi::Runtime &rt, jsi::Function onSuccess) = 0;
|
|
2712
|
+
virtual void isAccessibilityServiceEnabled(jsi::Runtime &rt, jsi::Function onSuccess) = 0;
|
|
2713
|
+
virtual void setAccessibilityFocus(jsi::Runtime &rt, double reactTag) = 0;
|
|
2714
|
+
virtual void announceForAccessibility(jsi::Runtime &rt, jsi::String announcement) = 0;
|
|
2715
|
+
virtual void getRecommendedTimeoutMillis(jsi::Runtime &rt, double mSec, jsi::Function onSuccess) = 0;
|
|
2716
|
+
|
|
2717
|
+
};
|
|
2718
|
+
|
|
2719
|
+
template <typename T>
|
|
2720
|
+
class JSI_EXPORT NativeAccessibilityInfoCxxSpec : public TurboModule {
|
|
2721
|
+
public:
|
|
2722
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2723
|
+
return delegate_.get(rt, propName);
|
|
2724
|
+
}
|
|
2725
|
+
|
|
2726
|
+
protected:
|
|
2727
|
+
NativeAccessibilityInfoCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2728
|
+
: TurboModule("AccessibilityInfo", jsInvoker),
|
|
2729
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2730
|
+
|
|
2731
|
+
private:
|
|
2732
|
+
class Delegate : public NativeAccessibilityInfoCxxSpecJSI {
|
|
2733
|
+
public:
|
|
2734
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2735
|
+
NativeAccessibilityInfoCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2736
|
+
|
|
2737
|
+
void isReduceMotionEnabled(jsi::Runtime &rt, jsi::Function onSuccess) override {
|
|
2738
|
+
static_assert(
|
|
2739
|
+
bridging::getParameterCount(&T::isReduceMotionEnabled) == 2,
|
|
2740
|
+
"Expected isReduceMotionEnabled(...) to have 2 parameters");
|
|
2741
|
+
|
|
2742
|
+
return bridging::callFromJs<void>(
|
|
2743
|
+
rt, &T::isReduceMotionEnabled, jsInvoker_, instance_, std::move(onSuccess));
|
|
2744
|
+
}
|
|
2745
|
+
void isTouchExplorationEnabled(jsi::Runtime &rt, jsi::Function onSuccess) override {
|
|
2746
|
+
static_assert(
|
|
2747
|
+
bridging::getParameterCount(&T::isTouchExplorationEnabled) == 2,
|
|
2748
|
+
"Expected isTouchExplorationEnabled(...) to have 2 parameters");
|
|
2749
|
+
|
|
2750
|
+
return bridging::callFromJs<void>(
|
|
2751
|
+
rt, &T::isTouchExplorationEnabled, jsInvoker_, instance_, std::move(onSuccess));
|
|
2752
|
+
}
|
|
2753
|
+
void isAccessibilityServiceEnabled(jsi::Runtime &rt, jsi::Function onSuccess) override {
|
|
2754
|
+
static_assert(
|
|
2755
|
+
bridging::getParameterCount(&T::isAccessibilityServiceEnabled) == 2,
|
|
2756
|
+
"Expected isAccessibilityServiceEnabled(...) to have 2 parameters");
|
|
2757
|
+
|
|
2758
|
+
return bridging::callFromJs<void>(
|
|
2759
|
+
rt, &T::isAccessibilityServiceEnabled, jsInvoker_, instance_, std::move(onSuccess));
|
|
2760
|
+
}
|
|
2761
|
+
void setAccessibilityFocus(jsi::Runtime &rt, double reactTag) override {
|
|
2762
|
+
static_assert(
|
|
2763
|
+
bridging::getParameterCount(&T::setAccessibilityFocus) == 2,
|
|
2764
|
+
"Expected setAccessibilityFocus(...) to have 2 parameters");
|
|
2765
|
+
|
|
2766
|
+
return bridging::callFromJs<void>(
|
|
2767
|
+
rt, &T::setAccessibilityFocus, jsInvoker_, instance_, std::move(reactTag));
|
|
2768
|
+
}
|
|
2769
|
+
void announceForAccessibility(jsi::Runtime &rt, jsi::String announcement) override {
|
|
2770
|
+
static_assert(
|
|
2771
|
+
bridging::getParameterCount(&T::announceForAccessibility) == 2,
|
|
2772
|
+
"Expected announceForAccessibility(...) to have 2 parameters");
|
|
2773
|
+
|
|
2774
|
+
return bridging::callFromJs<void>(
|
|
2775
|
+
rt, &T::announceForAccessibility, jsInvoker_, instance_, std::move(announcement));
|
|
2776
|
+
}
|
|
2777
|
+
void getRecommendedTimeoutMillis(jsi::Runtime &rt, double mSec, jsi::Function onSuccess) override {
|
|
2778
|
+
static_assert(
|
|
2779
|
+
bridging::getParameterCount(&T::getRecommendedTimeoutMillis) == 3,
|
|
2780
|
+
"Expected getRecommendedTimeoutMillis(...) to have 3 parameters");
|
|
2781
|
+
|
|
2782
|
+
return bridging::callFromJs<void>(
|
|
2783
|
+
rt, &T::getRecommendedTimeoutMillis, jsInvoker_, instance_, std::move(mSec), std::move(onSuccess));
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2786
|
+
private:
|
|
2787
|
+
T *instance_;
|
|
2788
|
+
};
|
|
2789
|
+
|
|
2790
|
+
Delegate delegate_;
|
|
2791
|
+
};
|
|
2792
|
+
|
|
2793
|
+
class JSI_EXPORT NativeToastAndroidCxxSpecJSI : public TurboModule {
|
|
2794
|
+
protected:
|
|
2795
|
+
NativeToastAndroidCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2796
|
+
|
|
2797
|
+
public:
|
|
2798
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
2799
|
+
virtual void show(jsi::Runtime &rt, jsi::String message, double duration) = 0;
|
|
2800
|
+
virtual void showWithGravity(jsi::Runtime &rt, jsi::String message, double duration, double gravity) = 0;
|
|
2801
|
+
virtual void showWithGravityAndOffset(jsi::Runtime &rt, jsi::String message, double duration, double gravity, double xOffset, double yOffset) = 0;
|
|
2802
|
+
|
|
2803
|
+
};
|
|
2804
|
+
|
|
2805
|
+
template <typename T>
|
|
2806
|
+
class JSI_EXPORT NativeToastAndroidCxxSpec : public TurboModule {
|
|
2807
|
+
public:
|
|
2808
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2809
|
+
return delegate_.get(rt, propName);
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
protected:
|
|
2813
|
+
NativeToastAndroidCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2814
|
+
: TurboModule("ToastAndroid", jsInvoker),
|
|
2815
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2816
|
+
|
|
2817
|
+
private:
|
|
2818
|
+
class Delegate : public NativeToastAndroidCxxSpecJSI {
|
|
2819
|
+
public:
|
|
2820
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2821
|
+
NativeToastAndroidCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2822
|
+
|
|
2823
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
2824
|
+
static_assert(
|
|
2825
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
2826
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
2827
|
+
|
|
2828
|
+
return bridging::callFromJs<jsi::Object>(
|
|
2829
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
2830
|
+
}
|
|
2831
|
+
void show(jsi::Runtime &rt, jsi::String message, double duration) override {
|
|
2832
|
+
static_assert(
|
|
2833
|
+
bridging::getParameterCount(&T::show) == 3,
|
|
2834
|
+
"Expected show(...) to have 3 parameters");
|
|
2835
|
+
|
|
2836
|
+
return bridging::callFromJs<void>(
|
|
2837
|
+
rt, &T::show, jsInvoker_, instance_, std::move(message), std::move(duration));
|
|
2838
|
+
}
|
|
2839
|
+
void showWithGravity(jsi::Runtime &rt, jsi::String message, double duration, double gravity) override {
|
|
2840
|
+
static_assert(
|
|
2841
|
+
bridging::getParameterCount(&T::showWithGravity) == 4,
|
|
2842
|
+
"Expected showWithGravity(...) to have 4 parameters");
|
|
2843
|
+
|
|
2844
|
+
return bridging::callFromJs<void>(
|
|
2845
|
+
rt, &T::showWithGravity, jsInvoker_, instance_, std::move(message), std::move(duration), std::move(gravity));
|
|
2846
|
+
}
|
|
2847
|
+
void showWithGravityAndOffset(jsi::Runtime &rt, jsi::String message, double duration, double gravity, double xOffset, double yOffset) override {
|
|
2848
|
+
static_assert(
|
|
2849
|
+
bridging::getParameterCount(&T::showWithGravityAndOffset) == 6,
|
|
2850
|
+
"Expected showWithGravityAndOffset(...) to have 6 parameters");
|
|
2851
|
+
|
|
2852
|
+
return bridging::callFromJs<void>(
|
|
2853
|
+
rt, &T::showWithGravityAndOffset, jsInvoker_, instance_, std::move(message), std::move(duration), std::move(gravity), std::move(xOffset), std::move(yOffset));
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
private:
|
|
2857
|
+
T *instance_;
|
|
2858
|
+
};
|
|
2859
|
+
|
|
2860
|
+
Delegate delegate_;
|
|
2861
|
+
};
|
|
2862
|
+
|
|
2863
|
+
class JSI_EXPORT NativeSoundManagerCxxSpecJSI : public TurboModule {
|
|
2864
|
+
protected:
|
|
2865
|
+
NativeSoundManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2866
|
+
|
|
2867
|
+
public:
|
|
2868
|
+
virtual void playTouchSound(jsi::Runtime &rt) = 0;
|
|
2869
|
+
|
|
2870
|
+
};
|
|
2871
|
+
|
|
2872
|
+
template <typename T>
|
|
2873
|
+
class JSI_EXPORT NativeSoundManagerCxxSpec : public TurboModule {
|
|
2874
|
+
public:
|
|
2875
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2876
|
+
return delegate_.get(rt, propName);
|
|
2877
|
+
}
|
|
2878
|
+
|
|
2879
|
+
protected:
|
|
2880
|
+
NativeSoundManagerCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2881
|
+
: TurboModule("SoundManager", jsInvoker),
|
|
2882
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2883
|
+
|
|
2884
|
+
private:
|
|
2885
|
+
class Delegate : public NativeSoundManagerCxxSpecJSI {
|
|
2886
|
+
public:
|
|
2887
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2888
|
+
NativeSoundManagerCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2889
|
+
|
|
2890
|
+
void playTouchSound(jsi::Runtime &rt) override {
|
|
2891
|
+
static_assert(
|
|
2892
|
+
bridging::getParameterCount(&T::playTouchSound) == 1,
|
|
2893
|
+
"Expected playTouchSound(...) to have 1 parameters");
|
|
2894
|
+
|
|
2895
|
+
return bridging::callFromJs<void>(
|
|
2896
|
+
rt, &T::playTouchSound, jsInvoker_, instance_);
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
private:
|
|
2900
|
+
T *instance_;
|
|
2901
|
+
};
|
|
2902
|
+
|
|
2903
|
+
Delegate delegate_;
|
|
2904
|
+
};
|
|
2905
|
+
|
|
2906
|
+
class JSI_EXPORT NativeKeyboardObserverCxxSpecJSI : public TurboModule {
|
|
2907
|
+
protected:
|
|
2908
|
+
NativeKeyboardObserverCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2909
|
+
|
|
2910
|
+
public:
|
|
2911
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
|
|
2912
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
2913
|
+
|
|
2914
|
+
};
|
|
2915
|
+
|
|
2916
|
+
template <typename T>
|
|
2917
|
+
class JSI_EXPORT NativeKeyboardObserverCxxSpec : public TurboModule {
|
|
2918
|
+
public:
|
|
2919
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2920
|
+
return delegate_.get(rt, propName);
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
protected:
|
|
2924
|
+
NativeKeyboardObserverCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2925
|
+
: TurboModule("KeyboardObserver", jsInvoker),
|
|
2926
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2927
|
+
|
|
2928
|
+
private:
|
|
2929
|
+
class Delegate : public NativeKeyboardObserverCxxSpecJSI {
|
|
2930
|
+
public:
|
|
2931
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2932
|
+
NativeKeyboardObserverCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2933
|
+
|
|
2934
|
+
void addListener(jsi::Runtime &rt, jsi::String eventName) override {
|
|
2935
|
+
static_assert(
|
|
2936
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
2937
|
+
"Expected addListener(...) to have 2 parameters");
|
|
2938
|
+
|
|
2939
|
+
return bridging::callFromJs<void>(
|
|
2940
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
|
|
2941
|
+
}
|
|
2942
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
2943
|
+
static_assert(
|
|
2944
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
2945
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
2946
|
+
|
|
2947
|
+
return bridging::callFromJs<void>(
|
|
2948
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
2949
|
+
}
|
|
2950
|
+
|
|
2951
|
+
private:
|
|
2952
|
+
T *instance_;
|
|
2953
|
+
};
|
|
2954
|
+
|
|
2955
|
+
Delegate delegate_;
|
|
2956
|
+
};
|
|
2957
|
+
|
|
2958
|
+
class JSI_EXPORT NativeClipboardCxxSpecJSI : public TurboModule {
|
|
2959
|
+
protected:
|
|
2960
|
+
NativeClipboardCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
2961
|
+
|
|
2962
|
+
public:
|
|
2963
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
2964
|
+
virtual jsi::Value getString(jsi::Runtime &rt) = 0;
|
|
2965
|
+
virtual void setString(jsi::Runtime &rt, jsi::String content) = 0;
|
|
2966
|
+
|
|
2967
|
+
};
|
|
2968
|
+
|
|
2969
|
+
template <typename T>
|
|
2970
|
+
class JSI_EXPORT NativeClipboardCxxSpec : public TurboModule {
|
|
2971
|
+
public:
|
|
2972
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
2973
|
+
return delegate_.get(rt, propName);
|
|
2974
|
+
}
|
|
2975
|
+
|
|
2976
|
+
protected:
|
|
2977
|
+
NativeClipboardCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
2978
|
+
: TurboModule("Clipboard", jsInvoker),
|
|
2979
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
2980
|
+
|
|
2981
|
+
private:
|
|
2982
|
+
class Delegate : public NativeClipboardCxxSpecJSI {
|
|
2983
|
+
public:
|
|
2984
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
2985
|
+
NativeClipboardCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
2986
|
+
|
|
2987
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
2988
|
+
static_assert(
|
|
2989
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
2990
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
2991
|
+
|
|
2992
|
+
return bridging::callFromJs<jsi::Object>(
|
|
2993
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
2994
|
+
}
|
|
2995
|
+
jsi::Value getString(jsi::Runtime &rt) override {
|
|
2996
|
+
static_assert(
|
|
2997
|
+
bridging::getParameterCount(&T::getString) == 1,
|
|
2998
|
+
"Expected getString(...) to have 1 parameters");
|
|
2999
|
+
|
|
3000
|
+
return bridging::callFromJs<jsi::Value>(
|
|
3001
|
+
rt, &T::getString, jsInvoker_, instance_);
|
|
3002
|
+
}
|
|
3003
|
+
void setString(jsi::Runtime &rt, jsi::String content) override {
|
|
3004
|
+
static_assert(
|
|
3005
|
+
bridging::getParameterCount(&T::setString) == 2,
|
|
3006
|
+
"Expected setString(...) to have 2 parameters");
|
|
3007
|
+
|
|
3008
|
+
return bridging::callFromJs<void>(
|
|
3009
|
+
rt, &T::setString, jsInvoker_, instance_, std::move(content));
|
|
3010
|
+
}
|
|
3011
|
+
|
|
3012
|
+
private:
|
|
3013
|
+
T *instance_;
|
|
3014
|
+
};
|
|
3015
|
+
|
|
3016
|
+
Delegate delegate_;
|
|
3017
|
+
};
|
|
3018
|
+
|
|
3019
|
+
class JSI_EXPORT NativeAppStateCxxSpecJSI : public TurboModule {
|
|
3020
|
+
protected:
|
|
3021
|
+
NativeAppStateCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
3022
|
+
|
|
3023
|
+
public:
|
|
3024
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
3025
|
+
virtual void getCurrentAppState(jsi::Runtime &rt, jsi::Function success, jsi::Function error) = 0;
|
|
3026
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
|
|
3027
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
3028
|
+
|
|
3029
|
+
};
|
|
3030
|
+
|
|
3031
|
+
template <typename T>
|
|
3032
|
+
class JSI_EXPORT NativeAppStateCxxSpec : public TurboModule {
|
|
3033
|
+
public:
|
|
3034
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
3035
|
+
return delegate_.get(rt, propName);
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
protected:
|
|
3039
|
+
NativeAppStateCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
3040
|
+
: TurboModule("AppState", jsInvoker),
|
|
3041
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
3042
|
+
|
|
3043
|
+
private:
|
|
3044
|
+
class Delegate : public NativeAppStateCxxSpecJSI {
|
|
3045
|
+
public:
|
|
3046
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
3047
|
+
NativeAppStateCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
3048
|
+
|
|
3049
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
3050
|
+
static_assert(
|
|
3051
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
3052
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
3053
|
+
|
|
3054
|
+
return bridging::callFromJs<jsi::Object>(
|
|
3055
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
3056
|
+
}
|
|
3057
|
+
void getCurrentAppState(jsi::Runtime &rt, jsi::Function success, jsi::Function error) override {
|
|
3058
|
+
static_assert(
|
|
3059
|
+
bridging::getParameterCount(&T::getCurrentAppState) == 3,
|
|
3060
|
+
"Expected getCurrentAppState(...) to have 3 parameters");
|
|
3061
|
+
|
|
3062
|
+
return bridging::callFromJs<void>(
|
|
3063
|
+
rt, &T::getCurrentAppState, jsInvoker_, instance_, std::move(success), std::move(error));
|
|
3064
|
+
}
|
|
3065
|
+
void addListener(jsi::Runtime &rt, jsi::String eventName) override {
|
|
3066
|
+
static_assert(
|
|
3067
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
3068
|
+
"Expected addListener(...) to have 2 parameters");
|
|
3069
|
+
|
|
3070
|
+
return bridging::callFromJs<void>(
|
|
3071
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
|
|
3072
|
+
}
|
|
3073
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
3074
|
+
static_assert(
|
|
3075
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
3076
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
3077
|
+
|
|
3078
|
+
return bridging::callFromJs<void>(
|
|
3079
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3082
|
+
private:
|
|
3083
|
+
T *instance_;
|
|
3084
|
+
};
|
|
3085
|
+
|
|
3086
|
+
Delegate delegate_;
|
|
3087
|
+
};
|
|
3088
|
+
|
|
3089
|
+
#pragma mark - NativePerformanceObserverCxxBaseRawPerformanceEntry
|
|
3090
|
+
|
|
3091
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
|
|
3092
|
+
struct NativePerformanceObserverCxxBaseRawPerformanceEntry {
|
|
3093
|
+
P0 name;
|
|
3094
|
+
P1 entryType;
|
|
3095
|
+
P2 startTime;
|
|
3096
|
+
P3 duration;
|
|
3097
|
+
P4 processingStart;
|
|
3098
|
+
P5 processingEnd;
|
|
3099
|
+
P6 interactionId;
|
|
3100
|
+
bool operator==(const NativePerformanceObserverCxxBaseRawPerformanceEntry &other) const {
|
|
3101
|
+
return name == other.name && entryType == other.entryType && startTime == other.startTime && duration == other.duration && processingStart == other.processingStart && processingEnd == other.processingEnd && interactionId == other.interactionId;
|
|
3102
|
+
}
|
|
3103
|
+
};
|
|
3104
|
+
|
|
3105
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
|
|
3106
|
+
struct NativePerformanceObserverCxxBaseRawPerformanceEntryBridging {
|
|
3107
|
+
static NativePerformanceObserverCxxBaseRawPerformanceEntry<P0, P1, P2, P3, P4, P5, P6> fromJs(
|
|
3108
|
+
jsi::Runtime &rt,
|
|
3109
|
+
const jsi::Object &value,
|
|
3110
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
3111
|
+
NativePerformanceObserverCxxBaseRawPerformanceEntry<P0, P1, P2, P3, P4, P5, P6> result{
|
|
3112
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "name"), jsInvoker),
|
|
3113
|
+
bridging::fromJs<P1>(rt, value.getProperty(rt, "entryType"), jsInvoker),
|
|
3114
|
+
bridging::fromJs<P2>(rt, value.getProperty(rt, "startTime"), jsInvoker),
|
|
3115
|
+
bridging::fromJs<P3>(rt, value.getProperty(rt, "duration"), jsInvoker),
|
|
3116
|
+
bridging::fromJs<P4>(rt, value.getProperty(rt, "processingStart"), jsInvoker),
|
|
3117
|
+
bridging::fromJs<P5>(rt, value.getProperty(rt, "processingEnd"), jsInvoker),
|
|
3118
|
+
bridging::fromJs<P6>(rt, value.getProperty(rt, "interactionId"), jsInvoker)};
|
|
3119
|
+
return result;
|
|
3120
|
+
}
|
|
3121
|
+
|
|
3122
|
+
static jsi::Object toJs(
|
|
3123
|
+
jsi::Runtime &rt,
|
|
3124
|
+
const NativePerformanceObserverCxxBaseRawPerformanceEntry<P0, P1, P2, P3, P4, P5, P6> &value) {
|
|
3125
|
+
auto result = facebook::jsi::Object(rt);
|
|
3126
|
+
result.setProperty(rt, "name", bridging::toJs(rt, value.name));
|
|
3127
|
+
result.setProperty(rt, "entryType", bridging::toJs(rt, value.entryType));
|
|
3128
|
+
result.setProperty(rt, "startTime", bridging::toJs(rt, value.startTime));
|
|
3129
|
+
result.setProperty(rt, "duration", bridging::toJs(rt, value.duration));
|
|
3130
|
+
if (value.processingStart) {
|
|
3131
|
+
result.setProperty(rt, "processingStart", bridging::toJs(rt, value.processingStart.value()));
|
|
3132
|
+
}
|
|
3133
|
+
if (value.processingEnd) {
|
|
3134
|
+
result.setProperty(rt, "processingEnd", bridging::toJs(rt, value.processingEnd.value()));
|
|
3135
|
+
}
|
|
3136
|
+
if (value.interactionId) {
|
|
3137
|
+
result.setProperty(rt, "interactionId", bridging::toJs(rt, value.interactionId.value()));
|
|
3138
|
+
}
|
|
3139
|
+
return result;
|
|
3140
|
+
}
|
|
3141
|
+
};
|
|
3142
|
+
|
|
3143
|
+
class JSI_EXPORT NativePerformanceObserverCxxSpecJSI : public TurboModule {
|
|
3144
|
+
protected:
|
|
3145
|
+
NativePerformanceObserverCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
3146
|
+
|
|
3147
|
+
public:
|
|
3148
|
+
virtual void startReporting(jsi::Runtime &rt, jsi::String entryType) = 0;
|
|
3149
|
+
virtual void stopReporting(jsi::Runtime &rt, jsi::String entryType) = 0;
|
|
3150
|
+
virtual jsi::Array getPendingEntries(jsi::Runtime &rt) = 0;
|
|
3151
|
+
virtual void setOnPerformanceEntryCallback(jsi::Runtime &rt, std::optional<jsi::Function> callback) = 0;
|
|
3152
|
+
|
|
3153
|
+
};
|
|
3154
|
+
|
|
3155
|
+
template <typename T>
|
|
3156
|
+
class JSI_EXPORT NativePerformanceObserverCxxSpec : public TurboModule {
|
|
3157
|
+
public:
|
|
3158
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
3159
|
+
return delegate_.get(rt, propName);
|
|
3160
|
+
}
|
|
3161
|
+
|
|
3162
|
+
protected:
|
|
3163
|
+
NativePerformanceObserverCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
3164
|
+
: TurboModule("NativePerformanceObserverCxx", jsInvoker),
|
|
3165
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
3166
|
+
|
|
3167
|
+
private:
|
|
3168
|
+
class Delegate : public NativePerformanceObserverCxxSpecJSI {
|
|
3169
|
+
public:
|
|
3170
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
3171
|
+
NativePerformanceObserverCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
3172
|
+
|
|
3173
|
+
void startReporting(jsi::Runtime &rt, jsi::String entryType) override {
|
|
3174
|
+
static_assert(
|
|
3175
|
+
bridging::getParameterCount(&T::startReporting) == 2,
|
|
3176
|
+
"Expected startReporting(...) to have 2 parameters");
|
|
3177
|
+
|
|
3178
|
+
return bridging::callFromJs<void>(
|
|
3179
|
+
rt, &T::startReporting, jsInvoker_, instance_, std::move(entryType));
|
|
3180
|
+
}
|
|
3181
|
+
void stopReporting(jsi::Runtime &rt, jsi::String entryType) override {
|
|
3182
|
+
static_assert(
|
|
3183
|
+
bridging::getParameterCount(&T::stopReporting) == 2,
|
|
3184
|
+
"Expected stopReporting(...) to have 2 parameters");
|
|
3185
|
+
|
|
3186
|
+
return bridging::callFromJs<void>(
|
|
3187
|
+
rt, &T::stopReporting, jsInvoker_, instance_, std::move(entryType));
|
|
3188
|
+
}
|
|
3189
|
+
jsi::Array getPendingEntries(jsi::Runtime &rt) override {
|
|
3190
|
+
static_assert(
|
|
3191
|
+
bridging::getParameterCount(&T::getPendingEntries) == 1,
|
|
3192
|
+
"Expected getPendingEntries(...) to have 1 parameters");
|
|
3193
|
+
|
|
3194
|
+
return bridging::callFromJs<jsi::Array>(
|
|
3195
|
+
rt, &T::getPendingEntries, jsInvoker_, instance_);
|
|
3196
|
+
}
|
|
3197
|
+
void setOnPerformanceEntryCallback(jsi::Runtime &rt, std::optional<jsi::Function> callback) override {
|
|
3198
|
+
static_assert(
|
|
3199
|
+
bridging::getParameterCount(&T::setOnPerformanceEntryCallback) == 2,
|
|
3200
|
+
"Expected setOnPerformanceEntryCallback(...) to have 2 parameters");
|
|
3201
|
+
|
|
3202
|
+
return bridging::callFromJs<void>(
|
|
3203
|
+
rt, &T::setOnPerformanceEntryCallback, jsInvoker_, instance_, std::move(callback));
|
|
3204
|
+
}
|
|
3205
|
+
|
|
3206
|
+
private:
|
|
3207
|
+
T *instance_;
|
|
3208
|
+
};
|
|
3209
|
+
|
|
3210
|
+
Delegate delegate_;
|
|
3211
|
+
};
|
|
3212
|
+
|
|
3213
|
+
class JSI_EXPORT NativeBugReportingCxxSpecJSI : public TurboModule {
|
|
3214
|
+
protected:
|
|
3215
|
+
NativeBugReportingCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
3216
|
+
|
|
3217
|
+
public:
|
|
3218
|
+
virtual void startReportAProblemFlow(jsi::Runtime &rt) = 0;
|
|
3219
|
+
virtual void setExtraData(jsi::Runtime &rt, jsi::Object extraData, jsi::Object extraFiles) = 0;
|
|
3220
|
+
virtual void setCategoryID(jsi::Runtime &rt, jsi::String categoryID) = 0;
|
|
3221
|
+
|
|
3222
|
+
};
|
|
3223
|
+
|
|
3224
|
+
template <typename T>
|
|
3225
|
+
class JSI_EXPORT NativeBugReportingCxxSpec : public TurboModule {
|
|
3226
|
+
public:
|
|
3227
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
3228
|
+
return delegate_.get(rt, propName);
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
protected:
|
|
3232
|
+
NativeBugReportingCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
3233
|
+
: TurboModule("BugReporting", jsInvoker),
|
|
3234
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
3235
|
+
|
|
3236
|
+
private:
|
|
3237
|
+
class Delegate : public NativeBugReportingCxxSpecJSI {
|
|
3238
|
+
public:
|
|
3239
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
3240
|
+
NativeBugReportingCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
3241
|
+
|
|
3242
|
+
void startReportAProblemFlow(jsi::Runtime &rt) override {
|
|
3243
|
+
static_assert(
|
|
3244
|
+
bridging::getParameterCount(&T::startReportAProblemFlow) == 1,
|
|
3245
|
+
"Expected startReportAProblemFlow(...) to have 1 parameters");
|
|
3246
|
+
|
|
3247
|
+
return bridging::callFromJs<void>(
|
|
3248
|
+
rt, &T::startReportAProblemFlow, jsInvoker_, instance_);
|
|
3249
|
+
}
|
|
3250
|
+
void setExtraData(jsi::Runtime &rt, jsi::Object extraData, jsi::Object extraFiles) override {
|
|
3251
|
+
static_assert(
|
|
3252
|
+
bridging::getParameterCount(&T::setExtraData) == 3,
|
|
3253
|
+
"Expected setExtraData(...) to have 3 parameters");
|
|
3254
|
+
|
|
3255
|
+
return bridging::callFromJs<void>(
|
|
3256
|
+
rt, &T::setExtraData, jsInvoker_, instance_, std::move(extraData), std::move(extraFiles));
|
|
3257
|
+
}
|
|
3258
|
+
void setCategoryID(jsi::Runtime &rt, jsi::String categoryID) override {
|
|
3259
|
+
static_assert(
|
|
3260
|
+
bridging::getParameterCount(&T::setCategoryID) == 2,
|
|
3261
|
+
"Expected setCategoryID(...) to have 2 parameters");
|
|
3262
|
+
|
|
3263
|
+
return bridging::callFromJs<void>(
|
|
3264
|
+
rt, &T::setCategoryID, jsInvoker_, instance_, std::move(categoryID));
|
|
3265
|
+
}
|
|
3266
|
+
|
|
3267
|
+
private:
|
|
3268
|
+
T *instance_;
|
|
3269
|
+
};
|
|
3270
|
+
|
|
3271
|
+
Delegate delegate_;
|
|
3272
|
+
};
|
|
3273
|
+
|
|
3274
|
+
class JSI_EXPORT NativeJSCHeapCaptureCxxSpecJSI : public TurboModule {
|
|
3275
|
+
protected:
|
|
3276
|
+
NativeJSCHeapCaptureCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
3277
|
+
|
|
3278
|
+
public:
|
|
3279
|
+
virtual void captureComplete(jsi::Runtime &rt, jsi::String path, std::optional<jsi::String> error) = 0;
|
|
3280
|
+
|
|
3281
|
+
};
|
|
3282
|
+
|
|
3283
|
+
template <typename T>
|
|
3284
|
+
class JSI_EXPORT NativeJSCHeapCaptureCxxSpec : public TurboModule {
|
|
3285
|
+
public:
|
|
3286
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
3287
|
+
return delegate_.get(rt, propName);
|
|
3288
|
+
}
|
|
3289
|
+
|
|
3290
|
+
protected:
|
|
3291
|
+
NativeJSCHeapCaptureCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
3292
|
+
: TurboModule("JSCHeapCapture", jsInvoker),
|
|
3293
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
3294
|
+
|
|
3295
|
+
private:
|
|
3296
|
+
class Delegate : public NativeJSCHeapCaptureCxxSpecJSI {
|
|
3297
|
+
public:
|
|
3298
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
3299
|
+
NativeJSCHeapCaptureCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
3300
|
+
|
|
3301
|
+
void captureComplete(jsi::Runtime &rt, jsi::String path, std::optional<jsi::String> error) override {
|
|
3302
|
+
static_assert(
|
|
3303
|
+
bridging::getParameterCount(&T::captureComplete) == 3,
|
|
3304
|
+
"Expected captureComplete(...) to have 3 parameters");
|
|
3305
|
+
|
|
3306
|
+
return bridging::callFromJs<void>(
|
|
3307
|
+
rt, &T::captureComplete, jsInvoker_, instance_, std::move(path), std::move(error));
|
|
3308
|
+
}
|
|
3309
|
+
|
|
3310
|
+
private:
|
|
3311
|
+
T *instance_;
|
|
3312
|
+
};
|
|
3313
|
+
|
|
3314
|
+
Delegate delegate_;
|
|
3315
|
+
};
|
|
3316
|
+
|
|
3317
|
+
class JSI_EXPORT NativeJSCSamplingProfilerCxxSpecJSI : public TurboModule {
|
|
3318
|
+
protected:
|
|
3319
|
+
NativeJSCSamplingProfilerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
3320
|
+
|
|
3321
|
+
public:
|
|
3322
|
+
virtual void operationComplete(jsi::Runtime &rt, double token, std::optional<jsi::String> result, std::optional<jsi::String> error) = 0;
|
|
3323
|
+
|
|
3324
|
+
};
|
|
3325
|
+
|
|
3326
|
+
template <typename T>
|
|
3327
|
+
class JSI_EXPORT NativeJSCSamplingProfilerCxxSpec : public TurboModule {
|
|
3328
|
+
public:
|
|
3329
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
3330
|
+
return delegate_.get(rt, propName);
|
|
3331
|
+
}
|
|
3332
|
+
|
|
3333
|
+
protected:
|
|
3334
|
+
NativeJSCSamplingProfilerCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
3335
|
+
: TurboModule("JSCSamplingProfiler", jsInvoker),
|
|
3336
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
3337
|
+
|
|
3338
|
+
private:
|
|
3339
|
+
class Delegate : public NativeJSCSamplingProfilerCxxSpecJSI {
|
|
3340
|
+
public:
|
|
3341
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
3342
|
+
NativeJSCSamplingProfilerCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
3343
|
+
|
|
3344
|
+
void operationComplete(jsi::Runtime &rt, double token, std::optional<jsi::String> result, std::optional<jsi::String> error) override {
|
|
3345
|
+
static_assert(
|
|
3346
|
+
bridging::getParameterCount(&T::operationComplete) == 4,
|
|
3347
|
+
"Expected operationComplete(...) to have 4 parameters");
|
|
3348
|
+
|
|
3349
|
+
return bridging::callFromJs<void>(
|
|
3350
|
+
rt, &T::operationComplete, jsInvoker_, instance_, std::move(token), std::move(result), std::move(error));
|
|
3351
|
+
}
|
|
3352
|
+
|
|
3353
|
+
private:
|
|
3354
|
+
T *instance_;
|
|
3355
|
+
};
|
|
3356
|
+
|
|
3357
|
+
Delegate delegate_;
|
|
3358
|
+
};
|
|
3359
|
+
|
|
3360
|
+
class JSI_EXPORT NativeModalManagerCxxSpecJSI : public TurboModule {
|
|
3361
|
+
protected:
|
|
3362
|
+
NativeModalManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
3363
|
+
|
|
3364
|
+
public:
|
|
3365
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
|
|
3366
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
3367
|
+
|
|
3368
|
+
};
|
|
3369
|
+
|
|
3370
|
+
template <typename T>
|
|
3371
|
+
class JSI_EXPORT NativeModalManagerCxxSpec : public TurboModule {
|
|
3372
|
+
public:
|
|
3373
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
3374
|
+
return delegate_.get(rt, propName);
|
|
3375
|
+
}
|
|
3376
|
+
|
|
3377
|
+
protected:
|
|
3378
|
+
NativeModalManagerCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
3379
|
+
: TurboModule("ModalManager", jsInvoker),
|
|
3380
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
3381
|
+
|
|
3382
|
+
private:
|
|
3383
|
+
class Delegate : public NativeModalManagerCxxSpecJSI {
|
|
3384
|
+
public:
|
|
3385
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
3386
|
+
NativeModalManagerCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
3387
|
+
|
|
3388
|
+
void addListener(jsi::Runtime &rt, jsi::String eventName) override {
|
|
3389
|
+
static_assert(
|
|
3390
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
3391
|
+
"Expected addListener(...) to have 2 parameters");
|
|
3392
|
+
|
|
3393
|
+
return bridging::callFromJs<void>(
|
|
3394
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
|
|
3395
|
+
}
|
|
3396
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
3397
|
+
static_assert(
|
|
3398
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
3399
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
3400
|
+
|
|
3401
|
+
return bridging::callFromJs<void>(
|
|
3402
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
3403
|
+
}
|
|
3404
|
+
|
|
3405
|
+
private:
|
|
3406
|
+
T *instance_;
|
|
3407
|
+
};
|
|
3408
|
+
|
|
3409
|
+
Delegate delegate_;
|
|
3410
|
+
};
|
|
3411
|
+
|
|
3412
|
+
class JSI_EXPORT NativeFileReaderModuleCxxSpecJSI : public TurboModule {
|
|
3413
|
+
protected:
|
|
3414
|
+
NativeFileReaderModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
3415
|
+
|
|
3416
|
+
public:
|
|
3417
|
+
virtual jsi::Value readAsDataURL(jsi::Runtime &rt, jsi::Object data) = 0;
|
|
3418
|
+
virtual jsi::Value readAsText(jsi::Runtime &rt, jsi::Object data, jsi::String encoding) = 0;
|
|
3419
|
+
|
|
3420
|
+
};
|
|
3421
|
+
|
|
3422
|
+
template <typename T>
|
|
3423
|
+
class JSI_EXPORT NativeFileReaderModuleCxxSpec : public TurboModule {
|
|
3424
|
+
public:
|
|
3425
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
3426
|
+
return delegate_.get(rt, propName);
|
|
3427
|
+
}
|
|
3428
|
+
|
|
3429
|
+
protected:
|
|
3430
|
+
NativeFileReaderModuleCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
3431
|
+
: TurboModule("FileReaderModule", jsInvoker),
|
|
3432
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
3433
|
+
|
|
3434
|
+
private:
|
|
3435
|
+
class Delegate : public NativeFileReaderModuleCxxSpecJSI {
|
|
3436
|
+
public:
|
|
3437
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
3438
|
+
NativeFileReaderModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
3439
|
+
|
|
3440
|
+
jsi::Value readAsDataURL(jsi::Runtime &rt, jsi::Object data) override {
|
|
3441
|
+
static_assert(
|
|
3442
|
+
bridging::getParameterCount(&T::readAsDataURL) == 2,
|
|
3443
|
+
"Expected readAsDataURL(...) to have 2 parameters");
|
|
3444
|
+
|
|
3445
|
+
return bridging::callFromJs<jsi::Value>(
|
|
3446
|
+
rt, &T::readAsDataURL, jsInvoker_, instance_, std::move(data));
|
|
3447
|
+
}
|
|
3448
|
+
jsi::Value readAsText(jsi::Runtime &rt, jsi::Object data, jsi::String encoding) override {
|
|
3449
|
+
static_assert(
|
|
3450
|
+
bridging::getParameterCount(&T::readAsText) == 3,
|
|
3451
|
+
"Expected readAsText(...) to have 3 parameters");
|
|
3452
|
+
|
|
3453
|
+
return bridging::callFromJs<jsi::Value>(
|
|
3454
|
+
rt, &T::readAsText, jsInvoker_, instance_, std::move(data), std::move(encoding));
|
|
3455
|
+
}
|
|
3456
|
+
|
|
3457
|
+
private:
|
|
3458
|
+
T *instance_;
|
|
3459
|
+
};
|
|
3460
|
+
|
|
3461
|
+
Delegate delegate_;
|
|
3462
|
+
};
|
|
3463
|
+
|
|
3464
|
+
class JSI_EXPORT NativeBlobModuleCxxSpecJSI : public TurboModule {
|
|
3465
|
+
protected:
|
|
3466
|
+
NativeBlobModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
3467
|
+
|
|
3468
|
+
public:
|
|
3469
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
3470
|
+
virtual void addNetworkingHandler(jsi::Runtime &rt) = 0;
|
|
3471
|
+
virtual void addWebSocketHandler(jsi::Runtime &rt, double id) = 0;
|
|
3472
|
+
virtual void removeWebSocketHandler(jsi::Runtime &rt, double id) = 0;
|
|
3473
|
+
virtual void sendOverSocket(jsi::Runtime &rt, jsi::Object blob, double socketID) = 0;
|
|
3474
|
+
virtual void createFromParts(jsi::Runtime &rt, jsi::Array parts, jsi::String withId) = 0;
|
|
3475
|
+
virtual void release(jsi::Runtime &rt, jsi::String blobId) = 0;
|
|
3476
|
+
|
|
3477
|
+
};
|
|
3478
|
+
|
|
3479
|
+
template <typename T>
|
|
3480
|
+
class JSI_EXPORT NativeBlobModuleCxxSpec : public TurboModule {
|
|
3481
|
+
public:
|
|
3482
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
3483
|
+
return delegate_.get(rt, propName);
|
|
3484
|
+
}
|
|
3485
|
+
|
|
3486
|
+
protected:
|
|
3487
|
+
NativeBlobModuleCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
3488
|
+
: TurboModule("BlobModule", jsInvoker),
|
|
3489
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
3490
|
+
|
|
3491
|
+
private:
|
|
3492
|
+
class Delegate : public NativeBlobModuleCxxSpecJSI {
|
|
3493
|
+
public:
|
|
3494
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
3495
|
+
NativeBlobModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
3496
|
+
|
|
3497
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
3498
|
+
static_assert(
|
|
3499
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
3500
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
3501
|
+
|
|
3502
|
+
return bridging::callFromJs<jsi::Object>(
|
|
3503
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
3504
|
+
}
|
|
3505
|
+
void addNetworkingHandler(jsi::Runtime &rt) override {
|
|
3506
|
+
static_assert(
|
|
3507
|
+
bridging::getParameterCount(&T::addNetworkingHandler) == 1,
|
|
3508
|
+
"Expected addNetworkingHandler(...) to have 1 parameters");
|
|
3509
|
+
|
|
3510
|
+
return bridging::callFromJs<void>(
|
|
3511
|
+
rt, &T::addNetworkingHandler, jsInvoker_, instance_);
|
|
3512
|
+
}
|
|
3513
|
+
void addWebSocketHandler(jsi::Runtime &rt, double id) override {
|
|
3514
|
+
static_assert(
|
|
3515
|
+
bridging::getParameterCount(&T::addWebSocketHandler) == 2,
|
|
3516
|
+
"Expected addWebSocketHandler(...) to have 2 parameters");
|
|
3517
|
+
|
|
3518
|
+
return bridging::callFromJs<void>(
|
|
3519
|
+
rt, &T::addWebSocketHandler, jsInvoker_, instance_, std::move(id));
|
|
3520
|
+
}
|
|
3521
|
+
void removeWebSocketHandler(jsi::Runtime &rt, double id) override {
|
|
3522
|
+
static_assert(
|
|
3523
|
+
bridging::getParameterCount(&T::removeWebSocketHandler) == 2,
|
|
3524
|
+
"Expected removeWebSocketHandler(...) to have 2 parameters");
|
|
3525
|
+
|
|
3526
|
+
return bridging::callFromJs<void>(
|
|
3527
|
+
rt, &T::removeWebSocketHandler, jsInvoker_, instance_, std::move(id));
|
|
3528
|
+
}
|
|
3529
|
+
void sendOverSocket(jsi::Runtime &rt, jsi::Object blob, double socketID) override {
|
|
3530
|
+
static_assert(
|
|
3531
|
+
bridging::getParameterCount(&T::sendOverSocket) == 3,
|
|
3532
|
+
"Expected sendOverSocket(...) to have 3 parameters");
|
|
3533
|
+
|
|
3534
|
+
return bridging::callFromJs<void>(
|
|
3535
|
+
rt, &T::sendOverSocket, jsInvoker_, instance_, std::move(blob), std::move(socketID));
|
|
3536
|
+
}
|
|
3537
|
+
void createFromParts(jsi::Runtime &rt, jsi::Array parts, jsi::String withId) override {
|
|
3538
|
+
static_assert(
|
|
3539
|
+
bridging::getParameterCount(&T::createFromParts) == 3,
|
|
3540
|
+
"Expected createFromParts(...) to have 3 parameters");
|
|
3541
|
+
|
|
3542
|
+
return bridging::callFromJs<void>(
|
|
3543
|
+
rt, &T::createFromParts, jsInvoker_, instance_, std::move(parts), std::move(withId));
|
|
3544
|
+
}
|
|
3545
|
+
void release(jsi::Runtime &rt, jsi::String blobId) override {
|
|
3546
|
+
static_assert(
|
|
3547
|
+
bridging::getParameterCount(&T::release) == 2,
|
|
3548
|
+
"Expected release(...) to have 2 parameters");
|
|
3549
|
+
|
|
3550
|
+
return bridging::callFromJs<void>(
|
|
3551
|
+
rt, &T::release, jsInvoker_, instance_, std::move(blobId));
|
|
3552
|
+
}
|
|
3553
|
+
|
|
3554
|
+
private:
|
|
3555
|
+
T *instance_;
|
|
3556
|
+
};
|
|
3557
|
+
|
|
3558
|
+
Delegate delegate_;
|
|
3559
|
+
};
|
|
3560
|
+
|
|
3561
|
+
class JSI_EXPORT NativeFrameRateLoggerCxxSpecJSI : public TurboModule {
|
|
3562
|
+
protected:
|
|
3563
|
+
NativeFrameRateLoggerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
3564
|
+
|
|
3565
|
+
public:
|
|
3566
|
+
virtual void setGlobalOptions(jsi::Runtime &rt, jsi::Object options) = 0;
|
|
3567
|
+
virtual void setContext(jsi::Runtime &rt, jsi::String context) = 0;
|
|
3568
|
+
virtual void beginScroll(jsi::Runtime &rt) = 0;
|
|
3569
|
+
virtual void endScroll(jsi::Runtime &rt) = 0;
|
|
3570
|
+
|
|
3571
|
+
};
|
|
3572
|
+
|
|
3573
|
+
template <typename T>
|
|
3574
|
+
class JSI_EXPORT NativeFrameRateLoggerCxxSpec : public TurboModule {
|
|
3575
|
+
public:
|
|
3576
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
3577
|
+
return delegate_.get(rt, propName);
|
|
3578
|
+
}
|
|
3579
|
+
|
|
3580
|
+
protected:
|
|
3581
|
+
NativeFrameRateLoggerCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
3582
|
+
: TurboModule("FrameRateLogger", jsInvoker),
|
|
3583
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
3584
|
+
|
|
3585
|
+
private:
|
|
3586
|
+
class Delegate : public NativeFrameRateLoggerCxxSpecJSI {
|
|
3587
|
+
public:
|
|
3588
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
3589
|
+
NativeFrameRateLoggerCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
3590
|
+
|
|
3591
|
+
void setGlobalOptions(jsi::Runtime &rt, jsi::Object options) override {
|
|
3592
|
+
static_assert(
|
|
3593
|
+
bridging::getParameterCount(&T::setGlobalOptions) == 2,
|
|
3594
|
+
"Expected setGlobalOptions(...) to have 2 parameters");
|
|
3595
|
+
|
|
3596
|
+
return bridging::callFromJs<void>(
|
|
3597
|
+
rt, &T::setGlobalOptions, jsInvoker_, instance_, std::move(options));
|
|
3598
|
+
}
|
|
3599
|
+
void setContext(jsi::Runtime &rt, jsi::String context) override {
|
|
3600
|
+
static_assert(
|
|
3601
|
+
bridging::getParameterCount(&T::setContext) == 2,
|
|
3602
|
+
"Expected setContext(...) to have 2 parameters");
|
|
3603
|
+
|
|
3604
|
+
return bridging::callFromJs<void>(
|
|
3605
|
+
rt, &T::setContext, jsInvoker_, instance_, std::move(context));
|
|
3606
|
+
}
|
|
3607
|
+
void beginScroll(jsi::Runtime &rt) override {
|
|
3608
|
+
static_assert(
|
|
3609
|
+
bridging::getParameterCount(&T::beginScroll) == 1,
|
|
3610
|
+
"Expected beginScroll(...) to have 1 parameters");
|
|
3611
|
+
|
|
3612
|
+
return bridging::callFromJs<void>(
|
|
3613
|
+
rt, &T::beginScroll, jsInvoker_, instance_);
|
|
3614
|
+
}
|
|
3615
|
+
void endScroll(jsi::Runtime &rt) override {
|
|
3616
|
+
static_assert(
|
|
3617
|
+
bridging::getParameterCount(&T::endScroll) == 1,
|
|
3618
|
+
"Expected endScroll(...) to have 1 parameters");
|
|
3619
|
+
|
|
3620
|
+
return bridging::callFromJs<void>(
|
|
3621
|
+
rt, &T::endScroll, jsInvoker_, instance_);
|
|
3622
|
+
}
|
|
3623
|
+
|
|
3624
|
+
private:
|
|
3625
|
+
T *instance_;
|
|
3626
|
+
};
|
|
3627
|
+
|
|
3628
|
+
Delegate delegate_;
|
|
3629
|
+
};
|
|
3630
|
+
|
|
3631
|
+
class JSI_EXPORT NativeI18nManagerCxxSpecJSI : public TurboModule {
|
|
3632
|
+
protected:
|
|
3633
|
+
NativeI18nManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
3634
|
+
|
|
3635
|
+
public:
|
|
3636
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
3637
|
+
virtual void allowRTL(jsi::Runtime &rt, bool allowRTL) = 0;
|
|
3638
|
+
virtual void forceRTL(jsi::Runtime &rt, bool forceRTL) = 0;
|
|
3639
|
+
virtual void swapLeftAndRightInRTL(jsi::Runtime &rt, bool flipStyles) = 0;
|
|
3640
|
+
|
|
3641
|
+
};
|
|
3642
|
+
|
|
3643
|
+
template <typename T>
|
|
3644
|
+
class JSI_EXPORT NativeI18nManagerCxxSpec : public TurboModule {
|
|
3645
|
+
public:
|
|
3646
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
3647
|
+
return delegate_.get(rt, propName);
|
|
3648
|
+
}
|
|
3649
|
+
|
|
3650
|
+
protected:
|
|
3651
|
+
NativeI18nManagerCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
3652
|
+
: TurboModule("I18nManager", jsInvoker),
|
|
3653
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
3654
|
+
|
|
3655
|
+
private:
|
|
3656
|
+
class Delegate : public NativeI18nManagerCxxSpecJSI {
|
|
3657
|
+
public:
|
|
3658
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
3659
|
+
NativeI18nManagerCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
3660
|
+
|
|
3661
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
3662
|
+
static_assert(
|
|
3663
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
3664
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
3665
|
+
|
|
3666
|
+
return bridging::callFromJs<jsi::Object>(
|
|
3667
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
3668
|
+
}
|
|
3669
|
+
void allowRTL(jsi::Runtime &rt, bool allowRTL) override {
|
|
3670
|
+
static_assert(
|
|
3671
|
+
bridging::getParameterCount(&T::allowRTL) == 2,
|
|
3672
|
+
"Expected allowRTL(...) to have 2 parameters");
|
|
3673
|
+
|
|
3674
|
+
return bridging::callFromJs<void>(
|
|
3675
|
+
rt, &T::allowRTL, jsInvoker_, instance_, std::move(allowRTL));
|
|
3676
|
+
}
|
|
3677
|
+
void forceRTL(jsi::Runtime &rt, bool forceRTL) override {
|
|
3678
|
+
static_assert(
|
|
3679
|
+
bridging::getParameterCount(&T::forceRTL) == 2,
|
|
3680
|
+
"Expected forceRTL(...) to have 2 parameters");
|
|
3681
|
+
|
|
3682
|
+
return bridging::callFromJs<void>(
|
|
3683
|
+
rt, &T::forceRTL, jsInvoker_, instance_, std::move(forceRTL));
|
|
3684
|
+
}
|
|
3685
|
+
void swapLeftAndRightInRTL(jsi::Runtime &rt, bool flipStyles) override {
|
|
3686
|
+
static_assert(
|
|
3687
|
+
bridging::getParameterCount(&T::swapLeftAndRightInRTL) == 2,
|
|
3688
|
+
"Expected swapLeftAndRightInRTL(...) to have 2 parameters");
|
|
3689
|
+
|
|
3690
|
+
return bridging::callFromJs<void>(
|
|
3691
|
+
rt, &T::swapLeftAndRightInRTL, jsInvoker_, instance_, std::move(flipStyles));
|
|
3692
|
+
}
|
|
3693
|
+
|
|
3694
|
+
private:
|
|
3695
|
+
T *instance_;
|
|
3696
|
+
};
|
|
3697
|
+
|
|
3698
|
+
Delegate delegate_;
|
|
3699
|
+
};
|
|
3700
|
+
|
|
3701
|
+
class JSI_EXPORT NativeHeadlessJsTaskSupportCxxSpecJSI : public TurboModule {
|
|
3702
|
+
protected:
|
|
3703
|
+
NativeHeadlessJsTaskSupportCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
3704
|
+
|
|
3705
|
+
public:
|
|
3706
|
+
virtual void notifyTaskFinished(jsi::Runtime &rt, double taskId) = 0;
|
|
3707
|
+
virtual jsi::Value notifyTaskRetry(jsi::Runtime &rt, double taskId) = 0;
|
|
3708
|
+
|
|
3709
|
+
};
|
|
3710
|
+
|
|
3711
|
+
template <typename T>
|
|
3712
|
+
class JSI_EXPORT NativeHeadlessJsTaskSupportCxxSpec : public TurboModule {
|
|
3713
|
+
public:
|
|
3714
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
3715
|
+
return delegate_.get(rt, propName);
|
|
3716
|
+
}
|
|
3717
|
+
|
|
3718
|
+
protected:
|
|
3719
|
+
NativeHeadlessJsTaskSupportCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
3720
|
+
: TurboModule("HeadlessJsTaskSupport", jsInvoker),
|
|
3721
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
3722
|
+
|
|
3723
|
+
private:
|
|
3724
|
+
class Delegate : public NativeHeadlessJsTaskSupportCxxSpecJSI {
|
|
3725
|
+
public:
|
|
3726
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
3727
|
+
NativeHeadlessJsTaskSupportCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
3728
|
+
|
|
3729
|
+
void notifyTaskFinished(jsi::Runtime &rt, double taskId) override {
|
|
3730
|
+
static_assert(
|
|
3731
|
+
bridging::getParameterCount(&T::notifyTaskFinished) == 2,
|
|
3732
|
+
"Expected notifyTaskFinished(...) to have 2 parameters");
|
|
3733
|
+
|
|
3734
|
+
return bridging::callFromJs<void>(
|
|
3735
|
+
rt, &T::notifyTaskFinished, jsInvoker_, instance_, std::move(taskId));
|
|
3736
|
+
}
|
|
3737
|
+
jsi::Value notifyTaskRetry(jsi::Runtime &rt, double taskId) override {
|
|
3738
|
+
static_assert(
|
|
3739
|
+
bridging::getParameterCount(&T::notifyTaskRetry) == 2,
|
|
3740
|
+
"Expected notifyTaskRetry(...) to have 2 parameters");
|
|
3741
|
+
|
|
3742
|
+
return bridging::callFromJs<jsi::Value>(
|
|
3743
|
+
rt, &T::notifyTaskRetry, jsInvoker_, instance_, std::move(taskId));
|
|
3744
|
+
}
|
|
3745
|
+
|
|
3746
|
+
private:
|
|
3747
|
+
T *instance_;
|
|
3748
|
+
};
|
|
3749
|
+
|
|
3750
|
+
Delegate delegate_;
|
|
3751
|
+
};
|
|
3752
|
+
|
|
3753
|
+
#pragma mark - NativeAnimatedTurboModuleBaseEndResult
|
|
3754
|
+
|
|
3755
|
+
template <typename P0>
|
|
3756
|
+
struct NativeAnimatedTurboModuleBaseEndResult {
|
|
3757
|
+
P0 finished;
|
|
3758
|
+
bool operator==(const NativeAnimatedTurboModuleBaseEndResult &other) const {
|
|
3759
|
+
return finished == other.finished;
|
|
3760
|
+
}
|
|
3761
|
+
};
|
|
3762
|
+
|
|
3763
|
+
template <typename P0>
|
|
3764
|
+
struct NativeAnimatedTurboModuleBaseEndResultBridging {
|
|
3765
|
+
static NativeAnimatedTurboModuleBaseEndResult<P0> fromJs(
|
|
3766
|
+
jsi::Runtime &rt,
|
|
3767
|
+
const jsi::Object &value,
|
|
3768
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
3769
|
+
NativeAnimatedTurboModuleBaseEndResult<P0> result{
|
|
3770
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "finished"), jsInvoker)};
|
|
3771
|
+
return result;
|
|
3772
|
+
}
|
|
3773
|
+
|
|
3774
|
+
static jsi::Object toJs(
|
|
3775
|
+
jsi::Runtime &rt,
|
|
3776
|
+
const NativeAnimatedTurboModuleBaseEndResult<P0> &value) {
|
|
3777
|
+
auto result = facebook::jsi::Object(rt);
|
|
3778
|
+
result.setProperty(rt, "finished", bridging::toJs(rt, value.finished));
|
|
3779
|
+
return result;
|
|
3780
|
+
}
|
|
3781
|
+
};
|
|
3782
|
+
|
|
3783
|
+
|
|
3784
|
+
#pragma mark - NativeAnimatedTurboModuleBaseEventMapping
|
|
3785
|
+
|
|
3786
|
+
template <typename P0, typename P1>
|
|
3787
|
+
struct NativeAnimatedTurboModuleBaseEventMapping {
|
|
3788
|
+
P0 nativeEventPath;
|
|
3789
|
+
P1 animatedValueTag;
|
|
3790
|
+
bool operator==(const NativeAnimatedTurboModuleBaseEventMapping &other) const {
|
|
3791
|
+
return nativeEventPath == other.nativeEventPath && animatedValueTag == other.animatedValueTag;
|
|
3792
|
+
}
|
|
3793
|
+
};
|
|
3794
|
+
|
|
3795
|
+
template <typename P0, typename P1>
|
|
3796
|
+
struct NativeAnimatedTurboModuleBaseEventMappingBridging {
|
|
3797
|
+
static NativeAnimatedTurboModuleBaseEventMapping<P0, P1> fromJs(
|
|
3798
|
+
jsi::Runtime &rt,
|
|
3799
|
+
const jsi::Object &value,
|
|
3800
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
3801
|
+
NativeAnimatedTurboModuleBaseEventMapping<P0, P1> result{
|
|
3802
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "nativeEventPath"), jsInvoker),
|
|
3803
|
+
bridging::fromJs<P1>(rt, value.getProperty(rt, "animatedValueTag"), jsInvoker)};
|
|
3804
|
+
return result;
|
|
3805
|
+
}
|
|
3806
|
+
|
|
3807
|
+
static jsi::Object toJs(
|
|
3808
|
+
jsi::Runtime &rt,
|
|
3809
|
+
const NativeAnimatedTurboModuleBaseEventMapping<P0, P1> &value) {
|
|
3810
|
+
auto result = facebook::jsi::Object(rt);
|
|
3811
|
+
result.setProperty(rt, "nativeEventPath", bridging::toJs(rt, value.nativeEventPath));
|
|
3812
|
+
result.setProperty(rt, "animatedValueTag", bridging::toJs(rt, value.animatedValueTag));
|
|
3813
|
+
return result;
|
|
3814
|
+
}
|
|
3815
|
+
};
|
|
3816
|
+
|
|
3817
|
+
class JSI_EXPORT NativeAnimatedTurboModuleCxxSpecJSI : public TurboModule {
|
|
3818
|
+
protected:
|
|
3819
|
+
NativeAnimatedTurboModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
3820
|
+
|
|
3821
|
+
public:
|
|
3822
|
+
virtual void startOperationBatch(jsi::Runtime &rt) = 0;
|
|
3823
|
+
virtual void finishOperationBatch(jsi::Runtime &rt) = 0;
|
|
3824
|
+
virtual void createAnimatedNode(jsi::Runtime &rt, double tag, jsi::Object config) = 0;
|
|
3825
|
+
virtual void updateAnimatedNodeConfig(jsi::Runtime &rt, double tag, jsi::Object config) = 0;
|
|
3826
|
+
virtual void getValue(jsi::Runtime &rt, double tag, jsi::Function saveValueCallback) = 0;
|
|
3827
|
+
virtual void startListeningToAnimatedNodeValue(jsi::Runtime &rt, double tag) = 0;
|
|
3828
|
+
virtual void stopListeningToAnimatedNodeValue(jsi::Runtime &rt, double tag) = 0;
|
|
3829
|
+
virtual void connectAnimatedNodes(jsi::Runtime &rt, double parentTag, double childTag) = 0;
|
|
3830
|
+
virtual void disconnectAnimatedNodes(jsi::Runtime &rt, double parentTag, double childTag) = 0;
|
|
3831
|
+
virtual void startAnimatingNode(jsi::Runtime &rt, double animationId, double nodeTag, jsi::Object config, jsi::Function endCallback) = 0;
|
|
3832
|
+
virtual void stopAnimation(jsi::Runtime &rt, double animationId) = 0;
|
|
3833
|
+
virtual void setAnimatedNodeValue(jsi::Runtime &rt, double nodeTag, double value) = 0;
|
|
3834
|
+
virtual void setAnimatedNodeOffset(jsi::Runtime &rt, double nodeTag, double offset) = 0;
|
|
3835
|
+
virtual void flattenAnimatedNodeOffset(jsi::Runtime &rt, double nodeTag) = 0;
|
|
3836
|
+
virtual void extractAnimatedNodeOffset(jsi::Runtime &rt, double nodeTag) = 0;
|
|
3837
|
+
virtual void connectAnimatedNodeToView(jsi::Runtime &rt, double nodeTag, double viewTag) = 0;
|
|
3838
|
+
virtual void disconnectAnimatedNodeFromView(jsi::Runtime &rt, double nodeTag, double viewTag) = 0;
|
|
3839
|
+
virtual void restoreDefaultValues(jsi::Runtime &rt, double nodeTag) = 0;
|
|
3840
|
+
virtual void dropAnimatedNode(jsi::Runtime &rt, double tag) = 0;
|
|
3841
|
+
virtual void addAnimatedEventToView(jsi::Runtime &rt, double viewTag, jsi::String eventName, jsi::Object eventMapping) = 0;
|
|
3842
|
+
virtual void removeAnimatedEventFromView(jsi::Runtime &rt, double viewTag, jsi::String eventName, double animatedNodeTag) = 0;
|
|
3843
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
|
|
3844
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
3845
|
+
virtual void queueAndExecuteBatchedOperations(jsi::Runtime &rt, jsi::Array operationsAndArgs) = 0;
|
|
3846
|
+
|
|
3847
|
+
};
|
|
3848
|
+
|
|
3849
|
+
template <typename T>
|
|
3850
|
+
class JSI_EXPORT NativeAnimatedTurboModuleCxxSpec : public TurboModule {
|
|
3851
|
+
public:
|
|
3852
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
3853
|
+
return delegate_.get(rt, propName);
|
|
3854
|
+
}
|
|
3855
|
+
|
|
3856
|
+
protected:
|
|
3857
|
+
NativeAnimatedTurboModuleCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
3858
|
+
: TurboModule("NativeAnimatedTurboModule", jsInvoker),
|
|
3859
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
3860
|
+
|
|
3861
|
+
private:
|
|
3862
|
+
class Delegate : public NativeAnimatedTurboModuleCxxSpecJSI {
|
|
3863
|
+
public:
|
|
3864
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
3865
|
+
NativeAnimatedTurboModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
3866
|
+
|
|
3867
|
+
void startOperationBatch(jsi::Runtime &rt) override {
|
|
3868
|
+
static_assert(
|
|
3869
|
+
bridging::getParameterCount(&T::startOperationBatch) == 1,
|
|
3870
|
+
"Expected startOperationBatch(...) to have 1 parameters");
|
|
3871
|
+
|
|
3872
|
+
return bridging::callFromJs<void>(
|
|
3873
|
+
rt, &T::startOperationBatch, jsInvoker_, instance_);
|
|
3874
|
+
}
|
|
3875
|
+
void finishOperationBatch(jsi::Runtime &rt) override {
|
|
3876
|
+
static_assert(
|
|
3877
|
+
bridging::getParameterCount(&T::finishOperationBatch) == 1,
|
|
3878
|
+
"Expected finishOperationBatch(...) to have 1 parameters");
|
|
3879
|
+
|
|
3880
|
+
return bridging::callFromJs<void>(
|
|
3881
|
+
rt, &T::finishOperationBatch, jsInvoker_, instance_);
|
|
3882
|
+
}
|
|
3883
|
+
void createAnimatedNode(jsi::Runtime &rt, double tag, jsi::Object config) override {
|
|
3884
|
+
static_assert(
|
|
3885
|
+
bridging::getParameterCount(&T::createAnimatedNode) == 3,
|
|
3886
|
+
"Expected createAnimatedNode(...) to have 3 parameters");
|
|
3887
|
+
|
|
3888
|
+
return bridging::callFromJs<void>(
|
|
3889
|
+
rt, &T::createAnimatedNode, jsInvoker_, instance_, std::move(tag), std::move(config));
|
|
3890
|
+
}
|
|
3891
|
+
void updateAnimatedNodeConfig(jsi::Runtime &rt, double tag, jsi::Object config) override {
|
|
3892
|
+
static_assert(
|
|
3893
|
+
bridging::getParameterCount(&T::updateAnimatedNodeConfig) == 3,
|
|
3894
|
+
"Expected updateAnimatedNodeConfig(...) to have 3 parameters");
|
|
3895
|
+
|
|
3896
|
+
return bridging::callFromJs<void>(
|
|
3897
|
+
rt, &T::updateAnimatedNodeConfig, jsInvoker_, instance_, std::move(tag), std::move(config));
|
|
3898
|
+
}
|
|
3899
|
+
void getValue(jsi::Runtime &rt, double tag, jsi::Function saveValueCallback) override {
|
|
3900
|
+
static_assert(
|
|
3901
|
+
bridging::getParameterCount(&T::getValue) == 3,
|
|
3902
|
+
"Expected getValue(...) to have 3 parameters");
|
|
3903
|
+
|
|
3904
|
+
return bridging::callFromJs<void>(
|
|
3905
|
+
rt, &T::getValue, jsInvoker_, instance_, std::move(tag), std::move(saveValueCallback));
|
|
3906
|
+
}
|
|
3907
|
+
void startListeningToAnimatedNodeValue(jsi::Runtime &rt, double tag) override {
|
|
3908
|
+
static_assert(
|
|
3909
|
+
bridging::getParameterCount(&T::startListeningToAnimatedNodeValue) == 2,
|
|
3910
|
+
"Expected startListeningToAnimatedNodeValue(...) to have 2 parameters");
|
|
3911
|
+
|
|
3912
|
+
return bridging::callFromJs<void>(
|
|
3913
|
+
rt, &T::startListeningToAnimatedNodeValue, jsInvoker_, instance_, std::move(tag));
|
|
3914
|
+
}
|
|
3915
|
+
void stopListeningToAnimatedNodeValue(jsi::Runtime &rt, double tag) override {
|
|
3916
|
+
static_assert(
|
|
3917
|
+
bridging::getParameterCount(&T::stopListeningToAnimatedNodeValue) == 2,
|
|
3918
|
+
"Expected stopListeningToAnimatedNodeValue(...) to have 2 parameters");
|
|
3919
|
+
|
|
3920
|
+
return bridging::callFromJs<void>(
|
|
3921
|
+
rt, &T::stopListeningToAnimatedNodeValue, jsInvoker_, instance_, std::move(tag));
|
|
3922
|
+
}
|
|
3923
|
+
void connectAnimatedNodes(jsi::Runtime &rt, double parentTag, double childTag) override {
|
|
3924
|
+
static_assert(
|
|
3925
|
+
bridging::getParameterCount(&T::connectAnimatedNodes) == 3,
|
|
3926
|
+
"Expected connectAnimatedNodes(...) to have 3 parameters");
|
|
3927
|
+
|
|
3928
|
+
return bridging::callFromJs<void>(
|
|
3929
|
+
rt, &T::connectAnimatedNodes, jsInvoker_, instance_, std::move(parentTag), std::move(childTag));
|
|
3930
|
+
}
|
|
3931
|
+
void disconnectAnimatedNodes(jsi::Runtime &rt, double parentTag, double childTag) override {
|
|
3932
|
+
static_assert(
|
|
3933
|
+
bridging::getParameterCount(&T::disconnectAnimatedNodes) == 3,
|
|
3934
|
+
"Expected disconnectAnimatedNodes(...) to have 3 parameters");
|
|
3935
|
+
|
|
3936
|
+
return bridging::callFromJs<void>(
|
|
3937
|
+
rt, &T::disconnectAnimatedNodes, jsInvoker_, instance_, std::move(parentTag), std::move(childTag));
|
|
3938
|
+
}
|
|
3939
|
+
void startAnimatingNode(jsi::Runtime &rt, double animationId, double nodeTag, jsi::Object config, jsi::Function endCallback) override {
|
|
3940
|
+
static_assert(
|
|
3941
|
+
bridging::getParameterCount(&T::startAnimatingNode) == 5,
|
|
3942
|
+
"Expected startAnimatingNode(...) to have 5 parameters");
|
|
3943
|
+
|
|
3944
|
+
return bridging::callFromJs<void>(
|
|
3945
|
+
rt, &T::startAnimatingNode, jsInvoker_, instance_, std::move(animationId), std::move(nodeTag), std::move(config), std::move(endCallback));
|
|
3946
|
+
}
|
|
3947
|
+
void stopAnimation(jsi::Runtime &rt, double animationId) override {
|
|
3948
|
+
static_assert(
|
|
3949
|
+
bridging::getParameterCount(&T::stopAnimation) == 2,
|
|
3950
|
+
"Expected stopAnimation(...) to have 2 parameters");
|
|
3951
|
+
|
|
3952
|
+
return bridging::callFromJs<void>(
|
|
3953
|
+
rt, &T::stopAnimation, jsInvoker_, instance_, std::move(animationId));
|
|
3954
|
+
}
|
|
3955
|
+
void setAnimatedNodeValue(jsi::Runtime &rt, double nodeTag, double value) override {
|
|
3956
|
+
static_assert(
|
|
3957
|
+
bridging::getParameterCount(&T::setAnimatedNodeValue) == 3,
|
|
3958
|
+
"Expected setAnimatedNodeValue(...) to have 3 parameters");
|
|
3959
|
+
|
|
3960
|
+
return bridging::callFromJs<void>(
|
|
3961
|
+
rt, &T::setAnimatedNodeValue, jsInvoker_, instance_, std::move(nodeTag), std::move(value));
|
|
3962
|
+
}
|
|
3963
|
+
void setAnimatedNodeOffset(jsi::Runtime &rt, double nodeTag, double offset) override {
|
|
3964
|
+
static_assert(
|
|
3965
|
+
bridging::getParameterCount(&T::setAnimatedNodeOffset) == 3,
|
|
3966
|
+
"Expected setAnimatedNodeOffset(...) to have 3 parameters");
|
|
3967
|
+
|
|
3968
|
+
return bridging::callFromJs<void>(
|
|
3969
|
+
rt, &T::setAnimatedNodeOffset, jsInvoker_, instance_, std::move(nodeTag), std::move(offset));
|
|
3970
|
+
}
|
|
3971
|
+
void flattenAnimatedNodeOffset(jsi::Runtime &rt, double nodeTag) override {
|
|
3972
|
+
static_assert(
|
|
3973
|
+
bridging::getParameterCount(&T::flattenAnimatedNodeOffset) == 2,
|
|
3974
|
+
"Expected flattenAnimatedNodeOffset(...) to have 2 parameters");
|
|
3975
|
+
|
|
3976
|
+
return bridging::callFromJs<void>(
|
|
3977
|
+
rt, &T::flattenAnimatedNodeOffset, jsInvoker_, instance_, std::move(nodeTag));
|
|
3978
|
+
}
|
|
3979
|
+
void extractAnimatedNodeOffset(jsi::Runtime &rt, double nodeTag) override {
|
|
3980
|
+
static_assert(
|
|
3981
|
+
bridging::getParameterCount(&T::extractAnimatedNodeOffset) == 2,
|
|
3982
|
+
"Expected extractAnimatedNodeOffset(...) to have 2 parameters");
|
|
3983
|
+
|
|
3984
|
+
return bridging::callFromJs<void>(
|
|
3985
|
+
rt, &T::extractAnimatedNodeOffset, jsInvoker_, instance_, std::move(nodeTag));
|
|
3986
|
+
}
|
|
3987
|
+
void connectAnimatedNodeToView(jsi::Runtime &rt, double nodeTag, double viewTag) override {
|
|
3988
|
+
static_assert(
|
|
3989
|
+
bridging::getParameterCount(&T::connectAnimatedNodeToView) == 3,
|
|
3990
|
+
"Expected connectAnimatedNodeToView(...) to have 3 parameters");
|
|
3991
|
+
|
|
3992
|
+
return bridging::callFromJs<void>(
|
|
3993
|
+
rt, &T::connectAnimatedNodeToView, jsInvoker_, instance_, std::move(nodeTag), std::move(viewTag));
|
|
3994
|
+
}
|
|
3995
|
+
void disconnectAnimatedNodeFromView(jsi::Runtime &rt, double nodeTag, double viewTag) override {
|
|
3996
|
+
static_assert(
|
|
3997
|
+
bridging::getParameterCount(&T::disconnectAnimatedNodeFromView) == 3,
|
|
3998
|
+
"Expected disconnectAnimatedNodeFromView(...) to have 3 parameters");
|
|
3999
|
+
|
|
4000
|
+
return bridging::callFromJs<void>(
|
|
4001
|
+
rt, &T::disconnectAnimatedNodeFromView, jsInvoker_, instance_, std::move(nodeTag), std::move(viewTag));
|
|
4002
|
+
}
|
|
4003
|
+
void restoreDefaultValues(jsi::Runtime &rt, double nodeTag) override {
|
|
4004
|
+
static_assert(
|
|
4005
|
+
bridging::getParameterCount(&T::restoreDefaultValues) == 2,
|
|
4006
|
+
"Expected restoreDefaultValues(...) to have 2 parameters");
|
|
4007
|
+
|
|
4008
|
+
return bridging::callFromJs<void>(
|
|
4009
|
+
rt, &T::restoreDefaultValues, jsInvoker_, instance_, std::move(nodeTag));
|
|
4010
|
+
}
|
|
4011
|
+
void dropAnimatedNode(jsi::Runtime &rt, double tag) override {
|
|
4012
|
+
static_assert(
|
|
4013
|
+
bridging::getParameterCount(&T::dropAnimatedNode) == 2,
|
|
4014
|
+
"Expected dropAnimatedNode(...) to have 2 parameters");
|
|
4015
|
+
|
|
4016
|
+
return bridging::callFromJs<void>(
|
|
4017
|
+
rt, &T::dropAnimatedNode, jsInvoker_, instance_, std::move(tag));
|
|
4018
|
+
}
|
|
4019
|
+
void addAnimatedEventToView(jsi::Runtime &rt, double viewTag, jsi::String eventName, jsi::Object eventMapping) override {
|
|
4020
|
+
static_assert(
|
|
4021
|
+
bridging::getParameterCount(&T::addAnimatedEventToView) == 4,
|
|
4022
|
+
"Expected addAnimatedEventToView(...) to have 4 parameters");
|
|
4023
|
+
|
|
4024
|
+
return bridging::callFromJs<void>(
|
|
4025
|
+
rt, &T::addAnimatedEventToView, jsInvoker_, instance_, std::move(viewTag), std::move(eventName), std::move(eventMapping));
|
|
4026
|
+
}
|
|
4027
|
+
void removeAnimatedEventFromView(jsi::Runtime &rt, double viewTag, jsi::String eventName, double animatedNodeTag) override {
|
|
4028
|
+
static_assert(
|
|
4029
|
+
bridging::getParameterCount(&T::removeAnimatedEventFromView) == 4,
|
|
4030
|
+
"Expected removeAnimatedEventFromView(...) to have 4 parameters");
|
|
4031
|
+
|
|
4032
|
+
return bridging::callFromJs<void>(
|
|
4033
|
+
rt, &T::removeAnimatedEventFromView, jsInvoker_, instance_, std::move(viewTag), std::move(eventName), std::move(animatedNodeTag));
|
|
4034
|
+
}
|
|
4035
|
+
void addListener(jsi::Runtime &rt, jsi::String eventName) override {
|
|
4036
|
+
static_assert(
|
|
4037
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
4038
|
+
"Expected addListener(...) to have 2 parameters");
|
|
4039
|
+
|
|
4040
|
+
return bridging::callFromJs<void>(
|
|
4041
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
|
|
4042
|
+
}
|
|
4043
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
4044
|
+
static_assert(
|
|
4045
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
4046
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
4047
|
+
|
|
4048
|
+
return bridging::callFromJs<void>(
|
|
4049
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
4050
|
+
}
|
|
4051
|
+
void queueAndExecuteBatchedOperations(jsi::Runtime &rt, jsi::Array operationsAndArgs) override {
|
|
4052
|
+
static_assert(
|
|
4053
|
+
bridging::getParameterCount(&T::queueAndExecuteBatchedOperations) == 2,
|
|
4054
|
+
"Expected queueAndExecuteBatchedOperations(...) to have 2 parameters");
|
|
4055
|
+
|
|
4056
|
+
return bridging::callFromJs<void>(
|
|
4057
|
+
rt, &T::queueAndExecuteBatchedOperations, jsInvoker_, instance_, std::move(operationsAndArgs));
|
|
4058
|
+
}
|
|
4059
|
+
|
|
4060
|
+
private:
|
|
4061
|
+
T *instance_;
|
|
4062
|
+
};
|
|
4063
|
+
|
|
4064
|
+
Delegate delegate_;
|
|
4065
|
+
};
|
|
4066
|
+
|
|
4067
|
+
#pragma mark - NativeAnimatedModuleBaseEndResult
|
|
4068
|
+
|
|
4069
|
+
template <typename P0>
|
|
4070
|
+
struct NativeAnimatedModuleBaseEndResult {
|
|
4071
|
+
P0 finished;
|
|
4072
|
+
bool operator==(const NativeAnimatedModuleBaseEndResult &other) const {
|
|
4073
|
+
return finished == other.finished;
|
|
4074
|
+
}
|
|
4075
|
+
};
|
|
4076
|
+
|
|
4077
|
+
template <typename P0>
|
|
4078
|
+
struct NativeAnimatedModuleBaseEndResultBridging {
|
|
4079
|
+
static NativeAnimatedModuleBaseEndResult<P0> fromJs(
|
|
4080
|
+
jsi::Runtime &rt,
|
|
4081
|
+
const jsi::Object &value,
|
|
4082
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
4083
|
+
NativeAnimatedModuleBaseEndResult<P0> result{
|
|
4084
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "finished"), jsInvoker)};
|
|
4085
|
+
return result;
|
|
4086
|
+
}
|
|
4087
|
+
|
|
4088
|
+
static jsi::Object toJs(
|
|
4089
|
+
jsi::Runtime &rt,
|
|
4090
|
+
const NativeAnimatedModuleBaseEndResult<P0> &value) {
|
|
4091
|
+
auto result = facebook::jsi::Object(rt);
|
|
4092
|
+
result.setProperty(rt, "finished", bridging::toJs(rt, value.finished));
|
|
4093
|
+
return result;
|
|
4094
|
+
}
|
|
4095
|
+
};
|
|
4096
|
+
|
|
4097
|
+
|
|
4098
|
+
#pragma mark - NativeAnimatedModuleBaseEventMapping
|
|
4099
|
+
|
|
4100
|
+
template <typename P0, typename P1>
|
|
4101
|
+
struct NativeAnimatedModuleBaseEventMapping {
|
|
4102
|
+
P0 nativeEventPath;
|
|
4103
|
+
P1 animatedValueTag;
|
|
4104
|
+
bool operator==(const NativeAnimatedModuleBaseEventMapping &other) const {
|
|
4105
|
+
return nativeEventPath == other.nativeEventPath && animatedValueTag == other.animatedValueTag;
|
|
4106
|
+
}
|
|
4107
|
+
};
|
|
4108
|
+
|
|
4109
|
+
template <typename P0, typename P1>
|
|
4110
|
+
struct NativeAnimatedModuleBaseEventMappingBridging {
|
|
4111
|
+
static NativeAnimatedModuleBaseEventMapping<P0, P1> fromJs(
|
|
4112
|
+
jsi::Runtime &rt,
|
|
4113
|
+
const jsi::Object &value,
|
|
4114
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
4115
|
+
NativeAnimatedModuleBaseEventMapping<P0, P1> result{
|
|
4116
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "nativeEventPath"), jsInvoker),
|
|
4117
|
+
bridging::fromJs<P1>(rt, value.getProperty(rt, "animatedValueTag"), jsInvoker)};
|
|
4118
|
+
return result;
|
|
4119
|
+
}
|
|
4120
|
+
|
|
4121
|
+
static jsi::Object toJs(
|
|
4122
|
+
jsi::Runtime &rt,
|
|
4123
|
+
const NativeAnimatedModuleBaseEventMapping<P0, P1> &value) {
|
|
4124
|
+
auto result = facebook::jsi::Object(rt);
|
|
4125
|
+
result.setProperty(rt, "nativeEventPath", bridging::toJs(rt, value.nativeEventPath));
|
|
4126
|
+
result.setProperty(rt, "animatedValueTag", bridging::toJs(rt, value.animatedValueTag));
|
|
4127
|
+
return result;
|
|
4128
|
+
}
|
|
4129
|
+
};
|
|
4130
|
+
|
|
4131
|
+
class JSI_EXPORT NativeAnimatedModuleCxxSpecJSI : public TurboModule {
|
|
4132
|
+
protected:
|
|
4133
|
+
NativeAnimatedModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
4134
|
+
|
|
4135
|
+
public:
|
|
4136
|
+
virtual void startOperationBatch(jsi::Runtime &rt) = 0;
|
|
4137
|
+
virtual void finishOperationBatch(jsi::Runtime &rt) = 0;
|
|
4138
|
+
virtual void createAnimatedNode(jsi::Runtime &rt, double tag, jsi::Object config) = 0;
|
|
4139
|
+
virtual void updateAnimatedNodeConfig(jsi::Runtime &rt, double tag, jsi::Object config) = 0;
|
|
4140
|
+
virtual void getValue(jsi::Runtime &rt, double tag, jsi::Function saveValueCallback) = 0;
|
|
4141
|
+
virtual void startListeningToAnimatedNodeValue(jsi::Runtime &rt, double tag) = 0;
|
|
4142
|
+
virtual void stopListeningToAnimatedNodeValue(jsi::Runtime &rt, double tag) = 0;
|
|
4143
|
+
virtual void connectAnimatedNodes(jsi::Runtime &rt, double parentTag, double childTag) = 0;
|
|
4144
|
+
virtual void disconnectAnimatedNodes(jsi::Runtime &rt, double parentTag, double childTag) = 0;
|
|
4145
|
+
virtual void startAnimatingNode(jsi::Runtime &rt, double animationId, double nodeTag, jsi::Object config, jsi::Function endCallback) = 0;
|
|
4146
|
+
virtual void stopAnimation(jsi::Runtime &rt, double animationId) = 0;
|
|
4147
|
+
virtual void setAnimatedNodeValue(jsi::Runtime &rt, double nodeTag, double value) = 0;
|
|
4148
|
+
virtual void setAnimatedNodeOffset(jsi::Runtime &rt, double nodeTag, double offset) = 0;
|
|
4149
|
+
virtual void flattenAnimatedNodeOffset(jsi::Runtime &rt, double nodeTag) = 0;
|
|
4150
|
+
virtual void extractAnimatedNodeOffset(jsi::Runtime &rt, double nodeTag) = 0;
|
|
4151
|
+
virtual void connectAnimatedNodeToView(jsi::Runtime &rt, double nodeTag, double viewTag) = 0;
|
|
4152
|
+
virtual void disconnectAnimatedNodeFromView(jsi::Runtime &rt, double nodeTag, double viewTag) = 0;
|
|
4153
|
+
virtual void restoreDefaultValues(jsi::Runtime &rt, double nodeTag) = 0;
|
|
4154
|
+
virtual void dropAnimatedNode(jsi::Runtime &rt, double tag) = 0;
|
|
4155
|
+
virtual void addAnimatedEventToView(jsi::Runtime &rt, double viewTag, jsi::String eventName, jsi::Object eventMapping) = 0;
|
|
4156
|
+
virtual void removeAnimatedEventFromView(jsi::Runtime &rt, double viewTag, jsi::String eventName, double animatedNodeTag) = 0;
|
|
4157
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
|
|
4158
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
4159
|
+
virtual void queueAndExecuteBatchedOperations(jsi::Runtime &rt, jsi::Array operationsAndArgs) = 0;
|
|
4160
|
+
|
|
4161
|
+
};
|
|
4162
|
+
|
|
4163
|
+
template <typename T>
|
|
4164
|
+
class JSI_EXPORT NativeAnimatedModuleCxxSpec : public TurboModule {
|
|
4165
|
+
public:
|
|
4166
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
4167
|
+
return delegate_.get(rt, propName);
|
|
4168
|
+
}
|
|
4169
|
+
|
|
4170
|
+
protected:
|
|
4171
|
+
NativeAnimatedModuleCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
4172
|
+
: TurboModule("NativeAnimatedModule", jsInvoker),
|
|
4173
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
4174
|
+
|
|
4175
|
+
private:
|
|
4176
|
+
class Delegate : public NativeAnimatedModuleCxxSpecJSI {
|
|
4177
|
+
public:
|
|
4178
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
4179
|
+
NativeAnimatedModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
4180
|
+
|
|
4181
|
+
void startOperationBatch(jsi::Runtime &rt) override {
|
|
4182
|
+
static_assert(
|
|
4183
|
+
bridging::getParameterCount(&T::startOperationBatch) == 1,
|
|
4184
|
+
"Expected startOperationBatch(...) to have 1 parameters");
|
|
4185
|
+
|
|
4186
|
+
return bridging::callFromJs<void>(
|
|
4187
|
+
rt, &T::startOperationBatch, jsInvoker_, instance_);
|
|
4188
|
+
}
|
|
4189
|
+
void finishOperationBatch(jsi::Runtime &rt) override {
|
|
4190
|
+
static_assert(
|
|
4191
|
+
bridging::getParameterCount(&T::finishOperationBatch) == 1,
|
|
4192
|
+
"Expected finishOperationBatch(...) to have 1 parameters");
|
|
4193
|
+
|
|
4194
|
+
return bridging::callFromJs<void>(
|
|
4195
|
+
rt, &T::finishOperationBatch, jsInvoker_, instance_);
|
|
4196
|
+
}
|
|
4197
|
+
void createAnimatedNode(jsi::Runtime &rt, double tag, jsi::Object config) override {
|
|
4198
|
+
static_assert(
|
|
4199
|
+
bridging::getParameterCount(&T::createAnimatedNode) == 3,
|
|
4200
|
+
"Expected createAnimatedNode(...) to have 3 parameters");
|
|
4201
|
+
|
|
4202
|
+
return bridging::callFromJs<void>(
|
|
4203
|
+
rt, &T::createAnimatedNode, jsInvoker_, instance_, std::move(tag), std::move(config));
|
|
4204
|
+
}
|
|
4205
|
+
void updateAnimatedNodeConfig(jsi::Runtime &rt, double tag, jsi::Object config) override {
|
|
4206
|
+
static_assert(
|
|
4207
|
+
bridging::getParameterCount(&T::updateAnimatedNodeConfig) == 3,
|
|
4208
|
+
"Expected updateAnimatedNodeConfig(...) to have 3 parameters");
|
|
4209
|
+
|
|
4210
|
+
return bridging::callFromJs<void>(
|
|
4211
|
+
rt, &T::updateAnimatedNodeConfig, jsInvoker_, instance_, std::move(tag), std::move(config));
|
|
4212
|
+
}
|
|
4213
|
+
void getValue(jsi::Runtime &rt, double tag, jsi::Function saveValueCallback) override {
|
|
4214
|
+
static_assert(
|
|
4215
|
+
bridging::getParameterCount(&T::getValue) == 3,
|
|
4216
|
+
"Expected getValue(...) to have 3 parameters");
|
|
4217
|
+
|
|
4218
|
+
return bridging::callFromJs<void>(
|
|
4219
|
+
rt, &T::getValue, jsInvoker_, instance_, std::move(tag), std::move(saveValueCallback));
|
|
4220
|
+
}
|
|
4221
|
+
void startListeningToAnimatedNodeValue(jsi::Runtime &rt, double tag) override {
|
|
4222
|
+
static_assert(
|
|
4223
|
+
bridging::getParameterCount(&T::startListeningToAnimatedNodeValue) == 2,
|
|
4224
|
+
"Expected startListeningToAnimatedNodeValue(...) to have 2 parameters");
|
|
4225
|
+
|
|
4226
|
+
return bridging::callFromJs<void>(
|
|
4227
|
+
rt, &T::startListeningToAnimatedNodeValue, jsInvoker_, instance_, std::move(tag));
|
|
4228
|
+
}
|
|
4229
|
+
void stopListeningToAnimatedNodeValue(jsi::Runtime &rt, double tag) override {
|
|
4230
|
+
static_assert(
|
|
4231
|
+
bridging::getParameterCount(&T::stopListeningToAnimatedNodeValue) == 2,
|
|
4232
|
+
"Expected stopListeningToAnimatedNodeValue(...) to have 2 parameters");
|
|
4233
|
+
|
|
4234
|
+
return bridging::callFromJs<void>(
|
|
4235
|
+
rt, &T::stopListeningToAnimatedNodeValue, jsInvoker_, instance_, std::move(tag));
|
|
4236
|
+
}
|
|
4237
|
+
void connectAnimatedNodes(jsi::Runtime &rt, double parentTag, double childTag) override {
|
|
4238
|
+
static_assert(
|
|
4239
|
+
bridging::getParameterCount(&T::connectAnimatedNodes) == 3,
|
|
4240
|
+
"Expected connectAnimatedNodes(...) to have 3 parameters");
|
|
4241
|
+
|
|
4242
|
+
return bridging::callFromJs<void>(
|
|
4243
|
+
rt, &T::connectAnimatedNodes, jsInvoker_, instance_, std::move(parentTag), std::move(childTag));
|
|
4244
|
+
}
|
|
4245
|
+
void disconnectAnimatedNodes(jsi::Runtime &rt, double parentTag, double childTag) override {
|
|
4246
|
+
static_assert(
|
|
4247
|
+
bridging::getParameterCount(&T::disconnectAnimatedNodes) == 3,
|
|
4248
|
+
"Expected disconnectAnimatedNodes(...) to have 3 parameters");
|
|
4249
|
+
|
|
4250
|
+
return bridging::callFromJs<void>(
|
|
4251
|
+
rt, &T::disconnectAnimatedNodes, jsInvoker_, instance_, std::move(parentTag), std::move(childTag));
|
|
4252
|
+
}
|
|
4253
|
+
void startAnimatingNode(jsi::Runtime &rt, double animationId, double nodeTag, jsi::Object config, jsi::Function endCallback) override {
|
|
4254
|
+
static_assert(
|
|
4255
|
+
bridging::getParameterCount(&T::startAnimatingNode) == 5,
|
|
4256
|
+
"Expected startAnimatingNode(...) to have 5 parameters");
|
|
4257
|
+
|
|
4258
|
+
return bridging::callFromJs<void>(
|
|
4259
|
+
rt, &T::startAnimatingNode, jsInvoker_, instance_, std::move(animationId), std::move(nodeTag), std::move(config), std::move(endCallback));
|
|
4260
|
+
}
|
|
4261
|
+
void stopAnimation(jsi::Runtime &rt, double animationId) override {
|
|
4262
|
+
static_assert(
|
|
4263
|
+
bridging::getParameterCount(&T::stopAnimation) == 2,
|
|
4264
|
+
"Expected stopAnimation(...) to have 2 parameters");
|
|
4265
|
+
|
|
4266
|
+
return bridging::callFromJs<void>(
|
|
4267
|
+
rt, &T::stopAnimation, jsInvoker_, instance_, std::move(animationId));
|
|
4268
|
+
}
|
|
4269
|
+
void setAnimatedNodeValue(jsi::Runtime &rt, double nodeTag, double value) override {
|
|
4270
|
+
static_assert(
|
|
4271
|
+
bridging::getParameterCount(&T::setAnimatedNodeValue) == 3,
|
|
4272
|
+
"Expected setAnimatedNodeValue(...) to have 3 parameters");
|
|
4273
|
+
|
|
4274
|
+
return bridging::callFromJs<void>(
|
|
4275
|
+
rt, &T::setAnimatedNodeValue, jsInvoker_, instance_, std::move(nodeTag), std::move(value));
|
|
4276
|
+
}
|
|
4277
|
+
void setAnimatedNodeOffset(jsi::Runtime &rt, double nodeTag, double offset) override {
|
|
4278
|
+
static_assert(
|
|
4279
|
+
bridging::getParameterCount(&T::setAnimatedNodeOffset) == 3,
|
|
4280
|
+
"Expected setAnimatedNodeOffset(...) to have 3 parameters");
|
|
4281
|
+
|
|
4282
|
+
return bridging::callFromJs<void>(
|
|
4283
|
+
rt, &T::setAnimatedNodeOffset, jsInvoker_, instance_, std::move(nodeTag), std::move(offset));
|
|
4284
|
+
}
|
|
4285
|
+
void flattenAnimatedNodeOffset(jsi::Runtime &rt, double nodeTag) override {
|
|
4286
|
+
static_assert(
|
|
4287
|
+
bridging::getParameterCount(&T::flattenAnimatedNodeOffset) == 2,
|
|
4288
|
+
"Expected flattenAnimatedNodeOffset(...) to have 2 parameters");
|
|
4289
|
+
|
|
4290
|
+
return bridging::callFromJs<void>(
|
|
4291
|
+
rt, &T::flattenAnimatedNodeOffset, jsInvoker_, instance_, std::move(nodeTag));
|
|
4292
|
+
}
|
|
4293
|
+
void extractAnimatedNodeOffset(jsi::Runtime &rt, double nodeTag) override {
|
|
4294
|
+
static_assert(
|
|
4295
|
+
bridging::getParameterCount(&T::extractAnimatedNodeOffset) == 2,
|
|
4296
|
+
"Expected extractAnimatedNodeOffset(...) to have 2 parameters");
|
|
4297
|
+
|
|
4298
|
+
return bridging::callFromJs<void>(
|
|
4299
|
+
rt, &T::extractAnimatedNodeOffset, jsInvoker_, instance_, std::move(nodeTag));
|
|
4300
|
+
}
|
|
4301
|
+
void connectAnimatedNodeToView(jsi::Runtime &rt, double nodeTag, double viewTag) override {
|
|
4302
|
+
static_assert(
|
|
4303
|
+
bridging::getParameterCount(&T::connectAnimatedNodeToView) == 3,
|
|
4304
|
+
"Expected connectAnimatedNodeToView(...) to have 3 parameters");
|
|
4305
|
+
|
|
4306
|
+
return bridging::callFromJs<void>(
|
|
4307
|
+
rt, &T::connectAnimatedNodeToView, jsInvoker_, instance_, std::move(nodeTag), std::move(viewTag));
|
|
4308
|
+
}
|
|
4309
|
+
void disconnectAnimatedNodeFromView(jsi::Runtime &rt, double nodeTag, double viewTag) override {
|
|
4310
|
+
static_assert(
|
|
4311
|
+
bridging::getParameterCount(&T::disconnectAnimatedNodeFromView) == 3,
|
|
4312
|
+
"Expected disconnectAnimatedNodeFromView(...) to have 3 parameters");
|
|
4313
|
+
|
|
4314
|
+
return bridging::callFromJs<void>(
|
|
4315
|
+
rt, &T::disconnectAnimatedNodeFromView, jsInvoker_, instance_, std::move(nodeTag), std::move(viewTag));
|
|
4316
|
+
}
|
|
4317
|
+
void restoreDefaultValues(jsi::Runtime &rt, double nodeTag) override {
|
|
4318
|
+
static_assert(
|
|
4319
|
+
bridging::getParameterCount(&T::restoreDefaultValues) == 2,
|
|
4320
|
+
"Expected restoreDefaultValues(...) to have 2 parameters");
|
|
4321
|
+
|
|
4322
|
+
return bridging::callFromJs<void>(
|
|
4323
|
+
rt, &T::restoreDefaultValues, jsInvoker_, instance_, std::move(nodeTag));
|
|
4324
|
+
}
|
|
4325
|
+
void dropAnimatedNode(jsi::Runtime &rt, double tag) override {
|
|
4326
|
+
static_assert(
|
|
4327
|
+
bridging::getParameterCount(&T::dropAnimatedNode) == 2,
|
|
4328
|
+
"Expected dropAnimatedNode(...) to have 2 parameters");
|
|
4329
|
+
|
|
4330
|
+
return bridging::callFromJs<void>(
|
|
4331
|
+
rt, &T::dropAnimatedNode, jsInvoker_, instance_, std::move(tag));
|
|
4332
|
+
}
|
|
4333
|
+
void addAnimatedEventToView(jsi::Runtime &rt, double viewTag, jsi::String eventName, jsi::Object eventMapping) override {
|
|
4334
|
+
static_assert(
|
|
4335
|
+
bridging::getParameterCount(&T::addAnimatedEventToView) == 4,
|
|
4336
|
+
"Expected addAnimatedEventToView(...) to have 4 parameters");
|
|
4337
|
+
|
|
4338
|
+
return bridging::callFromJs<void>(
|
|
4339
|
+
rt, &T::addAnimatedEventToView, jsInvoker_, instance_, std::move(viewTag), std::move(eventName), std::move(eventMapping));
|
|
4340
|
+
}
|
|
4341
|
+
void removeAnimatedEventFromView(jsi::Runtime &rt, double viewTag, jsi::String eventName, double animatedNodeTag) override {
|
|
4342
|
+
static_assert(
|
|
4343
|
+
bridging::getParameterCount(&T::removeAnimatedEventFromView) == 4,
|
|
4344
|
+
"Expected removeAnimatedEventFromView(...) to have 4 parameters");
|
|
4345
|
+
|
|
4346
|
+
return bridging::callFromJs<void>(
|
|
4347
|
+
rt, &T::removeAnimatedEventFromView, jsInvoker_, instance_, std::move(viewTag), std::move(eventName), std::move(animatedNodeTag));
|
|
4348
|
+
}
|
|
4349
|
+
void addListener(jsi::Runtime &rt, jsi::String eventName) override {
|
|
4350
|
+
static_assert(
|
|
4351
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
4352
|
+
"Expected addListener(...) to have 2 parameters");
|
|
4353
|
+
|
|
4354
|
+
return bridging::callFromJs<void>(
|
|
4355
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
|
|
4356
|
+
}
|
|
4357
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
4358
|
+
static_assert(
|
|
4359
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
4360
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
4361
|
+
|
|
4362
|
+
return bridging::callFromJs<void>(
|
|
4363
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
4364
|
+
}
|
|
4365
|
+
void queueAndExecuteBatchedOperations(jsi::Runtime &rt, jsi::Array operationsAndArgs) override {
|
|
4366
|
+
static_assert(
|
|
4367
|
+
bridging::getParameterCount(&T::queueAndExecuteBatchedOperations) == 2,
|
|
4368
|
+
"Expected queueAndExecuteBatchedOperations(...) to have 2 parameters");
|
|
4369
|
+
|
|
4370
|
+
return bridging::callFromJs<void>(
|
|
4371
|
+
rt, &T::queueAndExecuteBatchedOperations, jsInvoker_, instance_, std::move(operationsAndArgs));
|
|
4372
|
+
}
|
|
4373
|
+
|
|
4374
|
+
private:
|
|
4375
|
+
T *instance_;
|
|
4376
|
+
};
|
|
4377
|
+
|
|
4378
|
+
Delegate delegate_;
|
|
4379
|
+
};
|
|
4380
|
+
|
|
4381
|
+
#pragma mark - PushNotificationManagerBasePermissions
|
|
4382
|
+
|
|
4383
|
+
template <typename P0, typename P1, typename P2>
|
|
4384
|
+
struct PushNotificationManagerBasePermissions {
|
|
4385
|
+
P0 alert;
|
|
4386
|
+
P1 badge;
|
|
4387
|
+
P2 sound;
|
|
4388
|
+
bool operator==(const PushNotificationManagerBasePermissions &other) const {
|
|
4389
|
+
return alert == other.alert && badge == other.badge && sound == other.sound;
|
|
4390
|
+
}
|
|
4391
|
+
};
|
|
4392
|
+
|
|
4393
|
+
template <typename P0, typename P1, typename P2>
|
|
4394
|
+
struct PushNotificationManagerBasePermissionsBridging {
|
|
4395
|
+
static PushNotificationManagerBasePermissions<P0, P1, P2> fromJs(
|
|
4396
|
+
jsi::Runtime &rt,
|
|
4397
|
+
const jsi::Object &value,
|
|
4398
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
4399
|
+
PushNotificationManagerBasePermissions<P0, P1, P2> result{
|
|
4400
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "alert"), jsInvoker),
|
|
4401
|
+
bridging::fromJs<P1>(rt, value.getProperty(rt, "badge"), jsInvoker),
|
|
4402
|
+
bridging::fromJs<P2>(rt, value.getProperty(rt, "sound"), jsInvoker)};
|
|
4403
|
+
return result;
|
|
4404
|
+
}
|
|
4405
|
+
|
|
4406
|
+
static jsi::Object toJs(
|
|
4407
|
+
jsi::Runtime &rt,
|
|
4408
|
+
const PushNotificationManagerBasePermissions<P0, P1, P2> &value) {
|
|
4409
|
+
auto result = facebook::jsi::Object(rt);
|
|
4410
|
+
result.setProperty(rt, "alert", bridging::toJs(rt, value.alert));
|
|
4411
|
+
result.setProperty(rt, "badge", bridging::toJs(rt, value.badge));
|
|
4412
|
+
result.setProperty(rt, "sound", bridging::toJs(rt, value.sound));
|
|
4413
|
+
return result;
|
|
4414
|
+
}
|
|
4415
|
+
};
|
|
4416
|
+
|
|
4417
|
+
|
|
4418
|
+
#pragma mark - PushNotificationManagerBaseNotification
|
|
4419
|
+
|
|
4420
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9>
|
|
4421
|
+
struct PushNotificationManagerBaseNotification {
|
|
4422
|
+
P0 alertTitle;
|
|
4423
|
+
P1 fireDate;
|
|
4424
|
+
P2 alertBody;
|
|
4425
|
+
P3 alertAction;
|
|
4426
|
+
P4 userInfo;
|
|
4427
|
+
P5 category;
|
|
4428
|
+
P6 repeatInterval;
|
|
4429
|
+
P7 applicationIconBadgeNumber;
|
|
4430
|
+
P8 isSilent;
|
|
4431
|
+
P9 soundName;
|
|
4432
|
+
bool operator==(const PushNotificationManagerBaseNotification &other) const {
|
|
4433
|
+
return alertTitle == other.alertTitle && fireDate == other.fireDate && alertBody == other.alertBody && alertAction == other.alertAction && userInfo == other.userInfo && category == other.category && repeatInterval == other.repeatInterval && applicationIconBadgeNumber == other.applicationIconBadgeNumber && isSilent == other.isSilent && soundName == other.soundName;
|
|
4434
|
+
}
|
|
4435
|
+
};
|
|
4436
|
+
|
|
4437
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8, typename P9>
|
|
4438
|
+
struct PushNotificationManagerBaseNotificationBridging {
|
|
4439
|
+
static PushNotificationManagerBaseNotification<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9> fromJs(
|
|
4440
|
+
jsi::Runtime &rt,
|
|
4441
|
+
const jsi::Object &value,
|
|
4442
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
4443
|
+
PushNotificationManagerBaseNotification<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9> result{
|
|
4444
|
+
bridging::fromJs<P0>(rt, value.getProperty(rt, "alertTitle"), jsInvoker),
|
|
4445
|
+
bridging::fromJs<P1>(rt, value.getProperty(rt, "fireDate"), jsInvoker),
|
|
4446
|
+
bridging::fromJs<P2>(rt, value.getProperty(rt, "alertBody"), jsInvoker),
|
|
4447
|
+
bridging::fromJs<P3>(rt, value.getProperty(rt, "alertAction"), jsInvoker),
|
|
4448
|
+
bridging::fromJs<P4>(rt, value.getProperty(rt, "userInfo"), jsInvoker),
|
|
4449
|
+
bridging::fromJs<P5>(rt, value.getProperty(rt, "category"), jsInvoker),
|
|
4450
|
+
bridging::fromJs<P6>(rt, value.getProperty(rt, "repeatInterval"), jsInvoker),
|
|
4451
|
+
bridging::fromJs<P7>(rt, value.getProperty(rt, "applicationIconBadgeNumber"), jsInvoker),
|
|
4452
|
+
bridging::fromJs<P8>(rt, value.getProperty(rt, "isSilent"), jsInvoker),
|
|
4453
|
+
bridging::fromJs<P9>(rt, value.getProperty(rt, "soundName"), jsInvoker)};
|
|
4454
|
+
return result;
|
|
4455
|
+
}
|
|
4456
|
+
|
|
4457
|
+
static jsi::Object toJs(
|
|
4458
|
+
jsi::Runtime &rt,
|
|
4459
|
+
const PushNotificationManagerBaseNotification<P0, P1, P2, P3, P4, P5, P6, P7, P8, P9> &value) {
|
|
4460
|
+
auto result = facebook::jsi::Object(rt);
|
|
4461
|
+
if (value.alertTitle) {
|
|
4462
|
+
result.setProperty(rt, "alertTitle", bridging::toJs(rt, value.alertTitle.value()));
|
|
4463
|
+
}
|
|
4464
|
+
if (value.fireDate) {
|
|
4465
|
+
result.setProperty(rt, "fireDate", bridging::toJs(rt, value.fireDate.value()));
|
|
4466
|
+
}
|
|
4467
|
+
if (value.alertBody) {
|
|
4468
|
+
result.setProperty(rt, "alertBody", bridging::toJs(rt, value.alertBody.value()));
|
|
4469
|
+
}
|
|
4470
|
+
if (value.alertAction) {
|
|
4471
|
+
result.setProperty(rt, "alertAction", bridging::toJs(rt, value.alertAction.value()));
|
|
4472
|
+
}
|
|
4473
|
+
if (value.userInfo) {
|
|
4474
|
+
result.setProperty(rt, "userInfo", bridging::toJs(rt, value.userInfo.value()));
|
|
4475
|
+
}
|
|
4476
|
+
if (value.category) {
|
|
4477
|
+
result.setProperty(rt, "category", bridging::toJs(rt, value.category.value()));
|
|
4478
|
+
}
|
|
4479
|
+
if (value.repeatInterval) {
|
|
4480
|
+
result.setProperty(rt, "repeatInterval", bridging::toJs(rt, value.repeatInterval.value()));
|
|
4481
|
+
}
|
|
4482
|
+
if (value.applicationIconBadgeNumber) {
|
|
4483
|
+
result.setProperty(rt, "applicationIconBadgeNumber", bridging::toJs(rt, value.applicationIconBadgeNumber.value()));
|
|
4484
|
+
}
|
|
4485
|
+
if (value.isSilent) {
|
|
4486
|
+
result.setProperty(rt, "isSilent", bridging::toJs(rt, value.isSilent.value()));
|
|
4487
|
+
}
|
|
4488
|
+
if (value.soundName) {
|
|
4489
|
+
result.setProperty(rt, "soundName", bridging::toJs(rt, value.soundName.value()));
|
|
4490
|
+
}
|
|
4491
|
+
return result;
|
|
4492
|
+
}
|
|
4493
|
+
};
|
|
4494
|
+
|
|
4495
|
+
class JSI_EXPORT NativePushNotificationManagerIOSCxxSpecJSI : public TurboModule {
|
|
4496
|
+
protected:
|
|
4497
|
+
NativePushNotificationManagerIOSCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
4498
|
+
|
|
4499
|
+
public:
|
|
4500
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
4501
|
+
virtual void onFinishRemoteNotification(jsi::Runtime &rt, jsi::String notificationId, jsi::String fetchResult) = 0;
|
|
4502
|
+
virtual void setApplicationIconBadgeNumber(jsi::Runtime &rt, double num) = 0;
|
|
4503
|
+
virtual void getApplicationIconBadgeNumber(jsi::Runtime &rt, jsi::Function callback) = 0;
|
|
4504
|
+
virtual jsi::Value requestPermissions(jsi::Runtime &rt, jsi::Object permission) = 0;
|
|
4505
|
+
virtual void abandonPermissions(jsi::Runtime &rt) = 0;
|
|
4506
|
+
virtual void checkPermissions(jsi::Runtime &rt, jsi::Function callback) = 0;
|
|
4507
|
+
virtual void presentLocalNotification(jsi::Runtime &rt, jsi::Object notification) = 0;
|
|
4508
|
+
virtual void scheduleLocalNotification(jsi::Runtime &rt, jsi::Object notification) = 0;
|
|
4509
|
+
virtual void cancelAllLocalNotifications(jsi::Runtime &rt) = 0;
|
|
4510
|
+
virtual void cancelLocalNotifications(jsi::Runtime &rt, jsi::Object userInfo) = 0;
|
|
4511
|
+
virtual jsi::Value getInitialNotification(jsi::Runtime &rt) = 0;
|
|
4512
|
+
virtual void getScheduledLocalNotifications(jsi::Runtime &rt, jsi::Function callback) = 0;
|
|
4513
|
+
virtual void removeAllDeliveredNotifications(jsi::Runtime &rt) = 0;
|
|
4514
|
+
virtual void removeDeliveredNotifications(jsi::Runtime &rt, jsi::Array identifiers) = 0;
|
|
4515
|
+
virtual void getDeliveredNotifications(jsi::Runtime &rt, jsi::Function callback) = 0;
|
|
4516
|
+
virtual void getAuthorizationStatus(jsi::Runtime &rt, jsi::Function callback) = 0;
|
|
4517
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventType) = 0;
|
|
4518
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
4519
|
+
|
|
4520
|
+
};
|
|
4521
|
+
|
|
4522
|
+
template <typename T>
|
|
4523
|
+
class JSI_EXPORT NativePushNotificationManagerIOSCxxSpec : public TurboModule {
|
|
4524
|
+
public:
|
|
4525
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
4526
|
+
return delegate_.get(rt, propName);
|
|
4527
|
+
}
|
|
4528
|
+
|
|
4529
|
+
protected:
|
|
4530
|
+
NativePushNotificationManagerIOSCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
4531
|
+
: TurboModule("PushNotificationManager", jsInvoker),
|
|
4532
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
4533
|
+
|
|
4534
|
+
private:
|
|
4535
|
+
class Delegate : public NativePushNotificationManagerIOSCxxSpecJSI {
|
|
4536
|
+
public:
|
|
4537
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
4538
|
+
NativePushNotificationManagerIOSCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
4539
|
+
|
|
4540
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
4541
|
+
static_assert(
|
|
4542
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
4543
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
4544
|
+
|
|
4545
|
+
return bridging::callFromJs<jsi::Object>(
|
|
4546
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
4547
|
+
}
|
|
4548
|
+
void onFinishRemoteNotification(jsi::Runtime &rt, jsi::String notificationId, jsi::String fetchResult) override {
|
|
4549
|
+
static_assert(
|
|
4550
|
+
bridging::getParameterCount(&T::onFinishRemoteNotification) == 3,
|
|
4551
|
+
"Expected onFinishRemoteNotification(...) to have 3 parameters");
|
|
4552
|
+
|
|
4553
|
+
return bridging::callFromJs<void>(
|
|
4554
|
+
rt, &T::onFinishRemoteNotification, jsInvoker_, instance_, std::move(notificationId), std::move(fetchResult));
|
|
4555
|
+
}
|
|
4556
|
+
void setApplicationIconBadgeNumber(jsi::Runtime &rt, double num) override {
|
|
4557
|
+
static_assert(
|
|
4558
|
+
bridging::getParameterCount(&T::setApplicationIconBadgeNumber) == 2,
|
|
4559
|
+
"Expected setApplicationIconBadgeNumber(...) to have 2 parameters");
|
|
4560
|
+
|
|
4561
|
+
return bridging::callFromJs<void>(
|
|
4562
|
+
rt, &T::setApplicationIconBadgeNumber, jsInvoker_, instance_, std::move(num));
|
|
4563
|
+
}
|
|
4564
|
+
void getApplicationIconBadgeNumber(jsi::Runtime &rt, jsi::Function callback) override {
|
|
4565
|
+
static_assert(
|
|
4566
|
+
bridging::getParameterCount(&T::getApplicationIconBadgeNumber) == 2,
|
|
4567
|
+
"Expected getApplicationIconBadgeNumber(...) to have 2 parameters");
|
|
4568
|
+
|
|
4569
|
+
return bridging::callFromJs<void>(
|
|
4570
|
+
rt, &T::getApplicationIconBadgeNumber, jsInvoker_, instance_, std::move(callback));
|
|
4571
|
+
}
|
|
4572
|
+
jsi::Value requestPermissions(jsi::Runtime &rt, jsi::Object permission) override {
|
|
4573
|
+
static_assert(
|
|
4574
|
+
bridging::getParameterCount(&T::requestPermissions) == 2,
|
|
4575
|
+
"Expected requestPermissions(...) to have 2 parameters");
|
|
4576
|
+
|
|
4577
|
+
return bridging::callFromJs<jsi::Value>(
|
|
4578
|
+
rt, &T::requestPermissions, jsInvoker_, instance_, std::move(permission));
|
|
4579
|
+
}
|
|
4580
|
+
void abandonPermissions(jsi::Runtime &rt) override {
|
|
4581
|
+
static_assert(
|
|
4582
|
+
bridging::getParameterCount(&T::abandonPermissions) == 1,
|
|
4583
|
+
"Expected abandonPermissions(...) to have 1 parameters");
|
|
4584
|
+
|
|
4585
|
+
return bridging::callFromJs<void>(
|
|
4586
|
+
rt, &T::abandonPermissions, jsInvoker_, instance_);
|
|
4587
|
+
}
|
|
4588
|
+
void checkPermissions(jsi::Runtime &rt, jsi::Function callback) override {
|
|
4589
|
+
static_assert(
|
|
4590
|
+
bridging::getParameterCount(&T::checkPermissions) == 2,
|
|
4591
|
+
"Expected checkPermissions(...) to have 2 parameters");
|
|
4592
|
+
|
|
4593
|
+
return bridging::callFromJs<void>(
|
|
4594
|
+
rt, &T::checkPermissions, jsInvoker_, instance_, std::move(callback));
|
|
4595
|
+
}
|
|
4596
|
+
void presentLocalNotification(jsi::Runtime &rt, jsi::Object notification) override {
|
|
4597
|
+
static_assert(
|
|
4598
|
+
bridging::getParameterCount(&T::presentLocalNotification) == 2,
|
|
4599
|
+
"Expected presentLocalNotification(...) to have 2 parameters");
|
|
4600
|
+
|
|
4601
|
+
return bridging::callFromJs<void>(
|
|
4602
|
+
rt, &T::presentLocalNotification, jsInvoker_, instance_, std::move(notification));
|
|
4603
|
+
}
|
|
4604
|
+
void scheduleLocalNotification(jsi::Runtime &rt, jsi::Object notification) override {
|
|
4605
|
+
static_assert(
|
|
4606
|
+
bridging::getParameterCount(&T::scheduleLocalNotification) == 2,
|
|
4607
|
+
"Expected scheduleLocalNotification(...) to have 2 parameters");
|
|
4608
|
+
|
|
4609
|
+
return bridging::callFromJs<void>(
|
|
4610
|
+
rt, &T::scheduleLocalNotification, jsInvoker_, instance_, std::move(notification));
|
|
4611
|
+
}
|
|
4612
|
+
void cancelAllLocalNotifications(jsi::Runtime &rt) override {
|
|
4613
|
+
static_assert(
|
|
4614
|
+
bridging::getParameterCount(&T::cancelAllLocalNotifications) == 1,
|
|
4615
|
+
"Expected cancelAllLocalNotifications(...) to have 1 parameters");
|
|
4616
|
+
|
|
4617
|
+
return bridging::callFromJs<void>(
|
|
4618
|
+
rt, &T::cancelAllLocalNotifications, jsInvoker_, instance_);
|
|
4619
|
+
}
|
|
4620
|
+
void cancelLocalNotifications(jsi::Runtime &rt, jsi::Object userInfo) override {
|
|
4621
|
+
static_assert(
|
|
4622
|
+
bridging::getParameterCount(&T::cancelLocalNotifications) == 2,
|
|
4623
|
+
"Expected cancelLocalNotifications(...) to have 2 parameters");
|
|
4624
|
+
|
|
4625
|
+
return bridging::callFromJs<void>(
|
|
4626
|
+
rt, &T::cancelLocalNotifications, jsInvoker_, instance_, std::move(userInfo));
|
|
4627
|
+
}
|
|
4628
|
+
jsi::Value getInitialNotification(jsi::Runtime &rt) override {
|
|
4629
|
+
static_assert(
|
|
4630
|
+
bridging::getParameterCount(&T::getInitialNotification) == 1,
|
|
4631
|
+
"Expected getInitialNotification(...) to have 1 parameters");
|
|
4632
|
+
|
|
4633
|
+
return bridging::callFromJs<jsi::Value>(
|
|
4634
|
+
rt, &T::getInitialNotification, jsInvoker_, instance_);
|
|
4635
|
+
}
|
|
4636
|
+
void getScheduledLocalNotifications(jsi::Runtime &rt, jsi::Function callback) override {
|
|
4637
|
+
static_assert(
|
|
4638
|
+
bridging::getParameterCount(&T::getScheduledLocalNotifications) == 2,
|
|
4639
|
+
"Expected getScheduledLocalNotifications(...) to have 2 parameters");
|
|
4640
|
+
|
|
4641
|
+
return bridging::callFromJs<void>(
|
|
4642
|
+
rt, &T::getScheduledLocalNotifications, jsInvoker_, instance_, std::move(callback));
|
|
4643
|
+
}
|
|
4644
|
+
void removeAllDeliveredNotifications(jsi::Runtime &rt) override {
|
|
4645
|
+
static_assert(
|
|
4646
|
+
bridging::getParameterCount(&T::removeAllDeliveredNotifications) == 1,
|
|
4647
|
+
"Expected removeAllDeliveredNotifications(...) to have 1 parameters");
|
|
4648
|
+
|
|
4649
|
+
return bridging::callFromJs<void>(
|
|
4650
|
+
rt, &T::removeAllDeliveredNotifications, jsInvoker_, instance_);
|
|
4651
|
+
}
|
|
4652
|
+
void removeDeliveredNotifications(jsi::Runtime &rt, jsi::Array identifiers) override {
|
|
4653
|
+
static_assert(
|
|
4654
|
+
bridging::getParameterCount(&T::removeDeliveredNotifications) == 2,
|
|
4655
|
+
"Expected removeDeliveredNotifications(...) to have 2 parameters");
|
|
4656
|
+
|
|
4657
|
+
return bridging::callFromJs<void>(
|
|
4658
|
+
rt, &T::removeDeliveredNotifications, jsInvoker_, instance_, std::move(identifiers));
|
|
4659
|
+
}
|
|
4660
|
+
void getDeliveredNotifications(jsi::Runtime &rt, jsi::Function callback) override {
|
|
4661
|
+
static_assert(
|
|
4662
|
+
bridging::getParameterCount(&T::getDeliveredNotifications) == 2,
|
|
4663
|
+
"Expected getDeliveredNotifications(...) to have 2 parameters");
|
|
4664
|
+
|
|
4665
|
+
return bridging::callFromJs<void>(
|
|
4666
|
+
rt, &T::getDeliveredNotifications, jsInvoker_, instance_, std::move(callback));
|
|
4667
|
+
}
|
|
4668
|
+
void getAuthorizationStatus(jsi::Runtime &rt, jsi::Function callback) override {
|
|
4669
|
+
static_assert(
|
|
4670
|
+
bridging::getParameterCount(&T::getAuthorizationStatus) == 2,
|
|
4671
|
+
"Expected getAuthorizationStatus(...) to have 2 parameters");
|
|
4672
|
+
|
|
4673
|
+
return bridging::callFromJs<void>(
|
|
4674
|
+
rt, &T::getAuthorizationStatus, jsInvoker_, instance_, std::move(callback));
|
|
4675
|
+
}
|
|
4676
|
+
void addListener(jsi::Runtime &rt, jsi::String eventType) override {
|
|
4677
|
+
static_assert(
|
|
4678
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
4679
|
+
"Expected addListener(...) to have 2 parameters");
|
|
4680
|
+
|
|
4681
|
+
return bridging::callFromJs<void>(
|
|
4682
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventType));
|
|
4683
|
+
}
|
|
4684
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
4685
|
+
static_assert(
|
|
4686
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
4687
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
4688
|
+
|
|
4689
|
+
return bridging::callFromJs<void>(
|
|
4690
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
4691
|
+
}
|
|
4692
|
+
|
|
4693
|
+
private:
|
|
4694
|
+
T *instance_;
|
|
4695
|
+
};
|
|
4696
|
+
|
|
4697
|
+
Delegate delegate_;
|
|
4698
|
+
};
|
|
4699
|
+
|
|
4700
|
+
class JSI_EXPORT NativeLinkingManagerCxxSpecJSI : public TurboModule {
|
|
4701
|
+
protected:
|
|
4702
|
+
NativeLinkingManagerCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
4703
|
+
|
|
4704
|
+
public:
|
|
4705
|
+
virtual jsi::Value getInitialURL(jsi::Runtime &rt) = 0;
|
|
4706
|
+
virtual jsi::Value canOpenURL(jsi::Runtime &rt, jsi::String url) = 0;
|
|
4707
|
+
virtual jsi::Value openURL(jsi::Runtime &rt, jsi::String url) = 0;
|
|
4708
|
+
virtual jsi::Value openSettings(jsi::Runtime &rt) = 0;
|
|
4709
|
+
virtual void addListener(jsi::Runtime &rt, jsi::String eventName) = 0;
|
|
4710
|
+
virtual void removeListeners(jsi::Runtime &rt, double count) = 0;
|
|
4711
|
+
|
|
4712
|
+
};
|
|
4713
|
+
|
|
4714
|
+
template <typename T>
|
|
4715
|
+
class JSI_EXPORT NativeLinkingManagerCxxSpec : public TurboModule {
|
|
4716
|
+
public:
|
|
4717
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
4718
|
+
return delegate_.get(rt, propName);
|
|
4719
|
+
}
|
|
4720
|
+
|
|
4721
|
+
protected:
|
|
4722
|
+
NativeLinkingManagerCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
4723
|
+
: TurboModule("LinkingManager", jsInvoker),
|
|
4724
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
4725
|
+
|
|
4726
|
+
private:
|
|
4727
|
+
class Delegate : public NativeLinkingManagerCxxSpecJSI {
|
|
4728
|
+
public:
|
|
4729
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
4730
|
+
NativeLinkingManagerCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
4731
|
+
|
|
4732
|
+
jsi::Value getInitialURL(jsi::Runtime &rt) override {
|
|
4733
|
+
static_assert(
|
|
4734
|
+
bridging::getParameterCount(&T::getInitialURL) == 1,
|
|
4735
|
+
"Expected getInitialURL(...) to have 1 parameters");
|
|
4736
|
+
|
|
4737
|
+
return bridging::callFromJs<jsi::Value>(
|
|
4738
|
+
rt, &T::getInitialURL, jsInvoker_, instance_);
|
|
4739
|
+
}
|
|
4740
|
+
jsi::Value canOpenURL(jsi::Runtime &rt, jsi::String url) override {
|
|
4741
|
+
static_assert(
|
|
4742
|
+
bridging::getParameterCount(&T::canOpenURL) == 2,
|
|
4743
|
+
"Expected canOpenURL(...) to have 2 parameters");
|
|
4744
|
+
|
|
4745
|
+
return bridging::callFromJs<jsi::Value>(
|
|
4746
|
+
rt, &T::canOpenURL, jsInvoker_, instance_, std::move(url));
|
|
4747
|
+
}
|
|
4748
|
+
jsi::Value openURL(jsi::Runtime &rt, jsi::String url) override {
|
|
4749
|
+
static_assert(
|
|
4750
|
+
bridging::getParameterCount(&T::openURL) == 2,
|
|
4751
|
+
"Expected openURL(...) to have 2 parameters");
|
|
4752
|
+
|
|
4753
|
+
return bridging::callFromJs<jsi::Value>(
|
|
4754
|
+
rt, &T::openURL, jsInvoker_, instance_, std::move(url));
|
|
4755
|
+
}
|
|
4756
|
+
jsi::Value openSettings(jsi::Runtime &rt) override {
|
|
4757
|
+
static_assert(
|
|
4758
|
+
bridging::getParameterCount(&T::openSettings) == 1,
|
|
4759
|
+
"Expected openSettings(...) to have 1 parameters");
|
|
4760
|
+
|
|
4761
|
+
return bridging::callFromJs<jsi::Value>(
|
|
4762
|
+
rt, &T::openSettings, jsInvoker_, instance_);
|
|
4763
|
+
}
|
|
4764
|
+
void addListener(jsi::Runtime &rt, jsi::String eventName) override {
|
|
4765
|
+
static_assert(
|
|
4766
|
+
bridging::getParameterCount(&T::addListener) == 2,
|
|
4767
|
+
"Expected addListener(...) to have 2 parameters");
|
|
4768
|
+
|
|
4769
|
+
return bridging::callFromJs<void>(
|
|
4770
|
+
rt, &T::addListener, jsInvoker_, instance_, std::move(eventName));
|
|
4771
|
+
}
|
|
4772
|
+
void removeListeners(jsi::Runtime &rt, double count) override {
|
|
4773
|
+
static_assert(
|
|
4774
|
+
bridging::getParameterCount(&T::removeListeners) == 2,
|
|
4775
|
+
"Expected removeListeners(...) to have 2 parameters");
|
|
4776
|
+
|
|
4777
|
+
return bridging::callFromJs<void>(
|
|
4778
|
+
rt, &T::removeListeners, jsInvoker_, instance_, std::move(count));
|
|
4779
|
+
}
|
|
4780
|
+
|
|
4781
|
+
private:
|
|
4782
|
+
T *instance_;
|
|
4783
|
+
};
|
|
4784
|
+
|
|
4785
|
+
Delegate delegate_;
|
|
4786
|
+
};
|
|
4787
|
+
|
|
4788
|
+
class JSI_EXPORT NativeIntentAndroidCxxSpecJSI : public TurboModule {
|
|
4789
|
+
protected:
|
|
4790
|
+
NativeIntentAndroidCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
4791
|
+
|
|
4792
|
+
public:
|
|
4793
|
+
virtual jsi::Value getInitialURL(jsi::Runtime &rt) = 0;
|
|
4794
|
+
virtual jsi::Value canOpenURL(jsi::Runtime &rt, jsi::String url) = 0;
|
|
4795
|
+
virtual jsi::Value openURL(jsi::Runtime &rt, jsi::String url) = 0;
|
|
4796
|
+
virtual jsi::Value openSettings(jsi::Runtime &rt) = 0;
|
|
4797
|
+
virtual jsi::Value sendIntent(jsi::Runtime &rt, jsi::String action, std::optional<jsi::Array> extras) = 0;
|
|
4798
|
+
|
|
4799
|
+
};
|
|
4800
|
+
|
|
4801
|
+
template <typename T>
|
|
4802
|
+
class JSI_EXPORT NativeIntentAndroidCxxSpec : public TurboModule {
|
|
4803
|
+
public:
|
|
4804
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
4805
|
+
return delegate_.get(rt, propName);
|
|
4806
|
+
}
|
|
4807
|
+
|
|
4808
|
+
protected:
|
|
4809
|
+
NativeIntentAndroidCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
4810
|
+
: TurboModule("IntentAndroid", jsInvoker),
|
|
4811
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
4812
|
+
|
|
4813
|
+
private:
|
|
4814
|
+
class Delegate : public NativeIntentAndroidCxxSpecJSI {
|
|
4815
|
+
public:
|
|
4816
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
4817
|
+
NativeIntentAndroidCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
4818
|
+
|
|
4819
|
+
jsi::Value getInitialURL(jsi::Runtime &rt) override {
|
|
4820
|
+
static_assert(
|
|
4821
|
+
bridging::getParameterCount(&T::getInitialURL) == 1,
|
|
4822
|
+
"Expected getInitialURL(...) to have 1 parameters");
|
|
4823
|
+
|
|
4824
|
+
return bridging::callFromJs<jsi::Value>(
|
|
4825
|
+
rt, &T::getInitialURL, jsInvoker_, instance_);
|
|
4826
|
+
}
|
|
4827
|
+
jsi::Value canOpenURL(jsi::Runtime &rt, jsi::String url) override {
|
|
4828
|
+
static_assert(
|
|
4829
|
+
bridging::getParameterCount(&T::canOpenURL) == 2,
|
|
4830
|
+
"Expected canOpenURL(...) to have 2 parameters");
|
|
4831
|
+
|
|
4832
|
+
return bridging::callFromJs<jsi::Value>(
|
|
4833
|
+
rt, &T::canOpenURL, jsInvoker_, instance_, std::move(url));
|
|
4834
|
+
}
|
|
4835
|
+
jsi::Value openURL(jsi::Runtime &rt, jsi::String url) override {
|
|
4836
|
+
static_assert(
|
|
4837
|
+
bridging::getParameterCount(&T::openURL) == 2,
|
|
4838
|
+
"Expected openURL(...) to have 2 parameters");
|
|
4839
|
+
|
|
4840
|
+
return bridging::callFromJs<jsi::Value>(
|
|
4841
|
+
rt, &T::openURL, jsInvoker_, instance_, std::move(url));
|
|
4842
|
+
}
|
|
4843
|
+
jsi::Value openSettings(jsi::Runtime &rt) override {
|
|
4844
|
+
static_assert(
|
|
4845
|
+
bridging::getParameterCount(&T::openSettings) == 1,
|
|
4846
|
+
"Expected openSettings(...) to have 1 parameters");
|
|
4847
|
+
|
|
4848
|
+
return bridging::callFromJs<jsi::Value>(
|
|
4849
|
+
rt, &T::openSettings, jsInvoker_, instance_);
|
|
4850
|
+
}
|
|
4851
|
+
jsi::Value sendIntent(jsi::Runtime &rt, jsi::String action, std::optional<jsi::Array> extras) override {
|
|
4852
|
+
static_assert(
|
|
4853
|
+
bridging::getParameterCount(&T::sendIntent) == 3,
|
|
4854
|
+
"Expected sendIntent(...) to have 3 parameters");
|
|
4855
|
+
|
|
4856
|
+
return bridging::callFromJs<jsi::Value>(
|
|
4857
|
+
rt, &T::sendIntent, jsInvoker_, instance_, std::move(action), std::move(extras));
|
|
4858
|
+
}
|
|
4859
|
+
|
|
4860
|
+
private:
|
|
4861
|
+
T *instance_;
|
|
4862
|
+
};
|
|
4863
|
+
|
|
4864
|
+
Delegate delegate_;
|
|
4865
|
+
};
|
|
4866
|
+
|
|
4867
|
+
class JSI_EXPORT NativeShareModuleCxxSpecJSI : public TurboModule {
|
|
4868
|
+
protected:
|
|
4869
|
+
NativeShareModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
4870
|
+
|
|
4871
|
+
public:
|
|
4872
|
+
virtual jsi::Object getConstants(jsi::Runtime &rt) = 0;
|
|
4873
|
+
virtual jsi::Value share(jsi::Runtime &rt, jsi::Object content, std::optional<jsi::String> dialogTitle) = 0;
|
|
4874
|
+
|
|
4875
|
+
};
|
|
4876
|
+
|
|
4877
|
+
template <typename T>
|
|
4878
|
+
class JSI_EXPORT NativeShareModuleCxxSpec : public TurboModule {
|
|
4879
|
+
public:
|
|
4880
|
+
jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
4881
|
+
return delegate_.get(rt, propName);
|
|
4882
|
+
}
|
|
4883
|
+
|
|
4884
|
+
protected:
|
|
4885
|
+
NativeShareModuleCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
4886
|
+
: TurboModule("ShareModule", jsInvoker),
|
|
4887
|
+
delegate_(static_cast<T*>(this), jsInvoker) {}
|
|
4888
|
+
|
|
4889
|
+
private:
|
|
4890
|
+
class Delegate : public NativeShareModuleCxxSpecJSI {
|
|
4891
|
+
public:
|
|
4892
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
4893
|
+
NativeShareModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {}
|
|
4894
|
+
|
|
4895
|
+
jsi::Object getConstants(jsi::Runtime &rt) override {
|
|
4896
|
+
static_assert(
|
|
4897
|
+
bridging::getParameterCount(&T::getConstants) == 1,
|
|
4898
|
+
"Expected getConstants(...) to have 1 parameters");
|
|
4899
|
+
|
|
4900
|
+
return bridging::callFromJs<jsi::Object>(
|
|
4901
|
+
rt, &T::getConstants, jsInvoker_, instance_);
|
|
4902
|
+
}
|
|
4903
|
+
jsi::Value share(jsi::Runtime &rt, jsi::Object content, std::optional<jsi::String> dialogTitle) override {
|
|
4904
|
+
static_assert(
|
|
4905
|
+
bridging::getParameterCount(&T::share) == 3,
|
|
4906
|
+
"Expected share(...) to have 3 parameters");
|
|
4907
|
+
|
|
4908
|
+
return bridging::callFromJs<jsi::Value>(
|
|
4909
|
+
rt, &T::share, jsInvoker_, instance_, std::move(content), std::move(dialogTitle));
|
|
4910
|
+
}
|
|
4911
|
+
|
|
4912
|
+
private:
|
|
4913
|
+
T *instance_;
|
|
4914
|
+
};
|
|
4915
|
+
|
|
4916
|
+
Delegate delegate_;
|
|
4917
|
+
};
|
|
4918
|
+
|
|
4919
|
+
} // namespace react
|
|
4920
|
+
} // namespace facebook
|