@stream-io/react-native-callingx 0.1.0-beta.6 → 0.1.1-beta.0

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.
Files changed (65) hide show
  1. package/android/build.gradle +7 -1
  2. package/android/src/main/AndroidManifest.xml +31 -1
  3. package/android/src/main/java/io/getstream/rn/callingx/CallEventBroadcastReceiver.kt +17 -0
  4. package/android/src/main/java/io/getstream/rn/callingx/CallRegistrationStore.kt +176 -0
  5. package/android/src/main/java/io/getstream/rn/callingx/CallService.kt +302 -80
  6. package/android/src/main/java/io/getstream/rn/callingx/CallingxModuleImpl.kt +176 -191
  7. package/android/src/main/java/io/getstream/rn/callingx/StreamMessagingService.kt +48 -0
  8. package/android/src/main/java/io/getstream/rn/callingx/model/Call.kt +1 -0
  9. package/android/src/main/java/io/getstream/rn/callingx/notifications/CallNotificationManager.kt +196 -46
  10. package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationIntentFactory.kt +14 -8
  11. package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationReceiverActivity.kt +12 -1
  12. package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationReceiverService.kt +7 -0
  13. package/android/src/main/java/io/getstream/rn/callingx/repo/CallRepository.kt +38 -19
  14. package/android/src/main/java/io/getstream/rn/callingx/repo/LegacyCallRepository.kt +64 -55
  15. package/android/src/main/java/io/getstream/rn/callingx/repo/TelecomCallRepository.kt +241 -195
  16. package/android/src/main/java/io/getstream/rn/callingx/utils/CallEventBus.kt +61 -0
  17. package/android/src/main/java/io/getstream/rn/callingx/utils/SettingsStore.kt +51 -0
  18. package/android/src/newarch/java/io/getstream/rn/callingx/CallingxModule.kt +12 -3
  19. package/android/src/oldarch/java/io/getstream/rn/callingx/CallingxModule.kt +13 -3
  20. package/dist/module/CallingxModule.js +13 -10
  21. package/dist/module/CallingxModule.js.map +1 -1
  22. package/dist/module/spec/NativeCallingx.js.map +1 -1
  23. package/dist/module/utils/constants.js +24 -13
  24. package/dist/module/utils/constants.js.map +1 -1
  25. package/dist/typescript/src/CallingxModule.d.ts +3 -0
  26. package/dist/typescript/src/CallingxModule.d.ts.map +1 -1
  27. package/dist/typescript/src/spec/NativeCallingx.d.ts +7 -1
  28. package/dist/typescript/src/spec/NativeCallingx.d.ts.map +1 -1
  29. package/dist/typescript/src/types.d.ts +31 -0
  30. package/dist/typescript/src/types.d.ts.map +1 -1
  31. package/dist/typescript/src/utils/constants.d.ts +1 -1
  32. package/dist/typescript/src/utils/constants.d.ts.map +1 -1
  33. package/ios/AudioSessionManager.swift +2 -2
  34. package/ios/Callingx.mm +41 -17
  35. package/ios/CallingxImpl.swift +213 -83
  36. package/ios/Settings.swift +2 -2
  37. package/ios/UUIDStorage.swift +10 -10
  38. package/ios/VoipNotificationsManager.swift +8 -8
  39. package/package.json +4 -2
  40. package/src/CallingxModule.ts +14 -10
  41. package/src/spec/NativeCallingx.ts +10 -3
  42. package/src/types.ts +34 -0
  43. package/src/utils/constants.ts +23 -9
  44. package/android/bin/build/generated/source/buildConfig/debug/io/getstream/rn/callingx/BuildConfig.class +0 -0
  45. package/android/bin/build/generated/source/codegen/java/io/getstream/rn/callingx/NativeCallingxSpec.class +0 -0
  46. package/android/bin/build/generated/source/codegen/jni/CMakeLists.txt +0 -28
  47. package/android/bin/build/generated/source/codegen/jni/CallingxSpec-generated.cpp +0 -167
  48. package/android/bin/build/generated/source/codegen/jni/CallingxSpec.h +0 -31
  49. package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/CallingxSpecJSI-generated.cpp +0 -196
  50. package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/CallingxSpecJSI.h +0 -283
  51. package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ComponentDescriptors.cpp +0 -22
  52. package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ComponentDescriptors.h +0 -24
  53. package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/EventEmitters.cpp +0 -16
  54. package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/EventEmitters.h +0 -17
  55. package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/Props.cpp +0 -19
  56. package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/Props.h +0 -18
  57. package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ShadowNodes.cpp +0 -17
  58. package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ShadowNodes.h +0 -23
  59. package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/States.cpp +0 -16
  60. package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/States.h +0 -20
  61. package/android/bin/build/generated/source/codegen/schema.json +0 -1
  62. package/android/bin/src/main/AndroidManifest.xml +0 -29
  63. package/android/bin/src/main/java/io/getstream/rn/callingx/notifications/NotificationChannelsManager.kt +0 -104
  64. /package/android/src/main/java/io/getstream/rn/callingx/{ResourceUtils.kt → utils/ResourceUtils.kt} +0 -0
  65. /package/android/src/main/java/io/getstream/rn/callingx/{Utils.kt → utils/Utils.kt} +0 -0
