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
@@ -0,0 +1,89 @@
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
+ // Internal state accessors used by LiveVoiceView. These are intentionally NOT re-exported from
15
+ // the package entry point (`src/index.tsx`); the public, app-facing way to consume state is the
16
+ // `renderChannel` prop on `LiveVoiceView`. The deprecated public wrappers in `LiveVoiceSdk.ts`
17
+ // delegate here, which keeps the SDK's own usage free of deprecation warnings.
18
+
19
+ import LiveVoiceSdkReactNative from '../specs/NativeLiveVoiceSdk';
20
+ import { type UiState, type Channel } from '../util/UIState';
21
+ import { logUiState } from '../util/logger';
22
+
23
+ /** Authorization features for the joined event. Internal: the view uses it for branding/gating. */
24
+ export type Claims = { hideBranding: boolean; customUiAllowed: boolean };
25
+
26
+ type UiStateWire = {
27
+ type: 'loading';
28
+ } | {
29
+ type: 'ready';
30
+ channels: Channel[];
31
+ isHeadphonesOnly: boolean;
32
+ outputMode: string;
33
+ } | {
34
+ type: 'error';
35
+ message: string;
36
+ canBeRetried: boolean;
37
+ } | {
38
+ type: 'reconnecting';
39
+ state:
40
+ | { type: 'inProgress' }
41
+ | { type: 'awaitingRetry'; atTimestamp: number };
42
+ };
43
+
44
+ export function getCurrentClaims(): Claims | null {
45
+ const claims = LiveVoiceSdkReactNative.getCurrentClaims();
46
+ if (claims == null) return null;
47
+ return JSON.parse(claims);
48
+ }
49
+
50
+ export function getCurrentUiState(): UiState {
51
+ return parseUiState(LiveVoiceSdkReactNative.getCurrentUiState());
52
+ }
53
+
54
+ export function onUiStateChanged(handler: (arg: UiState) => void): {
55
+ remove: () => void;
56
+ } {
57
+ return LiveVoiceSdkReactNative.onUiStateChanged((data: string) => {
58
+ const state = parseUiState(data);
59
+ logUiState(state);
60
+ handler(state);
61
+ });
62
+ }
63
+
64
+ function parseUiState(data: string): UiState {
65
+ return hydrateUiState(JSON.parse(data) as UiStateWire);
66
+ }
67
+
68
+ function hydrateUiState(state: UiStateWire): UiState {
69
+ if (state.type === 'ready') {
70
+ const { isHeadphonesOnly: _ignored, ...publicState } = state;
71
+ return publicState;
72
+ }
73
+
74
+ if (state.type !== 'reconnecting') {
75
+ return state as UiState;
76
+ }
77
+
78
+ if (state.state.type !== 'awaitingRetry') {
79
+ return state as UiState;
80
+ }
81
+
82
+ return {
83
+ ...state,
84
+ state: {
85
+ ...state.state,
86
+ retryAt: new Date(state.state.atTimestamp * 1000),
87
+ },
88
+ };
89
+ }
@@ -1,17 +1,21 @@
1
- /*
2
- * This source file is part of the LiveVoice SDK project
3
- *
4
- * Copyright (c) LiveVoice GmbH
5
- * Licensed under the MIT license
6
- *
7
- * See LICENSE for license information
8
- *
9
- * SPDX-License-Identifier: MIT
10
- */
11
-
12
- import { type TurboModule } from 'react-native';
13
- import { TurboModuleRegistry } from 'react-native';
14
- import { type EventEmitter } from 'react-native/Libraries/Types/CodegenTypes';
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
+ import { TurboModuleRegistry, type TurboModule, type CodegenTypes } from 'react-native';
15
+
16
+ // Type alias is required for backwards compatibility with RN < 0.80 codegen parsers
17
+ // which statically look for the exact identifier name 'EventEmitter'
18
+ type EventEmitter<T> = CodegenTypes.EventEmitter<T>;
15
19
 
