livevoice-sdk-react-native 2.0.0 → 3.0.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 (221) hide show
  1. package/README.md +158 -7
  2. package/android/build.gradle +18 -6
  3. package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +121 -221
  4. package/android/src/main/java/io/livevoice/react/__SDK.kt +17 -3
  5. package/ios/LiveVoiceRNBridge.swift +362 -0
  6. package/ios/LiveVoiceSdkReactNative.mm +247 -145
  7. package/ios/__SDK.h +16 -2
  8. package/ios/livevoice_spm_backport.rb +202 -0
  9. package/lib/module/components/BrandingView.js +71 -50
  10. package/lib/module/components/BrandingView.js.map +1 -1
  11. package/lib/module/components/ChannelView.js +368 -54
  12. package/lib/module/components/ChannelView.js.map +1 -1
  13. package/lib/module/components/ErrorView.js +17 -16
  14. package/lib/module/components/ErrorView.js.map +1 -1
  15. package/lib/module/components/LiveVoiceSpinner.js +81 -0
  16. package/lib/module/components/LiveVoiceSpinner.js.map +1 -0
  17. package/lib/module/components/LiveVoiceView.js +351 -104
  18. package/lib/module/components/LiveVoiceView.js.map +1 -1
  19. package/lib/module/components/PasswordPrompt.js +165 -0
  20. package/lib/module/components/PasswordPrompt.js.map +1 -0
  21. package/lib/module/components/PlayButtonView.js +192 -254
  22. package/lib/module/components/PlayButtonView.js.map +1 -1
  23. package/lib/module/components/ReconnectingView.js +43 -62
  24. package/lib/module/components/ReconnectingView.js.map +1 -1
  25. package/lib/module/components/WarningView.js +12 -10
  26. package/lib/module/components/WarningView.js.map +1 -1
  27. package/lib/module/icons/branding-ios.png +0 -0
  28. package/lib/module/icons/camera-off-android.png +0 -0
  29. package/lib/module/icons/camera-off-android@2x.png +0 -0
  30. package/lib/module/icons/camera-off-android@3x.png +0 -0
  31. package/lib/module/icons/cpu-android.png +0 -0
  32. package/lib/module/icons/cpu-android@2x.png +0 -0
  33. package/lib/module/icons/cpu-android@3x.png +0 -0
  34. package/lib/module/icons/cpu-ios.png +0 -0
  35. package/lib/module/icons/cpu-ios@2x.png +0 -0
  36. package/lib/module/icons/cpu-ios@3x.png +0 -0
  37. package/lib/module/icons/lock-android.png +0 -0
  38. package/lib/module/icons/lock-android@2x.png +0 -0
  39. package/lib/module/icons/lock-android@3x.png +0 -0
  40. package/lib/module/icons/lock-ios.png +0 -0
  41. package/lib/module/icons/lock-ios@2x.png +0 -0
  42. package/lib/module/icons/lock-ios@3x.png +0 -0
  43. package/lib/module/icons/mic-off-android.png +0 -0
  44. package/lib/module/icons/mic-off-android@2x.png +0 -0
  45. package/lib/module/icons/mic-off-android@3x.png +0 -0
  46. package/lib/module/icons/mic-slash-ios.png +0 -0
  47. package/lib/module/icons/mic-slash-ios@2x.png +0 -0
  48. package/lib/module/icons/mic-slash-ios@3x.png +0 -0
  49. package/lib/module/icons/video-slash-ios.png +0 -0
  50. package/lib/module/icons/video-slash-ios@2x.png +0 -0
  51. package/lib/module/icons/video-slash-ios@3x.png +0 -0
  52. package/lib/module/index.js +24 -225
  53. package/lib/module/index.js.map +1 -1
  54. package/lib/module/sdk/Bridge.js +236 -0
  55. package/lib/module/sdk/Bridge.js.map +1 -0
  56. package/lib/module/sdk/Event.js +160 -0
  57. package/lib/module/sdk/Event.js.map +1 -0
  58. package/lib/module/sdk/Lifecycle.js +331 -0
  59. package/lib/module/sdk/Lifecycle.js.map +1 -0
  60. package/lib/module/sdk/LiveVoiceSdk.js +365 -0
  61. package/lib/module/sdk/LiveVoiceSdk.js.map +1 -0
  62. package/lib/module/sdk/LiveVoiceState.js +234 -0
  63. package/lib/module/sdk/LiveVoiceState.js.map +1 -0
  64. package/lib/module/sdk/LogEntries.js +99 -0
  65. package/lib/module/sdk/LogEntries.js.map +1 -0
  66. package/lib/module/sdk/Models.js +2 -0
  67. package/lib/module/{util/UIState.js.map → sdk/Models.js.map} +1 -1
  68. package/lib/module/sdk/NativeSdkVersions.js +24 -0
  69. package/lib/module/sdk/NativeSdkVersions.js.map +1 -0
  70. package/lib/module/sdk/Observables.js +391 -0
  71. package/lib/module/sdk/Observables.js.map +1 -0
  72. package/lib/module/sdk/Passwords.js +298 -0
  73. package/lib/module/sdk/Passwords.js.map +1 -0
  74. package/lib/module/sdk/Playback.js +35 -0
  75. package/lib/module/sdk/Playback.js.map +1 -0
  76. package/lib/module/specs/NativeLiveVoiceSdk.js +12 -10
  77. package/lib/module/specs/NativeLiveVoiceSdk.js.map +1 -1
  78. package/lib/module/util/Colors.js +14 -11
  79. package/lib/module/util/Colors.js.map +1 -1
  80. package/lib/module/util/Translations.js +46 -21
  81. package/lib/module/util/Translations.js.map +1 -1
  82. package/lib/module/util/freeze.js +26 -0
  83. package/lib/module/util/freeze.js.map +1 -0
  84. package/lib/module/util/logger.js +114 -0
  85. package/lib/module/util/logger.js.map +1 -0
  86. package/lib/typescript/src/components/BrandingView.d.ts +4 -0
  87. package/lib/typescript/src/components/BrandingView.d.ts.map +1 -1
  88. package/lib/typescript/src/components/ChannelView.d.ts +29 -3
  89. package/lib/typescript/src/components/ChannelView.d.ts.map +1 -1
  90. package/lib/typescript/src/components/ErrorView.d.ts +5 -3
  91. package/lib/typescript/src/components/ErrorView.d.ts.map +1 -1
  92. package/lib/typescript/src/components/LiveVoiceSpinner.d.ts +16 -0
  93. package/lib/typescript/src/components/LiveVoiceSpinner.d.ts.map +1 -0
  94. package/lib/typescript/src/components/LiveVoiceView.d.ts +85 -3
  95. package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -1
  96. package/lib/typescript/src/components/PasswordPrompt.d.ts +13 -0
  97. package/lib/typescript/src/components/PasswordPrompt.d.ts.map +1 -0
  98. package/lib/typescript/src/components/PlayButtonView.d.ts +12 -329
  99. package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -1
  100. package/lib/typescript/src/components/ReconnectingView.d.ts +6 -3
  101. package/lib/typescript/src/components/ReconnectingView.d.ts.map +1 -1
  102. package/lib/typescript/src/components/WarningView.d.ts.map +1 -1
  103. package/lib/typescript/src/index.d.ts +15 -144
  104. package/lib/typescript/src/index.d.ts.map +1 -1
  105. package/lib/typescript/src/sdk/Bridge.d.ts +36 -0
  106. package/lib/typescript/src/sdk/Bridge.d.ts.map +1 -0
  107. package/lib/typescript/src/sdk/Event.d.ts +97 -0
  108. package/lib/typescript/src/sdk/Event.d.ts.map +1 -0
  109. package/lib/typescript/src/sdk/Lifecycle.d.ts +191 -0
  110. package/lib/typescript/src/sdk/Lifecycle.d.ts.map +1 -0
  111. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts +215 -0
  112. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts.map +1 -0
  113. package/lib/typescript/src/sdk/LiveVoiceState.d.ts +80 -0
  114. package/lib/typescript/src/sdk/LiveVoiceState.d.ts.map +1 -0
  115. package/lib/typescript/src/sdk/LogEntries.d.ts +28 -0
  116. package/lib/typescript/src/sdk/LogEntries.d.ts.map +1 -0
  117. package/lib/typescript/src/sdk/Models.d.ts +114 -0
  118. package/lib/typescript/src/sdk/Models.d.ts.map +1 -0
  119. package/lib/typescript/src/sdk/NativeSdkVersions.d.ts +6 -0
  120. package/lib/typescript/src/sdk/NativeSdkVersions.d.ts.map +1 -0
  121. package/lib/typescript/src/sdk/Observables.d.ts +123 -0
  122. package/lib/typescript/src/sdk/Observables.d.ts.map +1 -0
  123. package/lib/typescript/src/sdk/Passwords.d.ts +72 -0
  124. package/lib/typescript/src/sdk/Passwords.d.ts.map +1 -0
  125. package/lib/typescript/src/sdk/Playback.d.ts +9 -0
  126. package/lib/typescript/src/sdk/Playback.d.ts.map +1 -0
  127. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts +35 -29
  128. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts.map +1 -1
  129. package/lib/typescript/src/util/Colors.d.ts.map +1 -1
  130. package/lib/typescript/src/util/Translations.d.ts +30 -8
  131. package/lib/typescript/src/util/Translations.d.ts.map +1 -1
  132. package/lib/typescript/src/util/freeze.d.ts +6 -0
  133. package/lib/typescript/src/util/freeze.d.ts.map +1 -0
  134. package/lib/typescript/src/util/logger.d.ts +33 -0
  135. package/lib/typescript/src/util/logger.d.ts.map +1 -0
  136. package/livevoice-sdk-react-native.podspec +41 -16
  137. package/package.json +26 -14
  138. package/src/components/BrandingView.tsx +55 -66
  139. package/src/components/ChannelView.tsx +342 -48
  140. package/src/components/ErrorView.tsx +21 -22
  141. package/src/components/LiveVoiceSpinner.tsx +87 -0
  142. package/src/components/LiveVoiceView.tsx +360 -151
  143. package/src/components/PasswordPrompt.tsx +144 -0
  144. package/src/components/PlayButtonView.tsx +177 -279
  145. package/src/components/ReconnectingView.tsx +40 -86
  146. package/src/components/WarningView.tsx +12 -10
  147. package/src/icons/branding-ios.png +0 -0
  148. package/src/icons/camera-off-android.png +0 -0
  149. package/src/icons/camera-off-android@2x.png +0 -0
  150. package/src/icons/camera-off-android@3x.png +0 -0
  151. package/src/icons/cpu-android.png +0 -0
  152. package/src/icons/cpu-android@2x.png +0 -0
  153. package/src/icons/cpu-android@3x.png +0 -0
  154. package/src/icons/cpu-ios.png +0 -0
  155. package/src/icons/cpu-ios@2x.png +0 -0
  156. package/src/icons/cpu-ios@3x.png +0 -0
  157. package/src/icons/lock-android.png +0 -0
  158. package/src/icons/lock-android@2x.png +0 -0
  159. package/src/icons/lock-android@3x.png +0 -0
  160. package/src/icons/lock-ios.png +0 -0
  161. package/src/icons/lock-ios@2x.png +0 -0
  162. package/src/icons/lock-ios@3x.png +0 -0
  163. package/src/icons/mic-off-android.png +0 -0
  164. package/src/icons/mic-off-android@2x.png +0 -0
  165. package/src/icons/mic-off-android@3x.png +0 -0
  166. package/src/icons/mic-slash-ios.png +0 -0
  167. package/src/icons/mic-slash-ios@2x.png +0 -0
  168. package/src/icons/mic-slash-ios@3x.png +0 -0
  169. package/src/icons/video-slash-ios.png +0 -0
  170. package/src/icons/video-slash-ios@2x.png +0 -0
  171. package/src/icons/video-slash-ios@3x.png +0 -0
  172. package/src/index.tsx +105 -252
  173. package/src/sdk/Bridge.ts +259 -0
  174. package/src/sdk/Event.ts +187 -0
  175. package/src/sdk/Lifecycle.ts +366 -0
  176. package/src/sdk/LiveVoiceSdk.ts +384 -0
  177. package/src/sdk/LiveVoiceState.ts +259 -0
  178. package/src/sdk/LogEntries.ts +88 -0
  179. package/src/sdk/Models.ts +129 -0
  180. package/src/sdk/NativeSdkVersions.ts +21 -0
  181. package/src/sdk/Observables.ts +414 -0
  182. package/src/sdk/Passwords.ts +286 -0
  183. package/src/sdk/Playback.ts +30 -0
  184. package/src/specs/NativeLiveVoiceSdk.ts +56 -46
  185. package/src/util/Colors.ts +14 -11
  186. package/src/util/Translations.ts +46 -22
  187. package/src/util/freeze.ts +23 -0
  188. package/src/util/logger.ts +119 -0
  189. package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeLiveVoiceSdkSpec.java +0 -186
  190. package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -28
  191. package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec-generated.cpp +0 -235
  192. package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec.h +0 -31
  193. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI.h +0 -341
  194. package/android/src/main/java/io/livevoice/react/Mappings.kt +0 -85
  195. package/android/src/main/java/io/livevoice/react/NativeModels.kt +0 -79
  196. package/lib/module/components/AudioOutputSwitchView.js +0 -138
  197. package/lib/module/components/AudioOutputSwitchView.js.map +0 -1
  198. package/lib/module/components/index.js +0 -22
  199. package/lib/module/components/index.js.map +0 -1
  200. package/lib/module/icons/mic.png +0 -0
  201. package/lib/module/util/ForegroundServiceConfig.js +0 -28
  202. package/lib/module/util/ForegroundServiceConfig.js.map +0 -1
  203. package/lib/module/util/PlayingState.js +0 -21
  204. package/lib/module/util/PlayingState.js.map +0 -1
  205. package/lib/module/util/UIState.js +0 -4
  206. package/lib/typescript/src/components/AudioOutputSwitchView.d.ts +0 -6
  207. package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +0 -1
  208. package/lib/typescript/src/components/index.d.ts +0 -9
  209. package/lib/typescript/src/components/index.d.ts.map +0 -1
  210. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts +0 -12
  211. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +0 -1
  212. package/lib/typescript/src/util/PlayingState.d.ts +0 -7
  213. package/lib/typescript/src/util/PlayingState.d.ts.map +0 -1
  214. package/lib/typescript/src/util/UIState.d.ts +0 -66
  215. package/lib/typescript/src/util/UIState.d.ts.map +0 -1
  216. package/src/components/AudioOutputSwitchView.tsx +0 -146
  217. package/src/components/index.tsx +0 -19
  218. package/src/icons/mic.png +0 -0
  219. package/src/util/ForegroundServiceConfig.tsx +0 -32
  220. package/src/util/PlayingState.ts +0 -18
  221. package/src/util/UIState.ts +0 -89