@@ -1,196 +0,0 @@
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: GenerateModuleCpp.js
8
- */
9
-
10
- #include "CallingxSpecJSI.h"
11
-
12
- namespace facebook::react {
13
-
14
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_setupiOS(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
15
- static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->setupiOS(
16
- rt,
17
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asObject(rt)
18
- );
19
- return jsi::Value::undefined();
20
- }
21
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_setupAndroid(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
22
- static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->setupAndroid(
23
- rt,
24
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asObject(rt)
25
- );
26
- return jsi::Value::undefined();
27
- }
28
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_setShouldRejectCallWhenBusy(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
29
- static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->setShouldRejectCallWhenBusy(
30
- rt,
31
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asBool()
32
- );
33
- return jsi::Value::undefined();
34
- }
35
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_canPostNotifications(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
36
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->canPostNotifications(
37
- rt
38
- );
39
- }
40
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_getInitialEvents(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
41
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->getInitialEvents(
42
- rt
43
- );
44
- }
45
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_getInitialVoipEvents(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
46
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->getInitialVoipEvents(
47
- rt
48
- );
49
- }
50
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_setCurrentCallActive(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
51
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->setCurrentCallActive(
52
- rt,
53
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
54
- );
55
- }
56
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_displayIncomingCall(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
57
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->displayIncomingCall(
58
- rt,
59
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
60
- count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
61
- count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
62
- count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asBool(),
63
- count <= 4 || args[4].isUndefined() ? std::nullopt : std::make_optional(args[4].asObject(rt))
64
- );
65
- }
66
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_answerIncomingCall(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
67
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->answerIncomingCall(
68
- rt,
69
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
70
- );
71
- }
72
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_startCall(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
73
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->startCall(
74
- rt,
75
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
76
- count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
77
- count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
78
- count <= 3 ? throw jsi::JSError(rt, "Expected argument in position 3 to be passed") : args[3].asBool(),
79
- count <= 4 || args[4].isUndefined() ? std::nullopt : std::make_optional(args[4].asObject(rt))
80
- );
81
- }
82
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_updateDisplay(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
83
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->updateDisplay(
84
- rt,
85
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
86
- count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt),
87
- count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt),
88
- count <= 3 || args[3].isUndefined() ? std::nullopt : std::make_optional(args[3].asObject(rt))
89
- );
90
- }
91
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_isCallRegistered(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
92
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->isCallRegistered(
93
- rt,
94
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
95
- );
96
- }
97
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_hasRegisteredCall(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
98
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->hasRegisteredCall(
99
- rt
100
- );
101
- }
102
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_endCallWithReason(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
103
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->endCallWithReason(
104
- rt,
105
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
106
- count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asNumber()
107
- );
108
- }
109
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_endCall(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
110
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->endCall(
111
- rt,
112
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
113
- );
114
- }
115
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_setMutedCall(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
116
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->setMutedCall(
117
- rt,
118
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
119
- count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asBool()
120
- );
121
- }
122
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_setOnHoldCall(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
123
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->setOnHoldCall(
124
- rt,
125
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
126
- count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asBool()
127
- );
128
- }
129
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_registerBackgroundTaskAvailable(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
130
- static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->registerBackgroundTaskAvailable(
131
- rt
132
- );
133
- return jsi::Value::undefined();
134
- }
135
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_isServiceStarted(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
136
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->isServiceStarted(
137
- rt
138
- );
139
- }
140
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_startBackgroundTask(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
141
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->startBackgroundTask(
142
- rt,
143
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
144
- count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asNumber()
145
- );
146
- }
147
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_stopBackgroundTask(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
148
- return static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->stopBackgroundTask(
149
- rt,
150
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
151
- );
152
- }
153
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_registerVoipToken(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
154
- static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->registerVoipToken(
155
- rt
156
- );
157
- return jsi::Value::undefined();
158
- }
159
- static jsi::Value __hostFunction_NativeCallingxCxxSpecJSI_log(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
160
- static_cast<NativeCallingxCxxSpecJSI *>(&turboModule)->log(
161
- rt,
162
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
163
- count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt)
164
- );
165
- return jsi::Value::undefined();
166
- }
167
-
168
- NativeCallingxCxxSpecJSI::NativeCallingxCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
169
- : TurboModule("Callingx", jsInvoker) {
170
- methodMap_["setupiOS"] = MethodMetadata {1, __hostFunction_NativeCallingxCxxSpecJSI_setupiOS};
171
- methodMap_["setupAndroid"] = MethodMetadata {1, __hostFunction_NativeCallingxCxxSpecJSI_setupAndroid};
172
- methodMap_["setShouldRejectCallWhenBusy"] = MethodMetadata {1, __hostFunction_NativeCallingxCxxSpecJSI_setShouldRejectCallWhenBusy};
173
- methodMap_["canPostNotifications"] = MethodMetadata {0, __hostFunction_NativeCallingxCxxSpecJSI_canPostNotifications};
174
- methodMap_["getInitialEvents"] = MethodMetadata {0, __hostFunction_NativeCallingxCxxSpecJSI_getInitialEvents};
175
- methodMap_["getInitialVoipEvents"] = MethodMetadata {0, __hostFunction_NativeCallingxCxxSpecJSI_getInitialVoipEvents};
176
- methodMap_["setCurrentCallActive"] = MethodMetadata {1, __hostFunction_NativeCallingxCxxSpecJSI_setCurrentCallActive};
177
- methodMap_["displayIncomingCall"] = MethodMetadata {5, __hostFunction_NativeCallingxCxxSpecJSI_displayIncomingCall};
178
- methodMap_["answerIncomingCall"] = MethodMetadata {1, __hostFunction_NativeCallingxCxxSpecJSI_answerIncomingCall};
179
- methodMap_["startCall"] = MethodMetadata {5, __hostFunction_NativeCallingxCxxSpecJSI_startCall};
180
- methodMap_["updateDisplay"] = MethodMetadata {4, __hostFunction_NativeCallingxCxxSpecJSI_updateDisplay};
181
- methodMap_["isCallRegistered"] = MethodMetadata {1, __hostFunction_NativeCallingxCxxSpecJSI_isCallRegistered};
182
- methodMap_["hasRegisteredCall"] = MethodMetadata {0, __hostFunction_NativeCallingxCxxSpecJSI_hasRegisteredCall};
183
- methodMap_["endCallWithReason"] = MethodMetadata {2, __hostFunction_NativeCallingxCxxSpecJSI_endCallWithReason};
184
- methodMap_["endCall"] = MethodMetadata {1, __hostFunction_NativeCallingxCxxSpecJSI_endCall};
185
- methodMap_["setMutedCall"] = MethodMetadata {2, __hostFunction_NativeCallingxCxxSpecJSI_setMutedCall};
186
- methodMap_["setOnHoldCall"] = MethodMetadata {2, __hostFunction_NativeCallingxCxxSpecJSI_setOnHoldCall};
187
- methodMap_["registerBackgroundTaskAvailable"] = MethodMetadata {0, __hostFunction_NativeCallingxCxxSpecJSI_registerBackgroundTaskAvailable};
188
- methodMap_["isServiceStarted"] = MethodMetadata {0, __hostFunction_NativeCallingxCxxSpecJSI_isServiceStarted};
189
- methodMap_["startBackgroundTask"] = MethodMetadata {2, __hostFunction_NativeCallingxCxxSpecJSI_startBackgroundTask};
190
- methodMap_["stopBackgroundTask"] = MethodMetadata {1, __hostFunction_NativeCallingxCxxSpecJSI_stopBackgroundTask};
191
- methodMap_["registerVoipToken"] = MethodMetadata {0, __hostFunction_NativeCallingxCxxSpecJSI_registerVoipToken};
192
- methodMap_["log"] = MethodMetadata {2, __hostFunction_NativeCallingxCxxSpecJSI_log};
193
- }
194
-
195
-
196
- } // namespace facebook::react
@@ -1,283 +0,0 @@
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::react {
16
-
17
-
18
- class JSI_EXPORT NativeCallingxCxxSpecJSI : public TurboModule {
19
- protected:
20
- NativeCallingxCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
21
-
22
- public:
23
- virtual void setupiOS(jsi::Runtime &rt, jsi::Object options) = 0;
24
- virtual void setupAndroid(jsi::Runtime &rt, jsi::Object options) = 0;
25
- virtual void setShouldRejectCallWhenBusy(jsi::Runtime &rt, bool shouldReject) = 0;
26
- virtual bool canPostNotifications(jsi::Runtime &rt) = 0;
27
- virtual jsi::Array getInitialEvents(jsi::Runtime &rt) = 0;
28
- virtual jsi::Array getInitialVoipEvents(jsi::Runtime &rt) = 0;
29
- virtual jsi::Value setCurrentCallActive(jsi::Runtime &rt, jsi::String callId) = 0;
30
- virtual jsi::Value displayIncomingCall(jsi::Runtime &rt, jsi::String callId, jsi::String phoneNumber, jsi::String callerName, bool hasVideo, std::optional<jsi::Object> displayOptions) = 0;
31
- virtual jsi::Value answerIncomingCall(jsi::Runtime &rt, jsi::String callId) = 0;
32
- virtual jsi::Value startCall(jsi::Runtime &rt, jsi::String callId, jsi::String phoneNumber, jsi::String callerName, bool hasVideo, std::optional<jsi::Object> displayOptions) = 0;
33
- virtual jsi::Value updateDisplay(jsi::Runtime &rt, jsi::String callId, jsi::String phoneNumber, jsi::String callerName, std::optional<jsi::Object> displayOptions) = 0;
34
- virtual bool isCallRegistered(jsi::Runtime &rt, jsi::String callId) = 0;
35
- virtual bool hasRegisteredCall(jsi::Runtime &rt) = 0;
36
- virtual jsi::Value endCallWithReason(jsi::Runtime &rt, jsi::String callId, double reason) = 0;
37
- virtual jsi::Value endCall(jsi::Runtime &rt, jsi::String callId) = 0;
38
- virtual jsi::Value setMutedCall(jsi::Runtime &rt, jsi::String callId, bool isMuted) = 0;
39
- virtual jsi::Value setOnHoldCall(jsi::Runtime &rt, jsi::String callId, bool isOnHold) = 0;
40
- virtual void registerBackgroundTaskAvailable(jsi::Runtime &rt) = 0;
41
- virtual jsi::Value isServiceStarted(jsi::Runtime &rt) = 0;
42
- virtual jsi::Value startBackgroundTask(jsi::Runtime &rt, jsi::String taskName, double timeout) = 0;
43
- virtual jsi::Value stopBackgroundTask(jsi::Runtime &rt, jsi::String taskName) = 0;
44
- virtual void registerVoipToken(jsi::Runtime &rt) = 0;
45
- virtual void log(jsi::Runtime &rt, jsi::String message, jsi::String level) = 0;
46
-
47
- };
48
-
49
- template <typename T>
50
- class JSI_EXPORT NativeCallingxCxxSpec : public TurboModule {
51
- public:
52
- jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
53
- return delegate_.create(rt, propName);
54
- }
55
-
56
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
57
- return delegate_.getPropertyNames(runtime);
58
- }
59
-
60
- static constexpr std::string_view kModuleName = "Callingx";
61
-
62
- protected:
63
- NativeCallingxCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
64
- : TurboModule(std::string{NativeCallingxCxxSpec::kModuleName}, jsInvoker),
65
- delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
66
-
67
- template <typename OnNewEventType> void emitOnNewEvent(OnNewEventType value) {
68
- static_assert(bridging::supportsFromJs<OnNewEventType, jsi::Object>, "value cannnot be converted to jsi::Object");
69
- static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["onNewEvent"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
70
- return bridging::toJs(rt, eventValue, jsInvoker);
71
- });
72
- }
73
-
74
- template <typename OnNewVoipEventType> void emitOnNewVoipEvent(OnNewVoipEventType value) {
75
- static_assert(bridging::supportsFromJs<OnNewVoipEventType, jsi::Object>, "value cannnot be converted to jsi::Object");
76
- static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["onNewVoipEvent"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
77
- return bridging::toJs(rt, eventValue, jsInvoker);
78
- });
79
- }
80
-
81
- private:
82
- class Delegate : public NativeCallingxCxxSpecJSI {
83
- public:
84
- Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
85
- NativeCallingxCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
86
- eventEmitterMap_["onNewEvent"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
87
- eventEmitterMap_["onNewVoipEvent"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
88
- }
89
-
90
- void setupiOS(jsi::Runtime &rt, jsi::Object options) override {
91
- static_assert(
92
- bridging::getParameterCount(&T::setupiOS) == 2,
93
- "Expected setupiOS(...) to have 2 parameters");
94
-
95
- return bridging::callFromJs<void>(
96
- rt, &T::setupiOS, jsInvoker_, instance_, std::move(options));
97
- }
98
- void setupAndroid(jsi::Runtime &rt, jsi::Object options) override {
99
- static_assert(
100
- bridging::getParameterCount(&T::setupAndroid) == 2,
101
- "Expected setupAndroid(...) to have 2 parameters");
102
-
103
- return bridging::callFromJs<void>(
104
- rt, &T::setupAndroid, jsInvoker_, instance_, std::move(options));
105
- }
106
- void setShouldRejectCallWhenBusy(jsi::Runtime &rt, bool shouldReject) override {
107
- static_assert(
108
- bridging::getParameterCount(&T::setShouldRejectCallWhenBusy) == 2,
109
- "Expected setShouldRejectCallWhenBusy(...) to have 2 parameters");
110
-
111
- return bridging::callFromJs<void>(
112
- rt, &T::setShouldRejectCallWhenBusy, jsInvoker_, instance_, std::move(shouldReject));
113
- }
114
- bool canPostNotifications(jsi::Runtime &rt) override {
115
- static_assert(
116
- bridging::getParameterCount(&T::canPostNotifications) == 1,
117
- "Expected canPostNotifications(...) to have 1 parameters");
118
-
119
- return bridging::callFromJs<bool>(
120
- rt, &T::canPostNotifications, jsInvoker_, instance_);
121
- }
122
- jsi::Array getInitialEvents(jsi::Runtime &rt) override {
123
- static_assert(
124
- bridging::getParameterCount(&T::getInitialEvents) == 1,
125
- "Expected getInitialEvents(...) to have 1 parameters");
126
-
127
- return bridging::callFromJs<jsi::Array>(
128
- rt, &T::getInitialEvents, jsInvoker_, instance_);
129
- }
130
- jsi::Array getInitialVoipEvents(jsi::Runtime &rt) override {
131
- static_assert(
132
- bridging::getParameterCount(&T::getInitialVoipEvents) == 1,
133
- "Expected getInitialVoipEvents(...) to have 1 parameters");
134
-
135
- return bridging::callFromJs<jsi::Array>(
136
- rt, &T::getInitialVoipEvents, jsInvoker_, instance_);
137
- }
138
- jsi::Value setCurrentCallActive(jsi::Runtime &rt, jsi::String callId) override {
139
- static_assert(
140
- bridging::getParameterCount(&T::setCurrentCallActive) == 2,
141
- "Expected setCurrentCallActive(...) to have 2 parameters");
142
-
143
- return bridging::callFromJs<jsi::Value>(
144
- rt, &T::setCurrentCallActive, jsInvoker_, instance_, std::move(callId));
145
- }
146
- jsi::Value displayIncomingCall(jsi::Runtime &rt, jsi::String callId, jsi::String phoneNumber, jsi::String callerName, bool hasVideo, std::optional<jsi::Object> displayOptions) override {
147
- static_assert(
148
- bridging::getParameterCount(&T::displayIncomingCall) == 6,
149
- "Expected displayIncomingCall(...) to have 6 parameters");
150
-
151
- return bridging::callFromJs<jsi::Value>(
152
- rt, &T::displayIncomingCall, jsInvoker_, instance_, std::move(callId), std::move(phoneNumber), std::move(callerName), std::move(hasVideo), std::move(displayOptions));
153
- }
154
- jsi::Value answerIncomingCall(jsi::Runtime &rt, jsi::String callId) override {
155
- static_assert(
156
- bridging::getParameterCount(&T::answerIncomingCall) == 2,
157
- "Expected answerIncomingCall(...) to have 2 parameters");
158
-
159
- return bridging::callFromJs<jsi::Value>(
160
- rt, &T::answerIncomingCall, jsInvoker_, instance_, std::move(callId));
161
- }
162
- jsi::Value startCall(jsi::Runtime &rt, jsi::String callId, jsi::String phoneNumber, jsi::String callerName, bool hasVideo, std::optional<jsi::Object> displayOptions) override {
163
- static_assert(
164
- bridging::getParameterCount(&T::startCall) == 6,
165
- "Expected startCall(...) to have 6 parameters");
166
-
167
- return bridging::callFromJs<jsi::Value>(
168
- rt, &T::startCall, jsInvoker_, instance_, std::move(callId), std::move(phoneNumber), std::move(callerName), std::move(hasVideo), std::move(displayOptions));
169
- }
170
- jsi::Value updateDisplay(jsi::Runtime &rt, jsi::String callId, jsi::String phoneNumber, jsi::String callerName, std::optional<jsi::Object> displayOptions) override {
171
- static_assert(
172
- bridging::getParameterCount(&T::updateDisplay) == 5,
173
- "Expected updateDisplay(...) to have 5 parameters");
174
-
175
- return bridging::callFromJs<jsi::Value>(
176
- rt, &T::updateDisplay, jsInvoker_, instance_, std::move(callId), std::move(phoneNumber), std::move(callerName), std::move(displayOptions));
177
- }
178
- bool isCallRegistered(jsi::Runtime &rt, jsi::String callId) override {
179
- static_assert(
180
- bridging::getParameterCount(&T::isCallRegistered) == 2,
181
- "Expected isCallRegistered(...) to have 2 parameters");
182
-
183
- return bridging::callFromJs<bool>(
184
- rt, &T::isCallRegistered, jsInvoker_, instance_, std::move(callId));
185
- }
186
- bool hasRegisteredCall(jsi::Runtime &rt) override {
187
- static_assert(
188
- bridging::getParameterCount(&T::hasRegisteredCall) == 1,
189
- "Expected hasRegisteredCall(...) to have 1 parameters");
190
-
191
- return bridging::callFromJs<bool>(
192
- rt, &T::hasRegisteredCall, jsInvoker_, instance_);
193
- }
194
- jsi::Value endCallWithReason(jsi::Runtime &rt, jsi::String callId, double reason) override {
195
- static_assert(
196
- bridging::getParameterCount(&T::endCallWithReason) == 3,
197
- "Expected endCallWithReason(...) to have 3 parameters");
198
-
199
- return bridging::callFromJs<jsi::Value>(
200
- rt, &T::endCallWithReason, jsInvoker_, instance_, std::move(callId), std::move(reason));
201
- }
202
- jsi::Value endCall(jsi::Runtime &rt, jsi::String callId) override {
203
- static_assert(
204
- bridging::getParameterCount(&T::endCall) == 2,
205
- "Expected endCall(...) to have 2 parameters");
206
-
207
- return bridging::callFromJs<jsi::Value>(
208
- rt, &T::endCall, jsInvoker_, instance_, std::move(callId));
209
- }
210
- jsi::Value setMutedCall(jsi::Runtime &rt, jsi::String callId, bool isMuted) override {
211
- static_assert(
212
- bridging::getParameterCount(&T::setMutedCall) == 3,
213
- "Expected setMutedCall(...) to have 3 parameters");
214
-
215
- return bridging::callFromJs<jsi::Value>(
216
- rt, &T::setMutedCall, jsInvoker_, instance_, std::move(callId), std::move(isMuted));
217
- }
218
- jsi::Value setOnHoldCall(jsi::Runtime &rt, jsi::String callId, bool isOnHold) override {
219
- static_assert(
220
- bridging::getParameterCount(&T::setOnHoldCall) == 3,
221
- "Expected setOnHoldCall(...) to have 3 parameters");
222
-
223
- return bridging::callFromJs<jsi::Value>(
224
- rt, &T::setOnHoldCall, jsInvoker_, instance_, std::move(callId), std::move(isOnHold));
225
- }
226
- void registerBackgroundTaskAvailable(jsi::Runtime &rt) override {
227
- static_assert(
228
- bridging::getParameterCount(&T::registerBackgroundTaskAvailable) == 1,
229
- "Expected registerBackgroundTaskAvailable(...) to have 1 parameters");
230
-
231
- return bridging::callFromJs<void>(
232
- rt, &T::registerBackgroundTaskAvailable, jsInvoker_, instance_);
233
- }
234
- jsi::Value isServiceStarted(jsi::Runtime &rt) override {
235
- static_assert(
236
- bridging::getParameterCount(&T::isServiceStarted) == 1,
237
- "Expected isServiceStarted(...) to have 1 parameters");
238
-
239
- return bridging::callFromJs<jsi::Value>(
240
- rt, &T::isServiceStarted, jsInvoker_, instance_);
241
- }
242
- jsi::Value startBackgroundTask(jsi::Runtime &rt, jsi::String taskName, double timeout) override {
243
- static_assert(
244
- bridging::getParameterCount(&T::startBackgroundTask) == 3,
245
- "Expected startBackgroundTask(...) to have 3 parameters");
246
-
247
- return bridging::callFromJs<jsi::Value>(
248
- rt, &T::startBackgroundTask, jsInvoker_, instance_, std::move(taskName), std::move(timeout));
249
- }
250
- jsi::Value stopBackgroundTask(jsi::Runtime &rt, jsi::String taskName) override {
251
- static_assert(
252
- bridging::getParameterCount(&T::stopBackgroundTask) == 2,
253
- "Expected stopBackgroundTask(...) to have 2 parameters");
254
-
255
- return bridging::callFromJs<jsi::Value>(
256
- rt, &T::stopBackgroundTask, jsInvoker_, instance_, std::move(taskName));
257
- }
258
- void registerVoipToken(jsi::Runtime &rt) override {
259
- static_assert(
260
- bridging::getParameterCount(&T::registerVoipToken) == 1,
261
- "Expected registerVoipToken(...) to have 1 parameters");
262
-
263
- return bridging::callFromJs<void>(
264
- rt, &T::registerVoipToken, jsInvoker_, instance_);
265
- }
266
- void log(jsi::Runtime &rt, jsi::String message, jsi::String level) override {
267
- static_assert(
268
- bridging::getParameterCount(&T::log) == 3,
269
- "Expected log(...) to have 3 parameters");
270
-
271
- return bridging::callFromJs<void>(
272
- rt, &T::log, jsInvoker_, instance_, std::move(message), std::move(level));
273
- }
274
-
275
- private:
276
- friend class NativeCallingxCxxSpec;
277
- T *instance_;
278
- };
279
-
280
- Delegate delegate_;
281
- };
282
-
283
- } // namespace facebook::react
@@ -1,22 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateComponentDescriptorCpp.js
9
- */
10
-
11
- #include <react/renderer/components/CallingxSpec/ComponentDescriptors.h>
12
- #include <react/renderer/core/ConcreteComponentDescriptor.h>
13
- #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
14
-
15
- namespace facebook::react {
16
-
17
- void CallingxSpec_registerComponentDescriptorsFromCodegen(
18
- std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
19
-
20
- }
21
-
22
- } // namespace facebook::react
@@ -1,24 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateComponentDescriptorH.js
9
- */
10
-
11
- #pragma once
12
-
13
- #include <react/renderer/components/CallingxSpec/ShadowNodes.h>
14
- #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
- #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
16
-
17
- namespace facebook::react {
18
-
19
-
20
-
21
- void CallingxSpec_registerComponentDescriptorsFromCodegen(
22
- std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
23
-
24
- } // namespace facebook::react
@@ -1,16 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateEventEmitterCpp.js
9
- */
10
-
11
- #include <react/renderer/components/CallingxSpec/EventEmitters.h>
12
-
13
-
14
- namespace facebook::react {
15
-
16
- } // namespace facebook::react
@@ -1,17 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateEventEmitterH.js
9
- */
10
- #pragma once
11
-
12
- #include <react/renderer/components/view/ViewEventEmitter.h>
13
-
14
-
15
- namespace facebook::react {
16
-
17
- } // namespace facebook::react
@@ -1,19 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GeneratePropsCpp.js
9
- */
10
-
11
- #include <react/renderer/components/CallingxSpec/Props.h>
12
- #include <react/renderer/core/PropsParserContext.h>
13
- #include <react/renderer/core/propsConversions.h>
14
-
15
- namespace facebook::react {
16
-
17
-
18
-
19
- } // namespace facebook::react
@@ -1,18 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GeneratePropsH.js
9
- */
10
- #pragma once
11
-
12
-
13
-
14
- namespace facebook::react {
15
-
16
-
17
-
18
- } // namespace facebook::react
@@ -1,17 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateShadowNodeCpp.js
9
- */
10
-
11
- #include <react/renderer/components/CallingxSpec/ShadowNodes.h>
12
-
13
- namespace facebook::react {
14
-
15
-
16
-
17
- } // namespace facebook::react
@@ -1,23 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateShadowNodeH.js
9
- */
10
-
11
- #pragma once
12
-
13
- #include <react/renderer/components/CallingxSpec/EventEmitters.h>
14
- #include <react/renderer/components/CallingxSpec/Props.h>
15
- #include <react/renderer/components/CallingxSpec/States.h>
16
- #include <react/renderer/components/view/ConcreteViewShadowNode.h>
17
- #include <jsi/jsi.h>
18
-
19
- namespace facebook::react {
20
-
21
-
22
-
23
- } // namespace facebook::react
@@ -1,16 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateStateCpp.js
9
- */
10
- #include <react/renderer/components/CallingxSpec/States.h>
11
-
12
- namespace facebook::react {
13
-
14
-
15
-
16
- } // namespace facebook::react