16
20
  export interface Spec extends TurboModule {
17
21
  initialize(androidServiceConfig: string | null): void
@@ -25,6 +29,7 @@ export interface Spec extends TurboModule {
25
29
  getCurrentUiState(): string;
26
30
  getCurrentAudioState(): boolean; //true=speaker, false=headphones
27
31
  getCurrentSubtitles(): string;
32
+ getCurrentSubtitleState(): string;
28
33
  getCurrentAvailableSubtitleConfigs(): string;
29
34
 
30
35
  // applicable for 'ready' state
@@ -36,17 +41,20 @@ export interface Spec extends TurboModule {
36
41
  /**
37
42
  * @param channelId: -1 denotes an unspecified channel (i.e: the currently playing one)
38
43
  */
39
- startSubtitles(channelId: number, languageCode: string | null): void
44
+ startSubtitles(channelId: number): void
40
45
  stopSubtitles(): void
41
46
 
42
47
  openLiveVoiceWebsite(): void
43
48
 
49
+ getSdkVersion(): string
50
+
44
51
  // Events
45
52
 
46
53
  readonly onUiStateChanged: EventEmitter<string>
47
54
  readonly onAudioOutputChanged: EventEmitter<boolean>
48
55
  readonly onAvailableSubtitleConfigsChanged: EventEmitter<string>
49
56
  readonly onSubtitlesChanged: EventEmitter<string>
57
+ readonly onSubtitleStateChanged: EventEmitter<string>
50
58
 
51
59
  // Translations
52
60
 
@@ -74,4 +82,4 @@ export interface Spec extends TurboModule {
74
82
  accessibilityChannelStop(): string
75
83
  }
76
84
 
77
- export default TurboModuleRegistry.getEnforcing<Spec>('LiveVoiceModule');
85
+ export default TurboModuleRegistry.getEnforcing<Spec>('LiveVoiceModule');
@@ -1,17 +1,18 @@
1
- /*
2
- * This source file is part of the LiveVoice SDK project
3
- *
4
- * Copyright (c) LiveVoice GmbH
5
- * Licensed under the MIT license
6
- *
7
- * See LICENSE for license information
8
- *
9
- * SPDX-License-Identifier: MIT
10
- */
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
+ //===----------------------------------------------------------------------===//
11
13
 
12
14
  export const COLORS = {
13
15
  primary: '#F1521B',
14
- primaryOutline: 'rgba(241, 82, 27, 0.2)',
15
16
 
16
17
  bg: '#F5F5F5',
17
18
  bgDark: '#1E1F23',
@@ -19,6 +20,9 @@ export const COLORS = {
19
20
  cardBg: '#fff',
20
21
  cardBgDark: '#212429',
21
22
 
23
+ divider: '#f0f0f0',
24
+ dividerDark: '#333333',
25
+
22
26
  white: '#fff',
23
27
  black: '#191919',
24
28
  gray: '#808080',
@@ -1,13 +1,15 @@
1
- /*
2
- * This source file is part of the LiveVoice SDK project
3
- *
4
- * Copyright (c) LiveVoice GmbH
5
- * Licensed under the MIT license
6
- *
7
- * See LICENSE for license information
8
- *
9
- * SPDX-License-Identifier: MIT
10
- */
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
+ //===----------------------------------------------------------------------===//
11
13
 
12
14
  // Define the union type and interfaces
13
15
  export type ForegroundServiceConfig = Disabled | Enabled;
@@ -21,10 +23,18 @@ export interface Enabled {
21
23
  message: string | null;
22
24
  }
23
25
 
26
+ /**
27
+ * Sentinel sent to the native module to request the SDK's built-in default notification
28
+ * message. The Android native module recognizes this exact string (see
29
+ * `DEFAULT_MESSAGE_SENTINEL` in `LiveVoiceModule.kt`) and substitutes the real default — the
30
+ * two must stay in sync. iOS ignores the foreground-service config entirely.
31
+ */
32
+ export const DEFAULT_MESSAGE_SENTINEL = 'LV_NOTIFICATION_DEFAULT_MESSAGE';
33
+
24
34
  // Named exports for the constants and function
25
35
  export const serviceDisabled: Disabled = { type: 'Disabled' };
26
36
 
27
- export const serviceEnabledWithDefaultMessage: Enabled = { type: 'Enabled', message: 'LV_NOTIFICATION_DEFAULT_MESSAGE' };
37
+ export const serviceEnabledWithDefaultMessage: Enabled = { type: 'Enabled', message: DEFAULT_MESSAGE_SENTINEL };
28
38
 
29
39
  export const serviceEnabledWithMessage = (message: string | null): Enabled => ({
30
40
  type: 'Enabled',
@@ -1,13 +1,15 @@
1
- /*
2
- * This source file is part of the LiveVoice SDK project
3
- *
4
- * Copyright (c) LiveVoice GmbH
5
- * Licensed under the MIT license
6
- *
7
- * See LICENSE for license information
8
- *
9
- * SPDX-License-Identifier: MIT
10
- */
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
+ //===----------------------------------------------------------------------===//
11
13
 
12
14
  export enum PlayingState {
13
15
  STOPPED = 'STOPPED',
@@ -1,13 +1,15 @@
1
- /*
2
- * This source file is part of the LiveVoice SDK project
3
- *
4
- * Copyright (c) LiveVoice GmbH
5
- * Licensed under the MIT license
6
- *
7
- * See LICENSE for license information
8
- *
9
- * SPDX-License-Identifier: MIT
10
- */
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
+ //===----------------------------------------------------------------------===//
11
13
 
12
14
  /**
13
15
  * @fileoverview Translated strings for the React Native SDK.
@@ -1,13 +1,15 @@
1
- /*
2
- * This source file is part of the LiveVoice SDK project
3
- *
4
- * Copyright (c) LiveVoice GmbH
5
- * Licensed under the MIT license
6
- *
7
- * See LICENSE for license information
8
- *
9
- * SPDX-License-Identifier: MIT
10
- */
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
+ //===----------------------------------------------------------------------===//
11
13
 
12
14
  import { type PlayingState } from './PlayingState';
13
15
 
@@ -19,7 +21,6 @@ export type UiState = Ready | ErrorState | Loading | Reconnecting
19
21
  export interface Ready {
20
22
  type: 'ready';
21
23
  channels: Channel[];
22
- isHeadphonesOnly: boolean;
23
24
  outputMode: string;
24
25
  }
25
26
 
@@ -39,6 +40,10 @@ export interface RetryInProgress {
39
40
 
40
41
  export interface AwaitingRetry {
41
42
  type: 'awaitingRetry';
43
+ retryAt: Date;
44
+ /**
45
+ * @deprecated Use retryAt instead. This is a Unix timestamp in seconds.
46
+ */
42
47
  atTimestamp: number;
43
48
  }
44
49
 
@@ -59,7 +64,43 @@ export interface Channel {
59
64
  id: number;
60
65
  name: string;
61
66
  isOnline: boolean;
67
+ hasAudio: boolean;
68
+ hasSubtitles: boolean;
62
69
  isAudioMuted: boolean;
63
- isAiSpeaker: boolean;
70
+ aiTranslationInfo: AITranslationInfo | null;
71
+ dependentChannels: DependentChannel[];
64
72
  playingState: PlayingState;
65
- }
73
+ }
74
+
75
+ export interface AITranslationInfo {
76
+ sourceID: number;
77
+ targetLanguage: string;
78
+ }
79
+
80
+ export interface DependentChannel {
81
+ id: number;
82
+ name: string;
83
+ sourceChannelID: number;
84
+ language: string;
85
+ hasSubtitles: boolean;
86
+ hasAudio: boolean;
87
+ }
88
+
89
+ export interface AvailableSubtitle {
90
+ id: number;
91
+ name: string;
92
+ language: string | null;
93
+ parent: number | null;
94
+ }
95
+
96
+ /**
97
+ * The current subtitle state.
98
+ *
99
+ * - `disabled`: no subtitles are being received.
100
+ * - `automatic`: subtitles follow the currently playing channel.
101
+ * - `specific`: subtitles for an explicitly chosen channel.
102
+ */
103
+ export type SubtitleState =
104
+ | { type: 'disabled' }
105
+ | { type: 'automatic'; fragments: string[] }
106
+ | { type: 'specific'; channelId: number; fragments: string[] };
@@ -0,0 +1,92 @@
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
+ import { type ForegroundServiceConfig } from "./ForegroundServiceConfig";
15
+ import { type UiState, type RetryState } from "./UIState";
16
+
17
+ type LogFields = Record<string, string | number | boolean | null | undefined>;
18
+
19
+ export const LiveVoiceLogEvent = {
20
+ init: "LV_INIT",
21
+ joinRequest: "LV_JOIN_REQUEST",
22
+ leave: "LV_LEAVE",
23
+ reconnectRequest: "LV_RECONNECT_REQUEST",
24
+ uiState: "LV_UI_STATE",
25
+ audioOutputSet: "LV_AUDIO_OUTPUT_SET",
26
+ audioOutputChanged: "LV_AUDIO_OUTPUT_CHANGED",
27
+ channelStart: "LV_CHANNEL_START",
28
+ channelStop: "LV_CHANNEL_STOP",
29
+ subtitlesStart: "LV_SUBTITLES_START",
30
+ subtitlesStop: "LV_SUBTITLES_STOP",
31
+ openWebsite: "LV_OPEN_WEBSITE",
32
+ } as const;
33
+
34
+ export function logInfo(event: string, fields?: LogFields): void {
35
+ console.info(formatMessage("INFO", event, fields));
36
+ }
37
+
38
+ export function logUiState(state: UiState): void {
39
+ logInfo(LiveVoiceLogEvent.uiState, describeUiState(state));
40
+ }
41
+
42
+ export function logAudioOutputChanged(useSpeaker: boolean): void {
43
+ logInfo(LiveVoiceLogEvent.audioOutputChanged, {
44
+ mode: useSpeaker ? "speaker" : "receiver",
45
+ });
46
+ }
47
+
48
+ export function describeForegroundServiceConfig(
49
+ serviceConfig: ForegroundServiceConfig,
50
+ ): string {
51
+ if (serviceConfig.type === "Disabled") return "disabled";
52
+ return serviceConfig.message == null ? "default" : "custom";
53
+ }
54
+
55
+ function describeUiState(state: UiState): LogFields {
56
+ switch (state.type) {
57
+ case "loading":
58
+ return { type: "loading" };
59
+ case "ready":
60
+ return {
61
+ channelCount: state.channels.length,
62
+ outputMode: state.outputMode,
63
+ type: "ready",
64
+ };
65
+ case "error":
66
+ return {
67
+ canBeRetried: state.canBeRetried,
68
+ type: "error",
69
+ };
70
+ case "reconnecting":
71
+ return {
72
+ retryState: describeRetryState(state.state),
73
+ type: "reconnecting",
74
+ };
75
+ }
76
+ }
77
+
78
+ function describeRetryState(state: RetryState): string {
79
+ return state.type;
80
+ }
81
+
82
+ function formatMessage(level: string, event: string, fields?: LogFields): string {
83
+ const fieldText = fields == null ? "" : Object.entries(fields)
84
+ .filter(([, value]) => value != null)
85
+ .sort(([left], [right]) => left.localeCompare(right))
86
+ .map(([key, value]) => `${key}=${value}`)
87
+ .join(" ");
88
+
89
+ return ["[LiveVoiceSDK]", level, event, fieldText]
90
+ .filter((part) => part.length > 0)
91
+ .join(" ");
92
+ }
@@ -1,186 +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: GenerateModuleJavaSpec.js
9
- *
10
- * @nolint
11
- */
12
-
13
- package io.livevoice.react;
14
-
15
- import com.facebook.proguard.annotations.DoNotStrip;
16
- import com.facebook.react.bridge.ReactApplicationContext;
17
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
18
- import com.facebook.react.bridge.ReactMethod;
19
- import com.facebook.react.turbomodule.core.interfaces.TurboModule;
20
- import javax.annotation.Nonnull;
21
- import javax.annotation.Nullable;
22
-
23
- public abstract class NativeLiveVoiceSdkSpec extends ReactContextBaseJavaModule implements TurboModule {
24
- public static final String NAME = "LiveVoiceModule";
25
-
26
- public NativeLiveVoiceSdkSpec(ReactApplicationContext reactContext) {
27
- super(reactContext);
28
- }
29
-
30
- @Override
31
- public @Nonnull String getName() {
32
- return NAME;
33
- }
34
-
35
- protected final void emitOnUiStateChanged(String value) {
36
- mEventEmitterCallback.invoke("onUiStateChanged", value);
37
- }
38
-
39
- protected final void emitOnAudioOutputChanged(boolean value) {
40
- mEventEmitterCallback.invoke("onAudioOutputChanged", value);
41
- }
42
-
43
- protected final void emitOnAvailableSubtitleConfigsChanged(String value) {
44
- mEventEmitterCallback.invoke("onAvailableSubtitleConfigsChanged", value);
45
- }
46
-
47
- protected final void emitOnSubtitlesChanged(String value) {
48
- mEventEmitterCallback.invoke("onSubtitlesChanged", value);
49
- }
50
-
51
- @ReactMethod
52
- @DoNotStrip
53
- public abstract void initialize(@Nullable String androidServiceConfig);
54
-
55
- @ReactMethod
56
- @DoNotStrip
57
- public abstract void joinEvent(String joinCode, @Nullable String password, String apiKey);
58
-
59
- @ReactMethod
60
- @DoNotStrip
61
- public abstract void leaveEvent();
62
-
63
- @ReactMethod
64
- @DoNotStrip
65
- public abstract void reconnect();
66
-
67
- @ReactMethod(isBlockingSynchronousMethod = true)
68
- @DoNotStrip
69
- public abstract @Nullable String getCurrentClaims();
70
-
71
- @ReactMethod(isBlockingSynchronousMethod = true)
72
- @DoNotStrip
73
- public abstract String getCurrentUiState();
74
-
75
- @ReactMethod(isBlockingSynchronousMethod = true)
76
- @DoNotStrip
77
- public abstract boolean getCurrentAudioState();
78
-
79
- @ReactMethod(isBlockingSynchronousMethod = true)
80
- @DoNotStrip
81
- public abstract String getCurrentSubtitles();
82
-
83
- @ReactMethod(isBlockingSynchronousMethod = true)
84
- @DoNotStrip
85
- public abstract String getCurrentAvailableSubtitleConfigs();
86
-
87
- @ReactMethod
88
- @DoNotStrip
89
- public abstract void setLiveVoiceUseSpeaker(boolean value);
90
-
91
- @ReactMethod
92
- @DoNotStrip
93
- public abstract void startChannel(double id);
94
-
95
- @ReactMethod
96
- @DoNotStrip
97
- public abstract void stopChannel();
98
-
99
- @ReactMethod
100
- @DoNotStrip
101
- public abstract void startSubtitles(double channelId, @Nullable String languageCode);
102
-
103
- @ReactMethod
104
- @DoNotStrip
105
- public abstract void stopSubtitles();
106
-
107
- @ReactMethod
108
- @DoNotStrip
109
- public abstract void openLiveVoiceWebsite();
110
-
111
- @ReactMethod(isBlockingSynchronousMethod = true)
112
- @DoNotStrip
113
- public abstract String channelStatusOffline();
114
-
115
- @ReactMethod(isBlockingSynchronousMethod = true)
116
- @DoNotStrip
117
- public abstract String noChannels();
118
-
119
- @ReactMethod(isBlockingSynchronousMethod = true)
120
- @DoNotStrip
121
- public abstract String isAiChannelStatusMessage();
122
-
123
- @ReactMethod(isBlockingSynchronousMethod = true)
124
- @DoNotStrip
125
- public abstract String sdkNoMatchingChannels();
126
-
127
- @ReactMethod(isBlockingSynchronousMethod = true)
128
- @DoNotStrip
129
- public abstract String errorScreenRetrying();
130
-
131
- @ReactMethod(isBlockingSynchronousMethod = true)
132
- @DoNotStrip
133
- public abstract String errorScreenRetryingIn(double seconds);
134
-
135
- @ReactMethod(isBlockingSynchronousMethod = true)
136
- @DoNotStrip
137
- public abstract String sdkErrorGeneric();
138
-
139
- @ReactMethod(isBlockingSynchronousMethod = true)
140
- @DoNotStrip
141
- public abstract String sdkErrorInactive();
142
-
143
- @ReactMethod(isBlockingSynchronousMethod = true)
144
- @DoNotStrip
145
- public abstract String sdkErrorInvalidApiKey();
146
-
147
- @ReactMethod(isBlockingSynchronousMethod = true)
148
- @DoNotStrip
149
- public abstract String sdkErrorListenerLimitReached();
150
-
151
- @ReactMethod(isBlockingSynchronousMethod = true)
152
- @DoNotStrip
153
- public abstract String sdkErrorNoNetwork();
154
-
155
- @ReactMethod(isBlockingSynchronousMethod = true)
156
- @DoNotStrip
157
- public abstract String sdkErrorNotFound();
158
-
159
- @ReactMethod(isBlockingSynchronousMethod = true)
160
- @DoNotStrip
161
- public abstract String sdkErrorRequestFailed(double errorCode);
162
-
163
- @ReactMethod(isBlockingSynchronousMethod = true)
164
- @DoNotStrip
165
- public abstract String sdkErrorWrongPassword();
166
-
167
- @ReactMethod(isBlockingSynchronousMethod = true)
168
- @DoNotStrip
169
- public abstract String streamingByTitle();
170
-
171
- @ReactMethod(isBlockingSynchronousMethod = true)
172
- @DoNotStrip
173
- public abstract String errorRetryNowButton();
174
-
175
- @ReactMethod(isBlockingSynchronousMethod = true)
176
- @DoNotStrip
177
- public abstract String accessibilityChannelPlay();
178
-
179
- @ReactMethod(isBlockingSynchronousMethod = true)
180
- @DoNotStrip
181
- public abstract String accessibilityChannelStatusMuted();
182
-
183
- @ReactMethod(isBlockingSynchronousMethod = true)
184
- @DoNotStrip
185
- public abstract String accessibilityChannelStop();
186
- }