livevoice-sdk-react-native 1.0.3 → 2.0.1

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 (231) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +119 -7
  3. package/android/build.gradle +52 -84
  4. package/android/gradle.properties +10 -6
  5. package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +93 -126
  6. package/android/src/main/java/io/livevoice/react/LiveVoiceSdkReactNativePackage.kt +12 -13
  7. package/android/src/main/java/io/livevoice/react/__SDK.kt +16 -2
  8. package/ios/LiveVoiceSdkReactNative.h +5 -5
  9. package/ios/LiveVoiceSdkReactNative.mm +308 -0
  10. package/ios/__SDK.h +16 -2
  11. package/lib/module/components/AudioOutputSwitchView.js +13 -13
  12. package/lib/module/components/AudioOutputSwitchView.js.map +1 -1
  13. package/lib/module/components/BrandingView.js +13 -11
  14. package/lib/module/components/BrandingView.js.map +1 -1
  15. package/lib/module/components/ChannelView.js +27 -48
  16. package/lib/module/components/ChannelView.js.map +1 -1
  17. package/lib/module/components/ErrorView.js +12 -10
  18. package/lib/module/components/ErrorView.js.map +1 -1
  19. package/lib/module/components/LiveVoiceView.js +153 -61
  20. package/lib/module/components/LiveVoiceView.js.map +1 -1
  21. package/lib/module/components/PlayButtonView.js +255 -94
  22. package/lib/module/components/PlayButtonView.js.map +1 -1
  23. package/lib/module/components/ReconnectingView.js +16 -13
  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/components/index.js +12 -10
  28. package/lib/module/components/index.js.map +1 -1
  29. package/lib/module/icons/captions@1x.png +0 -0
  30. package/lib/module/icons/captions@2x.png +0 -0
  31. package/lib/module/icons/pause@1x.png +0 -0
  32. package/lib/module/icons/pause@2x.png +0 -0
  33. package/lib/module/icons/play@1x.png +0 -0
  34. package/lib/module/icons/play@2x.png +0 -0
  35. package/lib/module/index.js +14 -222
  36. package/lib/module/index.js.map +1 -1
  37. package/lib/module/sdk/LiveVoiceSdk.js +371 -0
  38. package/lib/module/sdk/LiveVoiceSdk.js.map +1 -0
  39. package/lib/module/sdk/LiveVoiceState.js +66 -0
  40. package/lib/module/sdk/LiveVoiceState.js.map +1 -0
  41. package/lib/module/specs/NativeLiveVoiceSdk.js +16 -10
  42. package/lib/module/specs/NativeLiveVoiceSdk.js.map +1 -1
  43. package/lib/module/util/Colors.js +14 -11
  44. package/lib/module/util/Colors.js.map +1 -1
  45. package/lib/module/util/ForegroundServiceConfig.js +21 -11
  46. package/lib/module/util/ForegroundServiceConfig.js.map +1 -1
  47. package/lib/module/util/PlayingState.js +12 -10
  48. package/lib/module/util/PlayingState.js.map +1 -1
  49. package/lib/module/util/Translations.js +12 -10
  50. package/lib/module/util/Translations.js.map +1 -1
  51. package/lib/module/util/logger.js +76 -0
  52. package/lib/module/util/logger.js.map +1 -0
  53. package/lib/typescript/package.json +1 -0
  54. package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +1 -0
  55. package/lib/typescript/src/components/BrandingView.d.ts.map +1 -0
  56. package/lib/typescript/{commonjs/src → src}/components/ChannelView.d.ts +4 -2
  57. package/lib/typescript/src/components/ChannelView.d.ts.map +1 -0
  58. package/lib/typescript/src/components/ErrorView.d.ts.map +1 -0
  59. package/lib/typescript/src/components/LiveVoiceView.d.ts +28 -0
  60. package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -0
  61. package/lib/typescript/src/components/PlayButtonView.d.ts +341 -0
  62. package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -0
  63. package/lib/typescript/src/components/ReconnectingView.d.ts.map +1 -0
  64. package/lib/typescript/src/components/WarningView.d.ts.map +1 -0
  65. package/lib/typescript/src/components/index.d.ts.map +1 -0
  66. package/lib/typescript/src/index.d.ts +7 -0
  67. package/lib/typescript/src/index.d.ts.map +1 -0
  68. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts +210 -0
  69. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts.map +1 -0
  70. package/lib/typescript/src/sdk/LiveVoiceState.d.ts +12 -0
  71. package/lib/typescript/src/sdk/LiveVoiceState.d.ts.map +1 -0
  72. package/lib/typescript/{module/src → src}/specs/NativeLiveVoiceSdk.d.ts +6 -3
  73. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts.map +1 -0
  74. package/lib/typescript/{commonjs/src → src}/util/Colors.d.ts +2 -1
  75. package/lib/typescript/src/util/Colors.d.ts.map +1 -0
  76. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts +19 -0
  77. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +1 -0
  78. package/lib/typescript/src/util/PlayingState.d.ts.map +1 -0
  79. package/lib/typescript/src/util/Translations.d.ts.map +1 -0
  80. package/lib/typescript/src/util/UIState.d.ts +86 -0
  81. package/lib/typescript/src/util/UIState.d.ts.map +1 -0
  82. package/lib/typescript/src/util/logger.d.ts +23 -0
  83. package/lib/typescript/src/util/logger.d.ts.map +1 -0
  84. package/livevoice-sdk-react-native.podspec +20 -41
  85. package/package.json +41 -122
  86. package/src/components/AudioOutputSwitchView.tsx +13 -13
  87. package/src/components/BrandingView.tsx +13 -11
  88. package/src/components/ChannelView.tsx +32 -36
  89. package/src/components/ErrorView.tsx +12 -10
  90. package/src/components/LiveVoiceView.tsx +231 -89
  91. package/src/components/PlayButtonView.tsx +293 -98
  92. package/src/components/ReconnectingView.tsx +20 -13
  93. package/src/components/WarningView.tsx +12 -10
  94. package/src/components/index.tsx +12 -10
  95. package/src/icons/captions@1x.png +0 -0
  96. package/src/icons/captions@2x.png +0 -0
  97. package/src/icons/pause@1x.png +0 -0
  98. package/src/icons/pause@2x.png +0 -0
  99. package/src/icons/play@1x.png +0 -0
  100. package/src/icons/play@2x.png +0 -0
  101. package/src/index.tsx +19 -236
  102. package/src/sdk/LiveVoiceSdk.ts +408 -0
  103. package/src/sdk/LiveVoiceState.ts +89 -0
  104. package/src/specs/NativeLiveVoiceSdk.ts +24 -16
  105. package/src/util/Colors.ts +15 -11
  106. package/src/util/ForegroundServiceConfig.tsx +21 -11
  107. package/src/util/PlayingState.ts +12 -10
  108. package/src/util/Translations.ts +12 -10
  109. package/src/util/UIState.ts +54 -13
  110. package/src/util/logger.ts +92 -0
  111. package/android/generated/java/io/livevoice/react/NativeLiveVoiceSdkSpec.java +0 -186
  112. package/android/generated/jni/CMakeLists.txt +0 -36
  113. package/android/generated/jni/RNLiveVoiceSpec-generated.cpp +0 -235
  114. package/android/generated/jni/RNLiveVoiceSpec.h +0 -31
  115. package/android/generated/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI-generated.cpp +0 -245
  116. package/android/generated/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI.h +0 -398
  117. package/android/src/main/AndroidManifest.xml +0 -3
  118. package/android/src/main/java/io/livevoice/react/Mappings.kt +0 -54
  119. package/android/src/main/java/io/livevoice/react/NativeModels.kt +0 -77
  120. package/ios/LivevoiceSdkReactNative.mm +0 -250
  121. package/ios/generated/RNLiveVoiceSpec/RNLiveVoiceSpec-generated.mm +0 -292
  122. package/ios/generated/RNLiveVoiceSpec/RNLiveVoiceSpec.h +0 -101
  123. package/ios/generated/RNLiveVoiceSpecJSI-generated.cpp +0 -245
  124. package/ios/generated/RNLiveVoiceSpecJSI.h +0 -398
  125. package/lib/commonjs/components/AudioOutputSwitchView.js +0 -144
  126. package/lib/commonjs/components/AudioOutputSwitchView.js.map +0 -1
  127. package/lib/commonjs/components/BrandingView.js +0 -78
  128. package/lib/commonjs/components/BrandingView.js.map +0 -1
  129. package/lib/commonjs/components/ChannelView.js +0 -117
  130. package/lib/commonjs/components/ChannelView.js.map +0 -1
  131. package/lib/commonjs/components/ErrorView.js +0 -88
  132. package/lib/commonjs/components/ErrorView.js.map +0 -1
  133. package/lib/commonjs/components/LiveVoiceView.js +0 -107
  134. package/lib/commonjs/components/LiveVoiceView.js.map +0 -1
  135. package/lib/commonjs/components/PlayButtonView.js +0 -161
  136. package/lib/commonjs/components/PlayButtonView.js.map +0 -1
  137. package/lib/commonjs/components/ReconnectingView.js +0 -109
  138. package/lib/commonjs/components/ReconnectingView.js.map +0 -1
  139. package/lib/commonjs/components/WarningView.js +0 -58
  140. package/lib/commonjs/components/WarningView.js.map +0 -1
  141. package/lib/commonjs/components/index.js +0 -94
  142. package/lib/commonjs/components/index.js.map +0 -1
  143. package/lib/commonjs/icons/branding.png +0 -0
  144. package/lib/commonjs/icons/cpu.png +0 -0
  145. package/lib/commonjs/icons/headphones.png +0 -0
  146. package/lib/commonjs/icons/mic.png +0 -0
  147. package/lib/commonjs/icons/pause.png +0 -0
  148. package/lib/commonjs/icons/play.png +0 -0
  149. package/lib/commonjs/icons/speaker.png +0 -0
  150. package/lib/commonjs/index.js +0 -327
  151. package/lib/commonjs/index.js.map +0 -1
  152. package/lib/commonjs/specs/NativeLiveVoiceSdk.js +0 -19
  153. package/lib/commonjs/specs/NativeLiveVoiceSdk.js.map +0 -1
  154. package/lib/commonjs/util/Colors.js +0 -30
  155. package/lib/commonjs/util/Colors.js.map +0 -1
  156. package/lib/commonjs/util/ForegroundServiceConfig.js +0 -33
  157. package/lib/commonjs/util/ForegroundServiceConfig.js.map +0 -1
  158. package/lib/commonjs/util/PlayingState.js +0 -24
  159. package/lib/commonjs/util/PlayingState.js.map +0 -1
  160. package/lib/commonjs/util/Translations.js +0 -47
  161. package/lib/commonjs/util/Translations.js.map +0 -1
  162. package/lib/commonjs/util/UIState.js +0 -6
  163. package/lib/commonjs/util/UIState.js.map +0 -1
  164. package/lib/module/icons/pause.png +0 -0
  165. package/lib/module/icons/play.png +0 -0
  166. package/lib/typescript/commonjs/package.json +0 -1
  167. package/lib/typescript/commonjs/src/components/AudioOutputSwitchView.d.ts.map +0 -1
  168. package/lib/typescript/commonjs/src/components/BrandingView.d.ts.map +0 -1
  169. package/lib/typescript/commonjs/src/components/ChannelView.d.ts.map +0 -1
  170. package/lib/typescript/commonjs/src/components/ErrorView.d.ts.map +0 -1
  171. package/lib/typescript/commonjs/src/components/LiveVoiceView.d.ts +0 -6
  172. package/lib/typescript/commonjs/src/components/LiveVoiceView.d.ts.map +0 -1
  173. package/lib/typescript/commonjs/src/components/PlayButtonView.d.ts +0 -146
  174. package/lib/typescript/commonjs/src/components/PlayButtonView.d.ts.map +0 -1
  175. package/lib/typescript/commonjs/src/components/ReconnectingView.d.ts.map +0 -1
  176. package/lib/typescript/commonjs/src/components/WarningView.d.ts.map +0 -1
  177. package/lib/typescript/commonjs/src/components/index.d.ts.map +0 -1
  178. package/lib/typescript/commonjs/src/index.d.ts +0 -149
  179. package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
  180. package/lib/typescript/commonjs/src/specs/NativeLiveVoiceSdk.d.ts +0 -48
  181. package/lib/typescript/commonjs/src/specs/NativeLiveVoiceSdk.d.ts.map +0 -1
  182. package/lib/typescript/commonjs/src/util/Colors.d.ts.map +0 -1
  183. package/lib/typescript/commonjs/src/util/ForegroundServiceConfig.d.ts +0 -12
  184. package/lib/typescript/commonjs/src/util/ForegroundServiceConfig.d.ts.map +0 -1
  185. package/lib/typescript/commonjs/src/util/PlayingState.d.ts.map +0 -1
  186. package/lib/typescript/commonjs/src/util/Translations.d.ts.map +0 -1
  187. package/lib/typescript/commonjs/src/util/UIState.d.ts +0 -45
  188. package/lib/typescript/commonjs/src/util/UIState.d.ts.map +0 -1
  189. package/lib/typescript/module/src/components/AudioOutputSwitchView.d.ts +0 -6
  190. package/lib/typescript/module/src/components/AudioOutputSwitchView.d.ts.map +0 -1
  191. package/lib/typescript/module/src/components/BrandingView.d.ts +0 -6
  192. package/lib/typescript/module/src/components/BrandingView.d.ts.map +0 -1
  193. package/lib/typescript/module/src/components/ChannelView.d.ts +0 -13
  194. package/lib/typescript/module/src/components/ChannelView.d.ts.map +0 -1
  195. package/lib/typescript/module/src/components/ErrorView.d.ts +0 -9
  196. package/lib/typescript/module/src/components/ErrorView.d.ts.map +0 -1
  197. package/lib/typescript/module/src/components/LiveVoiceView.d.ts +0 -6
  198. package/lib/typescript/module/src/components/LiveVoiceView.d.ts.map +0 -1
  199. package/lib/typescript/module/src/components/PlayButtonView.d.ts +0 -146
  200. package/lib/typescript/module/src/components/PlayButtonView.d.ts.map +0 -1
  201. package/lib/typescript/module/src/components/ReconnectingView.d.ts +0 -9
  202. package/lib/typescript/module/src/components/ReconnectingView.d.ts.map +0 -1
  203. package/lib/typescript/module/src/components/WarningView.d.ts +0 -8
  204. package/lib/typescript/module/src/components/WarningView.d.ts.map +0 -1
  205. package/lib/typescript/module/src/components/index.d.ts +0 -9
  206. package/lib/typescript/module/src/components/index.d.ts.map +0 -1
  207. package/lib/typescript/module/src/index.d.ts +0 -149
  208. package/lib/typescript/module/src/index.d.ts.map +0 -1
  209. package/lib/typescript/module/src/specs/NativeLiveVoiceSdk.d.ts.map +0 -1
  210. package/lib/typescript/module/src/util/Colors.d.ts +0 -13
  211. package/lib/typescript/module/src/util/Colors.d.ts.map +0 -1
  212. package/lib/typescript/module/src/util/ForegroundServiceConfig.d.ts +0 -12
  213. package/lib/typescript/module/src/util/ForegroundServiceConfig.d.ts.map +0 -1
  214. package/lib/typescript/module/src/util/PlayingState.d.ts +0 -7
  215. package/lib/typescript/module/src/util/PlayingState.d.ts.map +0 -1
  216. package/lib/typescript/module/src/util/Translations.d.ts +0 -22
  217. package/lib/typescript/module/src/util/Translations.d.ts.map +0 -1
  218. package/lib/typescript/module/src/util/UIState.d.ts +0 -45
  219. package/lib/typescript/module/src/util/UIState.d.ts.map +0 -1
  220. package/react-native.config.js +0 -12
  221. package/src/icons/pause.png +0 -0
  222. package/src/icons/play.png +0 -0
  223. /package/lib/{typescript/module → module}/package.json +0 -0
  224. /package/lib/typescript/{commonjs/src → src}/components/AudioOutputSwitchView.d.ts +0 -0
  225. /package/lib/typescript/{commonjs/src → src}/components/BrandingView.d.ts +0 -0
  226. /package/lib/typescript/{commonjs/src → src}/components/ErrorView.d.ts +0 -0
  227. /package/lib/typescript/{commonjs/src → src}/components/ReconnectingView.d.ts +0 -0
  228. /package/lib/typescript/{commonjs/src → src}/components/WarningView.d.ts +0 -0
  229. /package/lib/typescript/{commonjs/src → src}/components/index.d.ts +0 -0
  230. /package/lib/typescript/{commonjs/src → src}/util/PlayingState.d.ts +0 -0
  231. /package/lib/typescript/{commonjs/src → src}/util/Translations.d.ts +0 -0