@@ -1,341 +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
- template <typename T>
19
- class JSI_EXPORT NativeLiveVoiceSdkCxxSpec : public TurboModule {
20
- public:
21
- static constexpr std::string_view kModuleName = "LiveVoiceModule";
22
-
23
- protected:
24
- NativeLiveVoiceSdkCxxSpec(std::shared_ptr<CallInvoker> jsInvoker) : TurboModule(std::string{NativeLiveVoiceSdkCxxSpec::kModuleName}, jsInvoker) {
25
- methodMap_["initialize"] = MethodMetadata {.argCount = 1, .invoker = __initialize};
26
- methodMap_["joinEvent"] = MethodMetadata {.argCount = 3, .invoker = __joinEvent};
27
- methodMap_["leaveEvent"] = MethodMetadata {.argCount = 0, .invoker = __leaveEvent};
28
- methodMap_["reconnect"] = MethodMetadata {.argCount = 0, .invoker = __reconnect};
29
- methodMap_["getCurrentClaims"] = MethodMetadata {.argCount = 0, .invoker = __getCurrentClaims};
30
- methodMap_["getCurrentUiState"] = MethodMetadata {.argCount = 0, .invoker = __getCurrentUiState};
31
- methodMap_["getCurrentAudioState"] = MethodMetadata {.argCount = 0, .invoker = __getCurrentAudioState};
32
- methodMap_["getCurrentSubtitles"] = MethodMetadata {.argCount = 0, .invoker = __getCurrentSubtitles};
33
- methodMap_["getCurrentAvailableSubtitleConfigs"] = MethodMetadata {.argCount = 0, .invoker = __getCurrentAvailableSubtitleConfigs};
34
- methodMap_["setLiveVoiceUseSpeaker"] = MethodMetadata {.argCount = 1, .invoker = __setLiveVoiceUseSpeaker};
35
- methodMap_["startChannel"] = MethodMetadata {.argCount = 1, .invoker = __startChannel};
36
- methodMap_["stopChannel"] = MethodMetadata {.argCount = 0, .invoker = __stopChannel};
37
- methodMap_["startSubtitles"] = MethodMetadata {.argCount = 1, .invoker = __startSubtitles};
38
- methodMap_["stopSubtitles"] = MethodMetadata {.argCount = 0, .invoker = __stopSubtitles};
39
- methodMap_["openLiveVoiceWebsite"] = MethodMetadata {.argCount = 0, .invoker = __openLiveVoiceWebsite};
40
- methodMap_["channelStatusOffline"] = MethodMetadata {.argCount = 0, .invoker = __channelStatusOffline};
41
- methodMap_["noChannels"] = MethodMetadata {.argCount = 0, .invoker = __noChannels};
42
- methodMap_["isAiChannelStatusMessage"] = MethodMetadata {.argCount = 0, .invoker = __isAiChannelStatusMessage};
43
- methodMap_["sdkNoMatchingChannels"] = MethodMetadata {.argCount = 0, .invoker = __sdkNoMatchingChannels};
44
- methodMap_["errorScreenRetrying"] = MethodMetadata {.argCount = 0, .invoker = __errorScreenRetrying};
45
- methodMap_["errorScreenRetryingIn"] = MethodMetadata {.argCount = 1, .invoker = __errorScreenRetryingIn};
46
- methodMap_["sdkErrorGeneric"] = MethodMetadata {.argCount = 0, .invoker = __sdkErrorGeneric};
47
- methodMap_["sdkErrorInactive"] = MethodMetadata {.argCount = 0, .invoker = __sdkErrorInactive};
48
- methodMap_["sdkErrorInvalidApiKey"] = MethodMetadata {.argCount = 0, .invoker = __sdkErrorInvalidApiKey};
49
- methodMap_["sdkErrorListenerLimitReached"] = MethodMetadata {.argCount = 0, .invoker = __sdkErrorListenerLimitReached};
50
- methodMap_["sdkErrorNoNetwork"] = MethodMetadata {.argCount = 0, .invoker = __sdkErrorNoNetwork};
51
- methodMap_["sdkErrorNotFound"] = MethodMetadata {.argCount = 0, .invoker = __sdkErrorNotFound};
52
- methodMap_["sdkErrorRequestFailed"] = MethodMetadata {.argCount = 1, .invoker = __sdkErrorRequestFailed};
53
- methodMap_["sdkErrorWrongPassword"] = MethodMetadata {.argCount = 0, .invoker = __sdkErrorWrongPassword};
54
- methodMap_["streamingByTitle"] = MethodMetadata {.argCount = 0, .invoker = __streamingByTitle};
55
- methodMap_["errorRetryNowButton"] = MethodMetadata {.argCount = 0, .invoker = __errorRetryNowButton};
56
- methodMap_["accessibilityChannelPlay"] = MethodMetadata {.argCount = 0, .invoker = __accessibilityChannelPlay};
57
- methodMap_["accessibilityChannelStatusMuted"] = MethodMetadata {.argCount = 0, .invoker = __accessibilityChannelStatusMuted};
58
- methodMap_["accessibilityChannelStop"] = MethodMetadata {.argCount = 0, .invoker = __accessibilityChannelStop};
59
- eventEmitterMap_["onUiStateChanged"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
60
- eventEmitterMap_["onAudioOutputChanged"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
61
- eventEmitterMap_["onAvailableSubtitleConfigsChanged"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
62
- eventEmitterMap_["onSubtitlesChanged"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
63
- }
64
-
65
- template <typename OnUiStateChangedType> void emitOnUiStateChanged(OnUiStateChangedType value) {
66
- static_assert(bridging::supportsFromJs<OnUiStateChangedType, jsi::String>, "value cannnot be converted to jsi::String");
67
- static_cast<AsyncEventEmitter<jsi::Value>&>(*eventEmitterMap_["onUiStateChanged"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
68
- return bridging::toJs(rt, eventValue, jsInvoker);
69
- });
70
- }
71
-
72
- template <typename OnAudioOutputChangedType> void emitOnAudioOutputChanged(OnAudioOutputChangedType value) {
73
- static_assert(bridging::supportsFromJs<OnAudioOutputChangedType, bool>, "value cannnot be converted to bool");
74
- static_cast<AsyncEventEmitter<jsi::Value>&>(*eventEmitterMap_["onAudioOutputChanged"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
75
- return bridging::toJs(rt, eventValue, jsInvoker);
76
- });
77
- }
78
-
79
- template <typename OnAvailableSubtitleConfigsChangedType> void emitOnAvailableSubtitleConfigsChanged(OnAvailableSubtitleConfigsChangedType value) {
80
- static_assert(bridging::supportsFromJs<OnAvailableSubtitleConfigsChangedType, jsi::String>, "value cannnot be converted to jsi::String");
81
- static_cast<AsyncEventEmitter<jsi::Value>&>(*eventEmitterMap_["onAvailableSubtitleConfigsChanged"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
82
- return bridging::toJs(rt, eventValue, jsInvoker);
83
- });
84
- }
85
-
86
- template <typename OnSubtitlesChangedType> void emitOnSubtitlesChanged(OnSubtitlesChangedType value) {
87
- static_assert(bridging::supportsFromJs<OnSubtitlesChangedType, jsi::String>, "value cannnot be converted to jsi::String");
88
- static_cast<AsyncEventEmitter<jsi::Value>&>(*eventEmitterMap_["onSubtitlesChanged"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
89
- return bridging::toJs(rt, eventValue, jsInvoker);
90
- });
91
- }
92
- private:
93
- static jsi::Value __initialize(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
94
- static_assert(
95
- bridging::getParameterCount(&T::initialize) == 2,
96
- "Expected initialize(...) to have 2 parameters");
97
- bridging::callFromJs<void>(rt, &T::initialize, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule),
98
- count <= 0 || args[0].isNull() || args[0].isUndefined() ? std::nullopt : std::make_optional(args[0].asString(rt)));return jsi::Value::undefined();
99
- }
100
-
101
- static jsi::Value __joinEvent(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
102
- static_assert(
103
- bridging::getParameterCount(&T::joinEvent) == 4,
104
- "Expected joinEvent(...) to have 4 parameters");
105
- bridging::callFromJs<void>(rt, &T::joinEvent, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule),
106
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
107
- count <= 1 || args[1].isNull() || args[1].isUndefined() ? std::nullopt : std::make_optional(args[1].asString(rt)),
108
- count <= 2 ? throw jsi::JSError(rt, "Expected argument in position 2 to be passed") : args[2].asString(rt));return jsi::Value::undefined();
109
- }
110
-
111
- static jsi::Value __leaveEvent(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
112
- static_assert(
113
- bridging::getParameterCount(&T::leaveEvent) == 1,
114
- "Expected leaveEvent(...) to have 1 parameters");
115
- bridging::callFromJs<void>(rt, &T::leaveEvent, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));return jsi::Value::undefined();
116
- }
117
-
118
- static jsi::Value __reconnect(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
119
- static_assert(
120
- bridging::getParameterCount(&T::reconnect) == 1,
121
- "Expected reconnect(...) to have 1 parameters");
122
- bridging::callFromJs<void>(rt, &T::reconnect, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));return jsi::Value::undefined();
123
- }
124
-
125
- static jsi::Value __getCurrentClaims(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
126
- static_assert(
127
- bridging::getParameterCount(&T::getCurrentClaims) == 1,
128
- "Expected getCurrentClaims(...) to have 1 parameters");
129
- auto result = bridging::callFromJs<std::optional<jsi::String>>(rt, &T::getCurrentClaims, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));return result ? jsi::Value(std::move(*result)) : jsi::Value::null();
130
- }
131
-
132
- static jsi::Value __getCurrentUiState(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
133
- static_assert(
134
- bridging::getParameterCount(&T::getCurrentUiState) == 1,
135
- "Expected getCurrentUiState(...) to have 1 parameters");
136
- return bridging::callFromJs<jsi::String>(rt, &T::getCurrentUiState, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
137
- }
138
-
139
- static jsi::Value __getCurrentAudioState(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
140
- static_assert(
141
- bridging::getParameterCount(&T::getCurrentAudioState) == 1,
142
- "Expected getCurrentAudioState(...) to have 1 parameters");
143
- return bridging::callFromJs<bool>(rt, &T::getCurrentAudioState, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
144
- }
145
-
146
- static jsi::Value __getCurrentSubtitles(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
147
- static_assert(
148
- bridging::getParameterCount(&T::getCurrentSubtitles) == 1,
149
- "Expected getCurrentSubtitles(...) to have 1 parameters");
150
- return bridging::callFromJs<jsi::String>(rt, &T::getCurrentSubtitles, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
151
- }
152
-
153
- static jsi::Value __getCurrentAvailableSubtitleConfigs(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
154
- static_assert(
155
- bridging::getParameterCount(&T::getCurrentAvailableSubtitleConfigs) == 1,
156
- "Expected getCurrentAvailableSubtitleConfigs(...) to have 1 parameters");
157
- return bridging::callFromJs<jsi::String>(rt, &T::getCurrentAvailableSubtitleConfigs, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
158
- }
159
-
160
- static jsi::Value __setLiveVoiceUseSpeaker(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
161
- static_assert(
162
- bridging::getParameterCount(&T::setLiveVoiceUseSpeaker) == 2,
163
- "Expected setLiveVoiceUseSpeaker(...) to have 2 parameters");
164
- bridging::callFromJs<void>(rt, &T::setLiveVoiceUseSpeaker, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule),
165
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asBool());return jsi::Value::undefined();
166
- }
167
-
168
- static jsi::Value __startChannel(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
169
- static_assert(
170
- bridging::getParameterCount(&T::startChannel) == 2,
171
- "Expected startChannel(...) to have 2 parameters");
172
- bridging::callFromJs<void>(rt, &T::startChannel, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule),
173
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber());return jsi::Value::undefined();
174
- }
175
-
176
- static jsi::Value __stopChannel(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
177
- static_assert(
178
- bridging::getParameterCount(&T::stopChannel) == 1,
179
- "Expected stopChannel(...) to have 1 parameters");
180
- bridging::callFromJs<void>(rt, &T::stopChannel, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));return jsi::Value::undefined();
181
- }
182
-
183
- static jsi::Value __startSubtitles(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
184
- static_assert(
185
- bridging::getParameterCount(&T::startSubtitles) == 2,
186
- "Expected startSubtitles(...) to have 2 parameters");
187
- bridging::callFromJs<void>(rt, &T::startSubtitles, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule),
188
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber());return jsi::Value::undefined();
189
- }
190
-
191
- static jsi::Value __stopSubtitles(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
192
- static_assert(
193
- bridging::getParameterCount(&T::stopSubtitles) == 1,
194
- "Expected stopSubtitles(...) to have 1 parameters");
195
- bridging::callFromJs<void>(rt, &T::stopSubtitles, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));return jsi::Value::undefined();
196
- }
197
-
198
- static jsi::Value __openLiveVoiceWebsite(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
199
- static_assert(
200
- bridging::getParameterCount(&T::openLiveVoiceWebsite) == 1,
201
- "Expected openLiveVoiceWebsite(...) to have 1 parameters");
202
- bridging::callFromJs<void>(rt, &T::openLiveVoiceWebsite, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));return jsi::Value::undefined();
203
- }
204
-
205
- static jsi::Value __channelStatusOffline(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
206
- static_assert(
207
- bridging::getParameterCount(&T::channelStatusOffline) == 1,
208
- "Expected channelStatusOffline(...) to have 1 parameters");
209
- return bridging::callFromJs<jsi::String>(rt, &T::channelStatusOffline, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
210
- }
211
-
212
- static jsi::Value __noChannels(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
213
- static_assert(
214
- bridging::getParameterCount(&T::noChannels) == 1,
215
- "Expected noChannels(...) to have 1 parameters");
216
- return bridging::callFromJs<jsi::String>(rt, &T::noChannels, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
217
- }
218
-
219
- static jsi::Value __isAiChannelStatusMessage(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
220
- static_assert(
221
- bridging::getParameterCount(&T::isAiChannelStatusMessage) == 1,
222
- "Expected isAiChannelStatusMessage(...) to have 1 parameters");
223
- return bridging::callFromJs<jsi::String>(rt, &T::isAiChannelStatusMessage, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
224
- }
225
-
226
- static jsi::Value __sdkNoMatchingChannels(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
227
- static_assert(
228
- bridging::getParameterCount(&T::sdkNoMatchingChannels) == 1,
229
- "Expected sdkNoMatchingChannels(...) to have 1 parameters");
230
- return bridging::callFromJs<jsi::String>(rt, &T::sdkNoMatchingChannels, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
231
- }
232
-
233
- static jsi::Value __errorScreenRetrying(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
234
- static_assert(
235
- bridging::getParameterCount(&T::errorScreenRetrying) == 1,
236
- "Expected errorScreenRetrying(...) to have 1 parameters");
237
- return bridging::callFromJs<jsi::String>(rt, &T::errorScreenRetrying, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
238
- }
239
-
240
- static jsi::Value __errorScreenRetryingIn(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
241
- static_assert(
242
- bridging::getParameterCount(&T::errorScreenRetryingIn) == 2,
243
- "Expected errorScreenRetryingIn(...) to have 2 parameters");
244
- return bridging::callFromJs<jsi::String>(rt, &T::errorScreenRetryingIn, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule),
245
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber());
246
- }
247
-
248
- static jsi::Value __sdkErrorGeneric(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
249
- static_assert(
250
- bridging::getParameterCount(&T::sdkErrorGeneric) == 1,
251
- "Expected sdkErrorGeneric(...) to have 1 parameters");
252
- return bridging::callFromJs<jsi::String>(rt, &T::sdkErrorGeneric, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
253
- }
254
-
255
- static jsi::Value __sdkErrorInactive(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
256
- static_assert(
257
- bridging::getParameterCount(&T::sdkErrorInactive) == 1,
258
- "Expected sdkErrorInactive(...) to have 1 parameters");
259
- return bridging::callFromJs<jsi::String>(rt, &T::sdkErrorInactive, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
260
- }
261
-
262
- static jsi::Value __sdkErrorInvalidApiKey(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
263
- static_assert(
264
- bridging::getParameterCount(&T::sdkErrorInvalidApiKey) == 1,
265
- "Expected sdkErrorInvalidApiKey(...) to have 1 parameters");
266
- return bridging::callFromJs<jsi::String>(rt, &T::sdkErrorInvalidApiKey, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
267
- }
268
-
269
- static jsi::Value __sdkErrorListenerLimitReached(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
270
- static_assert(
271
- bridging::getParameterCount(&T::sdkErrorListenerLimitReached) == 1,
272
- "Expected sdkErrorListenerLimitReached(...) to have 1 parameters");
273
- return bridging::callFromJs<jsi::String>(rt, &T::sdkErrorListenerLimitReached, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
274
- }
275
-
276
- static jsi::Value __sdkErrorNoNetwork(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
277
- static_assert(
278
- bridging::getParameterCount(&T::sdkErrorNoNetwork) == 1,
279
- "Expected sdkErrorNoNetwork(...) to have 1 parameters");
280
- return bridging::callFromJs<jsi::String>(rt, &T::sdkErrorNoNetwork, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
281
- }
282
-
283
- static jsi::Value __sdkErrorNotFound(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
284
- static_assert(
285
- bridging::getParameterCount(&T::sdkErrorNotFound) == 1,
286
- "Expected sdkErrorNotFound(...) to have 1 parameters");
287
- return bridging::callFromJs<jsi::String>(rt, &T::sdkErrorNotFound, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
288
- }
289
-
290
- static jsi::Value __sdkErrorRequestFailed(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
291
- static_assert(
292
- bridging::getParameterCount(&T::sdkErrorRequestFailed) == 2,
293
- "Expected sdkErrorRequestFailed(...) to have 2 parameters");
294
- return bridging::callFromJs<jsi::String>(rt, &T::sdkErrorRequestFailed, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule),
295
- count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asNumber());
296
- }
297
-
298
- static jsi::Value __sdkErrorWrongPassword(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
299
- static_assert(
300
- bridging::getParameterCount(&T::sdkErrorWrongPassword) == 1,
301
- "Expected sdkErrorWrongPassword(...) to have 1 parameters");
302
- return bridging::callFromJs<jsi::String>(rt, &T::sdkErrorWrongPassword, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
303
- }
304
-
305
- static jsi::Value __streamingByTitle(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
306
- static_assert(
307
- bridging::getParameterCount(&T::streamingByTitle) == 1,
308
- "Expected streamingByTitle(...) to have 1 parameters");
309
- return bridging::callFromJs<jsi::String>(rt, &T::streamingByTitle, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
310
- }
311
-
312
- static jsi::Value __errorRetryNowButton(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
313
- static_assert(
314
- bridging::getParameterCount(&T::errorRetryNowButton) == 1,
315
- "Expected errorRetryNowButton(...) to have 1 parameters");
316
- return bridging::callFromJs<jsi::String>(rt, &T::errorRetryNowButton, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
317
- }
318
-
319
- static jsi::Value __accessibilityChannelPlay(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
320
- static_assert(
321
- bridging::getParameterCount(&T::accessibilityChannelPlay) == 1,
322
- "Expected accessibilityChannelPlay(...) to have 1 parameters");
323
- return bridging::callFromJs<jsi::String>(rt, &T::accessibilityChannelPlay, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
324
- }
325
-
326
- static jsi::Value __accessibilityChannelStatusMuted(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
327
- static_assert(
328
- bridging::getParameterCount(&T::accessibilityChannelStatusMuted) == 1,
329
- "Expected accessibilityChannelStatusMuted(...) to have 1 parameters");
330
- return bridging::callFromJs<jsi::String>(rt, &T::accessibilityChannelStatusMuted, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
331
- }
332
-
333
- static jsi::Value __accessibilityChannelStop(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
334
- static_assert(
335
- bridging::getParameterCount(&T::accessibilityChannelStop) == 1,
336
- "Expected accessibilityChannelStop(...) to have 1 parameters");
337
- return bridging::callFromJs<jsi::String>(rt, &T::accessibilityChannelStop, static_cast<NativeLiveVoiceSdkCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
338
- }
339
- };
340
-
341
- } // namespace facebook::react
@@ -1,85 +0,0 @@
1
- //===----------------------------------------------------------------------===//
2
- //
3
- // This source file is part of the LiveVoice SDK project
4
- //
5
- // Copyright (c) LiveVoice GmbH
6
- // Licensed under the MIT license
7
- //
8
- // See LICENSE for license information
9
- //
10
- // SPDX-License-Identifier: MIT
11
- //
12
- //===----------------------------------------------------------------------===//
13
-
14
- package io.livevoice.react
15
-
16
- import io.livevoice.sdk.android.publicApi.core.model.channel.LiveVoicePlayingState
17
- import io.livevoice.sdk.android.publicApi.core.model.SdkRetryState
18
- import io.livevoice.sdk.android.publicApi.core.model.SdkUiState
19
- import io.livevoice.sdk.android.publicApi.core.model.subtitle.AvailableSubtitle
20
- import kotlinx.serialization.Serializable
21
- import kotlinx.serialization.SerialName
22
-
23
- @Serializable
24
- sealed interface NativeAvailableSubtitle {
25
- @Serializable
26
- @SerialName("Transcript")
27
- data class Transcript(
28
- val channelId: Long,
29
- val name: String,
30
- val language: String? = null,
31
- val parentChannelId: Long? = null
32
- ) : NativeAvailableSubtitle
33
-
34
- @Serializable
35
- @SerialName("Translated")
36
- data class Translated(
37
- val channelId: Long,
38
- val name: String,
39
- val language: String,
40
- val parentChannelId: Long
41
- ) : NativeAvailableSubtitle
42
- }
43
-
44
- fun AvailableSubtitle.mapToNative(): NativeAvailableSubtitle = when (this) {
45
- is AvailableSubtitle.Transcript -> NativeAvailableSubtitle.Transcript(channelId, name)
46
- is AvailableSubtitle.Translated -> NativeAvailableSubtitle.Translated(channelId, name, language, parentChannelId)
47
- }
48
-
49
- fun SdkUiState.mapToTransferable(): NativeUiState = when (this) {
50
- SdkUiState.Loading -> NativeLoading
51
- is SdkUiState.Ready -> NativeReady(
52
- channels = channels.map {
53
- NativeChannel(
54
- id = it.id,
55
- name = it.name,
56
- isOnline = it.isOnline,
57
- isAudioMuted = it.isAudioMuted,
58
- isAiSpeaker = it.isAiSpeaker,
59
- playingState = it.playingState.mapToNative(),
60
- hasSubtitles = it.hasSubtitles,
61
- hasAudio = it.hasAudio,
62
- )
63
- },
64
- )
65
-
66
- is SdkUiState.Error -> NativeError(
67
- message = message,
68
- canBeRetried = onRetry != null
69
- )
70
-
71
- is SdkUiState.Reconnecting -> {
72
- val retryState = when (val state = this.retryState) {
73
- is SdkRetryState.AwaitingNextReconnectAttempt -> NativeRetryState.AwaitRetry(state.retryTimestampSeconds)
74
- SdkRetryState.RetryInProgress -> NativeRetryState.InProgress
75
- }
76
-
77
- NativeReconnecting(state = retryState)
78
- }
79
- }
80
-
81
- private fun LiveVoicePlayingState.mapToNative() = when (this) {
82
- LiveVoicePlayingState.Stopped -> NativePlayingState.STOPPED
83
- LiveVoicePlayingState.Playing -> NativePlayingState.PLAYING
84
- LiveVoicePlayingState.Connecting, LiveVoicePlayingState.Stopping -> NativePlayingState.TRANSITIONING
85
- }
@@ -1,79 +0,0 @@
1
- //===----------------------------------------------------------------------===//
2
- //
3
- // This source file is part of the LiveVoice SDK project
4
- //
5
- // Copyright (c) LiveVoice GmbH
6
- // Licensed under the MIT license
7
- //
8
- // See LICENSE for license information
9
- //
10
- // SPDX-License-Identifier: MIT
11
- //
12
- //===----------------------------------------------------------------------===//
13
-
14
- package io.livevoice.react
15
-
16
- import kotlinx.serialization.SerialName
17
- import kotlinx.serialization.Serializable
18
-
19
- @Serializable
20
- @SerialName("channel")
21
- data class NativeChannel(
22
- val id: Long,
23
- val name: String,
24
- val isOnline: Boolean,
25
- val isAudioMuted: Boolean,
26
- val isAiSpeaker: Boolean,
27
- /** State of the channel reflecting the local playback */
28
- val playingState: NativePlayingState,
29
- val hasSubtitles: Boolean,
30
- val hasAudio: Boolean,
31
- )
32
-
33
- @Serializable
34
- data class NativeClaims(
35
- val hideBranding: Boolean,
36
- val allowCustomUi: Boolean,
37
- )
38
-
39
- @Serializable
40
- @SerialName("playingState")
41
- enum class NativePlayingState {
42
- STOPPED, TRANSITIONING, PLAYING;
43
- }
44
-
45
- @Serializable
46
- @SerialName("ready")
47
- data class NativeReady(
48
- val channels: List<NativeChannel>,
49
- ) : NativeUiState
50
-
51
- @Serializable
52
- @SerialName("nativeUiState")
53
- sealed interface NativeUiState
54
-
55
- @Serializable
56
- @SerialName("loading")
57
- data object NativeLoading : NativeUiState
58
-
59
- @Serializable
60
- @SerialName("error")
61
- data class NativeError(
62
- val message: String,
63
- val canBeRetried: Boolean,
64
- ) : NativeUiState
65
-
66
- @Serializable
67
- @SerialName("reconnecting")
68
- data class NativeReconnecting(val state: NativeRetryState) : NativeUiState
69
-
70
- @Serializable
71
- sealed interface NativeRetryState {
72
- @Serializable
73
- @SerialName("inProgress")
74
- data object InProgress : NativeRetryState
75
-
76
- @Serializable
77
- @SerialName("awaitingRetry")
78
- data class AwaitRetry(val atTimestamp: Long) : NativeRetryState
79
- }
@@ -1,138 +0,0 @@
1
- "use strict";
2
-
3
- /*
4
- * This source file is part of the LiveVoice SDK project
5
- *
6
- * Copyright (c) LiveVoice GmbH
7
- * Licensed under the MIT license
8
- *
9
- * See LICENSE for license information
10
- *
11
- * SPDX-License-Identifier: MIT
12
- */
13
-
14
- import { getCurrentAudioState, onAudioOutputChanged, setLiveVoiceUseSpeaker } from 'livevoice-sdk-react-native';
15
- import React, { useState, useRef, useEffect } from 'react';
16
- import { View, TouchableOpacity, StyleSheet, Animated, Easing, Image, useColorScheme } from 'react-native';
17
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
- export const AudioOutputSwitchView = props => {
19
- const [isSpeaker, setIsSpeaker] = useState(() => getCurrentAudioState());
20
- useEffect(() => {
21
- let subscription = onAudioOutputChanged(value => {
22
- console.log('State changed: ' + value);
23
- setIsSpeaker(value);
24
- });
25
- return () => {
26
- subscription?.remove();
27
- subscription = undefined;
28
- };
29
- }, []);
30
- const isDarkMode = props.isDarkMode != undefined ? props.isDarkMode : useColorScheme() === 'dark';
31
- const animation = useRef(new Animated.Value(isSpeaker ? 1 : 0)).current;
32
- useEffect(() => {
33
- Animated.timing(animation, {
34
- toValue: isSpeaker ? 1 : 0,
35
- //start with correct position depending on isSpeaker state
36
- duration: 100,
37
- easing: Easing.out(Easing.circle),
38
- useNativeDriver: false
39
- }).start();
40
- }, [isSpeaker]);
41
- const togglePosition = animation.interpolate({
42
- inputRange: [0, 1],
43
- outputRange: [2, 60] // Adjust these values based on your design
44
- });
45
- const iconColor = isDarkMode ? '#fff' : '#191919';
46
- return /*#__PURE__*/_jsxs(TouchableOpacity, {
47
- activeOpacity: 1,
48
- onPress: () => {
49
- console.log('Clicked: with current' + isSpeaker);
50
- setLiveVoiceUseSpeaker(!isSpeaker);
51
- },
52
- style: [styles.container, isDarkMode ? styles.darkMode : styles.lightMode],
53
- children: [/*#__PURE__*/_jsxs(View, {
54
- style: styles.iconContainer,
55
- children: [/*#__PURE__*/_jsx(Image, {
56
- source: require('../icons/headphones.png'),
57
- style: {
58
- tintColor: iconColor,
59
- width: 20,
60
- height: 20,
61
- resizeMode: 'contain'
62
- }
63
- }), /*#__PURE__*/_jsx(Image, {
64
- source: require('../icons/speaker.png'),
65
- style: {
66
- tintColor: iconColor,
67
- width: 20,
68
- height: 20,
69
- resizeMode: 'contain'
70
- }
71
- })]
72
- }), /*#__PURE__*/_jsx(Animated.View, {
73
- style: [styles.toggle, isDarkMode ? styles.toggleBackgroundDark : styles.toggleBackgroundLight, {
74
- transform: [{
75
- translateX: togglePosition
76
- }]
77
- }],
78
- children: isSpeaker ? /*#__PURE__*/_jsx(Image, {
79
- source: require('../icons/speaker.png'),
80
- style: {
81
- tintColor: iconColor,
82
- width: 20,
83
- height: 20,
84
- resizeMode: 'contain'
85
- }
86
- }) : /*#__PURE__*/_jsx(Image, {
87
- source: require('../icons/headphones.png'),
88
- style: {
89
- tintColor: iconColor,
90
- width: 20,
91
- height: 20,
92
- resizeMode: 'contain'
93
- }
94
- })
95
- })]
96
- });
97
- };
98
- const styles = StyleSheet.create({
99
- container: {
100
- width: 120,
101
- height: 40,
102
- borderRadius: 20,
103
- flexDirection: 'row',
104
- alignItems: 'center',
105
- justifyContent: 'space-between',
106
- paddingHorizontal: 16,
107
- position: 'relative'
108
- },
109
- darkMode: {
110
- backgroundColor: '#393F45'
111
- },
112
- lightMode: {
113
- backgroundColor: '#E7E7E7'
114
- },
115
- iconContainer: {
116
- flexDirection: 'row',
117
- alignItems: 'center',
118
- justifyContent: 'space-between',
119
- width: '100%',
120
- paddingHorizontal: 7
121
- },
122
- toggle: {
123
- width: 58,
124
- height: 36,
125
- borderRadius: 18,
126
- position: 'absolute',
127
- flex: 1,
128
- alignItems: 'center',
129
- justifyContent: 'center'
130
- },
131
- toggleBackgroundDark: {
132
- backgroundColor: '#212529'
133
- },
134
- toggleBackgroundLight: {
135
- backgroundColor: '#fff'
136
- }
137
- });
138
- //# sourceMappingURL=AudioOutputSwitchView.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["getCurrentAudioState","onAudioOutputChanged","setLiveVoiceUseSpeaker","React","useState","useRef","useEffect","View","TouchableOpacity","StyleSheet","Animated","Easing","Image","useColorScheme","jsx","_jsx","jsxs","_jsxs","AudioOutputSwitchView","props","isSpeaker","setIsSpeaker","subscription","value","console","log","remove","undefined","isDarkMode","animation","Value","current","timing","toValue","duration","easing","out","circle","useNativeDriver","start","togglePosition","interpolate","inputRange","outputRange","iconColor","activeOpacity","onPress","style","styles","container","darkMode","lightMode","children","iconContainer","source","require","tintColor","width","height","resizeMode","toggle","toggleBackgroundDark","toggleBackgroundLight","transform","translateX","create","borderRadius","flexDirection","alignItems","justifyContent","paddingHorizontal","position","backgroundColor","flex"],"sourceRoot":"../../../src","sources":["components/AudioOutputSwitchView.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,oBAAoB,EAAEC,oBAAoB,EAAEC,sBAAsB,QAAQ,4BAA4B;AAC/G,OAAOC,KAAK,IAAIC,QAAQ,EAAEC,MAAM,EAAEC,SAAS,QAAS,OAAO;AAC3D,SACEC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,QAAQ,EACRC,MAAM,EACNC,KAAK,EACLC,cAAc,QACT,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAMtB,OAAO,MAAMC,qBAAuD,GAAIC,KAAK,IAAK;EAChF,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGjB,QAAQ,CAAW,MAAOJ,oBAAoB,CAAC,CAAG,CAAC;EACrFM,SAAS,CAAC,MAAM;IACd,IAAIgB,YAA4C,GAAGrB,oBAAoB,CAAEsB,KAAc,IAAK;MAC1FC,OAAO,CAACC,GAAG,CAAC,iBAAiB,GAAGF,KAAK,CAAC;MACtCF,YAAY,CAACE,KAAK,CAAC;IACrB,CAAC,CAAC;IACF,OAAO,MAAM;MACXD,YAAY,EAAEI,MAAM,CAAC,CAAC;MACtBJ,YAAY,GAAGK,SAAS;IAC1B,CAAC;EACH,CAAC,EAAE,EAAE,CAA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