1*af2ec015STomasz Sapeta #pragma once
2*af2ec015STomasz Sapeta 
3*af2ec015STomasz Sapeta #include <memory>
4*af2ec015STomasz Sapeta #include <string>
5*af2ec015STomasz Sapeta #include <vector>
6*af2ec015STomasz Sapeta 
7*af2ec015STomasz Sapeta #ifdef ANDROID
8*af2ec015STomasz Sapeta #include "TurboModule.h"
9*af2ec015STomasz Sapeta #else
10*af2ec015STomasz Sapeta #include <ABI49_0_0ReactCommon/ABI49_0_0TurboModule.h>
11*af2ec015STomasz Sapeta #endif
12*af2ec015STomasz Sapeta 
13*af2ec015STomasz Sapeta #include <ABI49_0_0ReactCommon/ABI49_0_0CallInvoker.h>
14*af2ec015STomasz Sapeta 
15*af2ec015STomasz Sapeta using namespace ABI49_0_0facebook;
16*af2ec015STomasz Sapeta using namespace ABI49_0_0React;
17*af2ec015STomasz Sapeta 
18*af2ec015STomasz Sapeta namespace ABI49_0_0reanimated {
19*af2ec015STomasz Sapeta 
20*af2ec015STomasz Sapeta class JSI_EXPORT NativeReanimatedModuleSpec : public TurboModule {
21*af2ec015STomasz Sapeta  protected:
22*af2ec015STomasz Sapeta   explicit NativeReanimatedModuleSpec(std::shared_ptr<CallInvoker> jsInvoker);
23*af2ec015STomasz Sapeta 
24*af2ec015STomasz Sapeta  public:
25*af2ec015STomasz Sapeta   virtual void installCoreFunctions(
26*af2ec015STomasz Sapeta       jsi::Runtime &rt,
27*af2ec015STomasz Sapeta       const jsi::Value &callGuard,
28*af2ec015STomasz Sapeta       const jsi::Value &valueUnpacker) = 0;
29*af2ec015STomasz Sapeta 
30*af2ec015STomasz Sapeta   // SharedValue
31*af2ec015STomasz Sapeta   virtual jsi::Value makeShareableClone(
32*af2ec015STomasz Sapeta       jsi::Runtime &rt,
33*af2ec015STomasz Sapeta       const jsi::Value &value,
34*af2ec015STomasz Sapeta       const jsi::Value &shouldRetainRemote) = 0;
35*af2ec015STomasz Sapeta 
36*af2ec015STomasz Sapeta   // Synchronized data objects
37*af2ec015STomasz Sapeta   virtual jsi::Value makeSynchronizedDataHolder(
38*af2ec015STomasz Sapeta       jsi::Runtime &rt,
39*af2ec015STomasz Sapeta       const jsi::Value &initialShareable) = 0;
40*af2ec015STomasz Sapeta   virtual jsi::Value getDataSynchronously(
41*af2ec015STomasz Sapeta       jsi::Runtime &rt,
42*af2ec015STomasz Sapeta       const jsi::Value &synchronizedDataHolderRef) = 0;
43*af2ec015STomasz Sapeta 
44*af2ec015STomasz Sapeta   // Scheduling
45*af2ec015STomasz Sapeta   virtual void scheduleOnUI(jsi::Runtime &rt, const jsi::Value &worklet) = 0;
46*af2ec015STomasz Sapeta 
47*af2ec015STomasz Sapeta   // events
48*af2ec015STomasz Sapeta   virtual jsi::Value registerEventHandler(
49*af2ec015STomasz Sapeta       jsi::Runtime &rt,
50*af2ec015STomasz Sapeta       const jsi::Value &eventHash,
51*af2ec015STomasz Sapeta       const jsi::Value &worklet) = 0;
52*af2ec015STomasz Sapeta   virtual void unregisterEventHandler(
53*af2ec015STomasz Sapeta       jsi::Runtime &rt,
54*af2ec015STomasz Sapeta       const jsi::Value &registrationId) = 0;
55*af2ec015STomasz Sapeta 
56*af2ec015STomasz Sapeta   // views
57*af2ec015STomasz Sapeta   virtual jsi::Value getViewProp(
58*af2ec015STomasz Sapeta       jsi::Runtime &rt,
59*af2ec015STomasz Sapeta       const jsi::Value &viewTag,
60*af2ec015STomasz Sapeta       const jsi::Value &propName,
61*af2ec015STomasz Sapeta       const jsi::Value &callback) = 0;
62*af2ec015STomasz Sapeta 
63*af2ec015STomasz Sapeta   // sensors
64*af2ec015STomasz Sapeta   virtual jsi::Value registerSensor(
65*af2ec015STomasz Sapeta       jsi::Runtime &rt,
66*af2ec015STomasz Sapeta       const jsi::Value &sensorType,
67*af2ec015STomasz Sapeta       const jsi::Value &interval,
68*af2ec015STomasz Sapeta       const jsi::Value &iosReferenceFrame,
69*af2ec015STomasz Sapeta       const jsi::Value &sensorDataContainer) = 0;
70*af2ec015STomasz Sapeta   virtual void unregisterSensor(
71*af2ec015STomasz Sapeta       jsi::Runtime &rt,
72*af2ec015STomasz Sapeta       const jsi::Value &sensorId) = 0;
73*af2ec015STomasz Sapeta 
74*af2ec015STomasz Sapeta   // keyboard
75*af2ec015STomasz Sapeta   virtual jsi::Value subscribeForKeyboardEvents(
76*af2ec015STomasz Sapeta       jsi::Runtime &rt,
77*af2ec015STomasz Sapeta       const jsi::Value &keyboardEventContainer,
78*af2ec015STomasz Sapeta       const jsi::Value &isStatusBarTranslucent) = 0;
79*af2ec015STomasz Sapeta   virtual void unsubscribeFromKeyboardEvents(
80*af2ec015STomasz Sapeta       jsi::Runtime &rt,
81*af2ec015STomasz Sapeta       const jsi::Value &listenerId) = 0;
82*af2ec015STomasz Sapeta 
83*af2ec015STomasz Sapeta   // other
84*af2ec015STomasz Sapeta   virtual jsi::Value enableLayoutAnimations(
85*af2ec015STomasz Sapeta       jsi::Runtime &rt,
86*af2ec015STomasz Sapeta       const jsi::Value &config) = 0;
87*af2ec015STomasz Sapeta   virtual jsi::Value configureProps(
88*af2ec015STomasz Sapeta       jsi::Runtime &rt,
89*af2ec015STomasz Sapeta       const jsi::Value &uiProps,
90*af2ec015STomasz Sapeta       const jsi::Value &nativeProps) = 0;
91*af2ec015STomasz Sapeta 
92*af2ec015STomasz Sapeta   // layout animations
93*af2ec015STomasz Sapeta   virtual jsi::Value configureLayoutAnimation(
94*af2ec015STomasz Sapeta       jsi::Runtime &rt,
95*af2ec015STomasz Sapeta       const jsi::Value &viewTag,
96*af2ec015STomasz Sapeta       const jsi::Value &type,
97*af2ec015STomasz Sapeta       const jsi::Value &sharedTransitionTag,
98*af2ec015STomasz Sapeta       const jsi::Value &config) = 0;
99*af2ec015STomasz Sapeta };
100*af2ec015STomasz Sapeta 
101*af2ec015STomasz Sapeta } // namespace reanimated
102