@@ -1,398 +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 NativeLiveVoiceSdkCxxSpecJSI : public TurboModule {
19
- protected:
20
- NativeLiveVoiceSdkCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
21
-
22
- public:
23
- virtual void initialize(jsi::Runtime &rt, std::optional<jsi::String> androidServiceConfig) = 0;
24
- virtual void joinEvent(jsi::Runtime &rt, jsi::String joinCode, std::optional<jsi::String> password, jsi::String apiKey) = 0;
25
- virtual void leaveEvent(jsi::Runtime &rt) = 0;
26
- virtual void reconnect(jsi::Runtime &rt) = 0;
27
- virtual std::optional<jsi::String> getCurrentClaims(jsi::Runtime &rt) = 0;
28
- virtual jsi::String getCurrentUiState(jsi::Runtime &rt) = 0;
29
- virtual bool getCurrentAudioState(jsi::Runtime &rt) = 0;
30
- virtual jsi::String getCurrentSubtitles(jsi::Runtime &rt) = 0;
31
- virtual jsi::String getCurrentAvailableSubtitleConfigs(jsi::Runtime &rt) = 0;
32
- virtual void setLiveVoiceUseSpeaker(jsi::Runtime &rt, bool value) = 0;
33
- virtual void startChannel(jsi::Runtime &rt, double id) = 0;
34
- virtual void stopChannel(jsi::Runtime &rt) = 0;
35
- virtual void startSubtitles(jsi::Runtime &rt, double channelId, std::optional<jsi::String> languageCode) = 0;
36
- virtual void stopSubtitles(jsi::Runtime &rt) = 0;
37
- virtual void openLiveVoiceWebsite(jsi::Runtime &rt) = 0;
38
- virtual jsi::String channelStatusOffline(jsi::Runtime &rt) = 0;
39
- virtual jsi::String noChannels(jsi::Runtime &rt) = 0;
40
- virtual jsi::String isAiChannelStatusMessage(jsi::Runtime &rt) = 0;
41
- virtual jsi::String sdkNoMatchingChannels(jsi::Runtime &rt) = 0;
42
- virtual jsi::String errorScreenRetrying(jsi::Runtime &rt) = 0;
43
- virtual jsi::String errorScreenRetryingIn(jsi::Runtime &rt, double seconds) = 0;
44
- virtual jsi::String sdkErrorGeneric(jsi::Runtime &rt) = 0;
45
- virtual jsi::String sdkErrorInactive(jsi::Runtime &rt) = 0;
46
- virtual jsi::String sdkErrorInvalidApiKey(jsi::Runtime &rt) = 0;
47
- virtual jsi::String sdkErrorListenerLimitReached(jsi::Runtime &rt) = 0;
48
- virtual jsi::String sdkErrorNoNetwork(jsi::Runtime &rt) = 0;
49
- virtual jsi::String sdkErrorNotFound(jsi::Runtime &rt) = 0;
50
- virtual jsi::String sdkErrorRequestFailed(jsi::Runtime &rt, double errorCode) = 0;
51
- virtual jsi::String sdkErrorWrongPassword(jsi::Runtime &rt) = 0;
52
- virtual jsi::String streamingByTitle(jsi::Runtime &rt) = 0;
53
- virtual jsi::String errorRetryNowButton(jsi::Runtime &rt) = 0;
54
- virtual jsi::String accessibilityChannelPlay(jsi::Runtime &rt) = 0;
55
- virtual jsi::String accessibilityChannelStatusMuted(jsi::Runtime &rt) = 0;
56
- virtual jsi::String accessibilityChannelStop(jsi::Runtime &rt) = 0;
57
-
58
- };
59
-
60
- template <typename T>
61
- class JSI_EXPORT NativeLiveVoiceSdkCxxSpec : public TurboModule {
62
- public:
63
- jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
64
- return delegate_.create(rt, propName);
65
- }
66
-
67
- std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
68
- return delegate_.getPropertyNames(runtime);
69
- }
70
-
71
- static constexpr std::string_view kModuleName = "LiveVoiceModule";
72
-
73
- protected:
74
- NativeLiveVoiceSdkCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
75
- : TurboModule(std::string{NativeLiveVoiceSdkCxxSpec::kModuleName}, jsInvoker),
76
- delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
77
-
78
- template <typename OnUiStateChangedType> void emitOnUiStateChanged(OnUiStateChangedType value) {
79
- static_assert(bridging::supportsFromJs<OnUiStateChangedType, jsi::String>, "value cannnot be converted to jsi::String");
80
- static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["onUiStateChanged"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
81
- return bridging::toJs(rt, eventValue, jsInvoker);
82
- });
83
- }
84
-
85
- template <typename OnAudioOutputChangedType> void emitOnAudioOutputChanged(OnAudioOutputChangedType value) {
86
- static_assert(bridging::supportsFromJs<OnAudioOutputChangedType, bool>, "value cannnot be converted to bool");
87
- static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["onAudioOutputChanged"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
88
- return bridging::toJs(rt, eventValue, jsInvoker);
89
- });
90
- }
91
-
92
- template <typename OnAvailableSubtitleConfigsChangedType> void emitOnAvailableSubtitleConfigsChanged(OnAvailableSubtitleConfigsChangedType value) {
93
- static_assert(bridging::supportsFromJs<OnAvailableSubtitleConfigsChangedType, jsi::String>, "value cannnot be converted to jsi::String");
94
- static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["onAvailableSubtitleConfigsChanged"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
95
- return bridging::toJs(rt, eventValue, jsInvoker);
96
- });
97
- }
98
-
99
- template <typename OnSubtitlesChangedType> void emitOnSubtitlesChanged(OnSubtitlesChangedType value) {
100
- static_assert(bridging::supportsFromJs<OnSubtitlesChangedType, jsi::String>, "value cannnot be converted to jsi::String");
101
- static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["onSubtitlesChanged"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
102
- return bridging::toJs(rt, eventValue, jsInvoker);
103
- });
104
- }
105
-
106
- private:
107
- class Delegate : public NativeLiveVoiceSdkCxxSpecJSI {
108
- public:
109
- Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
110
- NativeLiveVoiceSdkCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
111
- eventEmitterMap_["onUiStateChanged"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
112
- eventEmitterMap_["onAudioOutputChanged"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
113
- eventEmitterMap_["onAvailableSubtitleConfigsChanged"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
114
- eventEmitterMap_["onSubtitlesChanged"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
115
- }
116
-
117
- void initialize(jsi::Runtime &rt, std::optional<jsi::String> androidServiceConfig) override {
118
- static_assert(
119
- bridging::getParameterCount(&T::initialize) == 2,
120
- "Expected initialize(...) to have 2 parameters");
121
-
122
- return bridging::callFromJs<void>(
123
- rt, &T::initialize, jsInvoker_, instance_, std::move(androidServiceConfig));
124
- }
125
- void joinEvent(jsi::Runtime &rt, jsi::String joinCode, std::optional<jsi::String> password, jsi::String apiKey) override {
126
- static_assert(
127
- bridging::getParameterCount(&T::joinEvent) == 4,
128
- "Expected joinEvent(...) to have 4 parameters");
129
-
130
- return bridging::callFromJs<void>(
131
- rt, &T::joinEvent, jsInvoker_, instance_, std::move(joinCode), std::move(password), std::move(apiKey));
132
- }
133
- void leaveEvent(jsi::Runtime &rt) override {
134
- static_assert(
135
- bridging::getParameterCount(&T::leaveEvent) == 1,
136
- "Expected leaveEvent(...) to have 1 parameters");
137
-
138
- return bridging::callFromJs<void>(
139
- rt, &T::leaveEvent, jsInvoker_, instance_);
140
- }
141
- void reconnect(jsi::Runtime &rt) override {
142
- static_assert(
143
- bridging::getParameterCount(&T::reconnect) == 1,
144
- "Expected reconnect(...) to have 1 parameters");
145
-
146
- return bridging::callFromJs<void>(
147
- rt, &T::reconnect, jsInvoker_, instance_);
148
- }
149
- std::optional<jsi::String> getCurrentClaims(jsi::Runtime &rt) override {
150
- static_assert(
151
- bridging::getParameterCount(&T::getCurrentClaims) == 1,
152
- "Expected getCurrentClaims(...) to have 1 parameters");
153
-
154
- return bridging::callFromJs<std::optional<jsi::String>>(
155
- rt, &T::getCurrentClaims, jsInvoker_, instance_);
156
- }
157
- jsi::String getCurrentUiState(jsi::Runtime &rt) override {
158
- static_assert(
159
- bridging::getParameterCount(&T::getCurrentUiState) == 1,
160
- "Expected getCurrentUiState(...) to have 1 parameters");
161
-
162
- return bridging::callFromJs<jsi::String>(
163
- rt, &T::getCurrentUiState, jsInvoker_, instance_);
164
- }
165
- bool getCurrentAudioState(jsi::Runtime &rt) override {
166
- static_assert(
167
- bridging::getParameterCount(&T::getCurrentAudioState) == 1,
168
- "Expected getCurrentAudioState(...) to have 1 parameters");
169
-
170
- return bridging::callFromJs<bool>(
171
- rt, &T::getCurrentAudioState, jsInvoker_, instance_);
172
- }
173
- jsi::String getCurrentSubtitles(jsi::Runtime &rt) override {
174
- static_assert(
175
- bridging::getParameterCount(&T::getCurrentSubtitles) == 1,
176
- "Expected getCurrentSubtitles(...) to have 1 parameters");
177
-
178
- return bridging::callFromJs<jsi::String>(
179
- rt, &T::getCurrentSubtitles, jsInvoker_, instance_);
180
- }
181
- jsi::String getCurrentAvailableSubtitleConfigs(jsi::Runtime &rt) override {
182
- static_assert(
183
- bridging::getParameterCount(&T::getCurrentAvailableSubtitleConfigs) == 1,
184
- "Expected getCurrentAvailableSubtitleConfigs(...) to have 1 parameters");
185
-
186
- return bridging::callFromJs<jsi::String>(
187
- rt, &T::getCurrentAvailableSubtitleConfigs, jsInvoker_, instance_);
188
- }
189
- void setLiveVoiceUseSpeaker(jsi::Runtime &rt, bool value) override {
190
- static_assert(
191
- bridging::getParameterCount(&T::setLiveVoiceUseSpeaker) == 2,
192
- "Expected setLiveVoiceUseSpeaker(...) to have 2 parameters");
193
-
194
- return bridging::callFromJs<void>(
195
- rt, &T::setLiveVoiceUseSpeaker, jsInvoker_, instance_, std::move(value));
196
- }
197
- void startChannel(jsi::Runtime &rt, double id) override {
198
- static_assert(
199
- bridging::getParameterCount(&T::startChannel) == 2,
200
- "Expected startChannel(...) to have 2 parameters");
201
-
202
- return bridging::callFromJs<void>(
203
- rt, &T::startChannel, jsInvoker_, instance_, std::move(id));
204
- }
205
- void stopChannel(jsi::Runtime &rt) override {
206
- static_assert(
207
- bridging::getParameterCount(&T::stopChannel) == 1,
208
- "Expected stopChannel(...) to have 1 parameters");
209
-
210
- return bridging::callFromJs<void>(
211
- rt, &T::stopChannel, jsInvoker_, instance_);
212
- }
213
- void startSubtitles(jsi::Runtime &rt, double channelId, std::optional<jsi::String> languageCode) override {
214
- static_assert(
215
- bridging::getParameterCount(&T::startSubtitles) == 3,
216
- "Expected startSubtitles(...) to have 3 parameters");
217
-
218
- return bridging::callFromJs<void>(
219
- rt, &T::startSubtitles, jsInvoker_, instance_, std::move(channelId), std::move(languageCode));
220
- }
221
- void stopSubtitles(jsi::Runtime &rt) override {
222
- static_assert(
223
- bridging::getParameterCount(&T::stopSubtitles) == 1,
224
- "Expected stopSubtitles(...) to have 1 parameters");
225
-
226
- return bridging::callFromJs<void>(
227
- rt, &T::stopSubtitles, jsInvoker_, instance_);
228
- }
229
- void openLiveVoiceWebsite(jsi::Runtime &rt) override {
230
- static_assert(
231
- bridging::getParameterCount(&T::openLiveVoiceWebsite) == 1,
232
- "Expected openLiveVoiceWebsite(...) to have 1 parameters");
233
-
234
- return bridging::callFromJs<void>(
235
- rt, &T::openLiveVoiceWebsite, jsInvoker_, instance_);
236
- }
237
- jsi::String channelStatusOffline(jsi::Runtime &rt) override {
238
- static_assert(
239
- bridging::getParameterCount(&T::channelStatusOffline) == 1,
240
- "Expected channelStatusOffline(...) to have 1 parameters");
241
-
242
- return bridging::callFromJs<jsi::String>(
243
- rt, &T::channelStatusOffline, jsInvoker_, instance_);
244
- }
245
- jsi::String noChannels(jsi::Runtime &rt) override {
246
- static_assert(
247
- bridging::getParameterCount(&T::noChannels) == 1,
248
- "Expected noChannels(...) to have 1 parameters");
249
-
250
- return bridging::callFromJs<jsi::String>(
251
- rt, &T::noChannels, jsInvoker_, instance_);
252
- }
253
- jsi::String isAiChannelStatusMessage(jsi::Runtime &rt) override {
254
- static_assert(
255
- bridging::getParameterCount(&T::isAiChannelStatusMessage) == 1,
256
- "Expected isAiChannelStatusMessage(...) to have 1 parameters");
257
-
258
- return bridging::callFromJs<jsi::String>(
259
- rt, &T::isAiChannelStatusMessage, jsInvoker_, instance_);
260
- }
261
- jsi::String sdkNoMatchingChannels(jsi::Runtime &rt) override {
262
- static_assert(
263
- bridging::getParameterCount(&T::sdkNoMatchingChannels) == 1,
264
- "Expected sdkNoMatchingChannels(...) to have 1 parameters");
265
-
266
- return bridging::callFromJs<jsi::String>(
267
- rt, &T::sdkNoMatchingChannels, jsInvoker_, instance_);
268
- }
269
- jsi::String errorScreenRetrying(jsi::Runtime &rt) override {
270
- static_assert(
271
- bridging::getParameterCount(&T::errorScreenRetrying) == 1,
272
- "Expected errorScreenRetrying(...) to have 1 parameters");
273
-
274
- return bridging::callFromJs<jsi::String>(
275
- rt, &T::errorScreenRetrying, jsInvoker_, instance_);
276
- }
277
- jsi::String errorScreenRetryingIn(jsi::Runtime &rt, double seconds) override {
278
- static_assert(
279
- bridging::getParameterCount(&T::errorScreenRetryingIn) == 2,
280
- "Expected errorScreenRetryingIn(...) to have 2 parameters");
281
-
282
- return bridging::callFromJs<jsi::String>(
283
- rt, &T::errorScreenRetryingIn, jsInvoker_, instance_, std::move(seconds));
284
- }
285
- jsi::String sdkErrorGeneric(jsi::Runtime &rt) override {
286
- static_assert(
287
- bridging::getParameterCount(&T::sdkErrorGeneric) == 1,
288
- "Expected sdkErrorGeneric(...) to have 1 parameters");
289
-
290
- return bridging::callFromJs<jsi::String>(
291
- rt, &T::sdkErrorGeneric, jsInvoker_, instance_);
292
- }
293
- jsi::String sdkErrorInactive(jsi::Runtime &rt) override {
294
- static_assert(
295
- bridging::getParameterCount(&T::sdkErrorInactive) == 1,
296
- "Expected sdkErrorInactive(...) to have 1 parameters");
297
-
298
- return bridging::callFromJs<jsi::String>(
299
- rt, &T::sdkErrorInactive, jsInvoker_, instance_);
300
- }
301
- jsi::String sdkErrorInvalidApiKey(jsi::Runtime &rt) override {
302
- static_assert(
303
- bridging::getParameterCount(&T::sdkErrorInvalidApiKey) == 1,
304
- "Expected sdkErrorInvalidApiKey(...) to have 1 parameters");
305
-
306
- return bridging::callFromJs<jsi::String>(
307
- rt, &T::sdkErrorInvalidApiKey, jsInvoker_, instance_);
308
- }
309
- jsi::String sdkErrorListenerLimitReached(jsi::Runtime &rt) override {
310
- static_assert(
311
- bridging::getParameterCount(&T::sdkErrorListenerLimitReached) == 1,
312
- "Expected sdkErrorListenerLimitReached(...) to have 1 parameters");
313
-
314
- return bridging::callFromJs<jsi::String>(
315
- rt, &T::sdkErrorListenerLimitReached, jsInvoker_, instance_);
316
- }
317
- jsi::String sdkErrorNoNetwork(jsi::Runtime &rt) override {
318
- static_assert(
319
- bridging::getParameterCount(&T::sdkErrorNoNetwork) == 1,
320
- "Expected sdkErrorNoNetwork(...) to have 1 parameters");
321
-
322
- return bridging::callFromJs<jsi::String>(
323
- rt, &T::sdkErrorNoNetwork, jsInvoker_, instance_);
324
- }
325
- jsi::String sdkErrorNotFound(jsi::Runtime &rt) override {
326
- static_assert(
327
- bridging::getParameterCount(&T::sdkErrorNotFound) == 1,
328
- "Expected sdkErrorNotFound(...) to have 1 parameters");
329
-
330
- return bridging::callFromJs<jsi::String>(
331
- rt, &T::sdkErrorNotFound, jsInvoker_, instance_);
332
- }
333
- jsi::String sdkErrorRequestFailed(jsi::Runtime &rt, double errorCode) override {
334
- static_assert(
335
- bridging::getParameterCount(&T::sdkErrorRequestFailed) == 2,
336
- "Expected sdkErrorRequestFailed(...) to have 2 parameters");
337
-
338
- return bridging::callFromJs<jsi::String>(
339
- rt, &T::sdkErrorRequestFailed, jsInvoker_, instance_, std::move(errorCode));
340
- }
341
- jsi::String sdkErrorWrongPassword(jsi::Runtime &rt) override {
342
- static_assert(
343
- bridging::getParameterCount(&T::sdkErrorWrongPassword) == 1,
344
- "Expected sdkErrorWrongPassword(...) to have 1 parameters");
345
-
346
- return bridging::callFromJs<jsi::String>(
347
- rt, &T::sdkErrorWrongPassword, jsInvoker_, instance_);
348
- }
349
- jsi::String streamingByTitle(jsi::Runtime &rt) override {
350
- static_assert(
351
- bridging::getParameterCount(&T::streamingByTitle) == 1,
352
- "Expected streamingByTitle(...) to have 1 parameters");
353
-
354
- return bridging::callFromJs<jsi::String>(
355
- rt, &T::streamingByTitle, jsInvoker_, instance_);
356
- }
357
- jsi::String errorRetryNowButton(jsi::Runtime &rt) override {
358
- static_assert(
359
- bridging::getParameterCount(&T::errorRetryNowButton) == 1,
360
- "Expected errorRetryNowButton(...) to have 1 parameters");
361
-
362
- return bridging::callFromJs<jsi::String>(
363
- rt, &T::errorRetryNowButton, jsInvoker_, instance_);
364
- }
365
- jsi::String accessibilityChannelPlay(jsi::Runtime &rt) override {
366
- static_assert(
367
- bridging::getParameterCount(&T::accessibilityChannelPlay) == 1,
368
- "Expected accessibilityChannelPlay(...) to have 1 parameters");
369
-
370
- return bridging::callFromJs<jsi::String>(
371
- rt, &T::accessibilityChannelPlay, jsInvoker_, instance_);
372
- }
373
- jsi::String accessibilityChannelStatusMuted(jsi::Runtime &rt) override {
374
- static_assert(
375
- bridging::getParameterCount(&T::accessibilityChannelStatusMuted) == 1,
376
- "Expected accessibilityChannelStatusMuted(...) to have 1 parameters");
377
-
378
- return bridging::callFromJs<jsi::String>(
379
- rt, &T::accessibilityChannelStatusMuted, jsInvoker_, instance_);
380
- }
381
- jsi::String accessibilityChannelStop(jsi::Runtime &rt) override {
382
- static_assert(
383
- bridging::getParameterCount(&T::accessibilityChannelStop) == 1,
384
- "Expected accessibilityChannelStop(...) to have 1 parameters");
385
-
386
- return bridging::callFromJs<jsi::String>(
387
- rt, &T::accessibilityChannelStop, jsInvoker_, instance_);
388
- }
389
-
390
- private:
391
- friend class NativeLiveVoiceSdkCxxSpec;
392
- T *instance_;
393
- };
394
-
395
- Delegate delegate_;
396
- };
397
-
398
- } // namespace facebook::react
@@ -1,3 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="io.livevoice.react">
3
- </manifest>
@@ -1,54 +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.LiveVoicePlayingState
17
- import io.livevoice.sdk.android.publicApi.core.model.SdkRetryState
18
- import io.livevoice.sdk.android.publicApi.core.model.SdkUiState
19
-
20
- fun SdkUiState.mapToTransferable(): NativeUiState = when (this) {
21
- SdkUiState.Loading -> NativeLoading
22
- is SdkUiState.Ready -> NativeReady(
23
- channels = channels.map {
24
- NativeChannel(
25
- id = it.id,
26
- name = it.name,
27
- isOnline = it.isOnline,
28
- isAudioMuted = it.isAudioMuted,
29
- isAiSpeaker = it.isAiSpeaker,
30
- playingState = it.playingState.mapToNative()
31
- )
32
- },
33
- )
34
-
35
- is SdkUiState.Error -> NativeError(
36
- message = message,
37
- canBeRetried = onRetry != null
38
- )
39
-
40
- is SdkUiState.Reconnecting -> {
41
- val retryState = when (val state = this.retryState) {
42
- is SdkRetryState.AwaitingNextReconnectAttempt -> NativeRetryState.AwaitRetry(state.retryTimestampSeconds)
43
- SdkRetryState.RetryInProgress -> NativeRetryState.InProgress
44
- }
45
-
46
- NativeReconnecting(state = retryState)
47
- }
48
- }
49
-
50
- private fun LiveVoicePlayingState.mapToNative() = when (this) {
51
- LiveVoicePlayingState.STOPPED -> NativePlayingState.STOPPED
52
- LiveVoicePlayingState.PLAYING -> NativePlayingState.PLAYING
53
- LiveVoicePlayingState.CONNECTING, LiveVoicePlayingState.STOPPING -> NativePlayingState.TRANSITIONING
54
- }
@@ -1,77 +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
- )
30
-
31
- @Serializable
32
- data class NativeClaims(
33
- val hideBranding: Boolean,
34
- val allowCustomUi: Boolean,
35
- )
36
-
37
- @Serializable
38
- @SerialName("playingState")
39
- enum class NativePlayingState {
40
- STOPPED, TRANSITIONING, PLAYING;
41
- }
42
-
43
- @Serializable
44
- @SerialName("ready")
45
- data class NativeReady(
46
- val channels: List<NativeChannel>,
47
- ) : NativeUiState
48
-
49
- @Serializable
50
- @SerialName("nativeUiState")
51
- sealed interface NativeUiState
52
-
53
- @Serializable
54
- @SerialName("loading")
55
- data object NativeLoading : NativeUiState
56
-
57
- @Serializable
58
- @SerialName("error")
59
- data class NativeError(
60
- val message: String,
61
- val canBeRetried: Boolean,
62
- ) : NativeUiState
63
-
64
- @Serializable
65
- @SerialName("reconnecting")
66
- data class NativeReconnecting(val state: NativeRetryState) : NativeUiState
67
-
68
- @Serializable
69
- sealed interface NativeRetryState {
70
- @Serializable
71
- @SerialName("inProgress")
72
- data object InProgress : NativeRetryState
73
-
74
- @Serializable
75
- @SerialName("awaitingRetry")
76
- data class AwaitRetry(val atTimestamp: Long) : NativeRetryState
77
- }