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,179 +1,374 @@
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 { COLORS } from '../util/Colors';
13
- import { ActivityIndicator, Image, TouchableOpacity, useColorScheme } from 'react-native'
14
- import { PlayingState } from '../util/PlayingState';
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 { COLORS } from "../util/Colors";
15
+ import {
16
+ ActivityIndicator,
17
+ Image,
18
+ TouchableOpacity,
19
+ useColorScheme,
20
+ View,
21
+ } from "react-native";
22
+ import { PlayingState } from "../util/PlayingState";
15
23
 
16
24
  export interface PlayButtonProps {
17
25
  playingState: PlayingState;
18
26
  isChannelOnline: boolean;
27
+ hasAudio?: boolean;
28
+ hasSubtitles?: boolean;
19
29
  isDarkMode?: boolean;
20
- onPress: () => void;
30
+ onAudioPress?: () => void;
31
+ onSubtitlesPress?: () => void;
32
+ onPress?: () => void;
21
33
  }
22
34
 
23
35
  const PlayButtonView: React.FC<PlayButtonProps> = ({
24
36
  playingState,
25
37
  isChannelOnline,
26
- isDarkMode = useColorScheme() === 'dark',
38
+ hasAudio = true,
39
+ hasSubtitles = false,
40
+ isDarkMode = useColorScheme() === "dark",
41
+ onAudioPress,
42
+ onSubtitlesPress,
27
43
  onPress,
28
-
29
44
  }) => {
30
45
  const isPlaying = playingState === PlayingState.PLAYING;
31
46
  const isTransitioning = playingState === PlayingState.TRANSITIONING;
32
47
 
33
- const iconColor = !isChannelOnline
34
- ? (isDarkMode ? '#585858' : '#dee2e6')
35
- : isPlaying
36
- ? COLORS.primary
37
- : COLORS.white;
48
+ const getAudioIconColor = () => {
49
+ if (!isChannelOnline) {
50
+ return isDarkMode ? "#5a5a60" : "#d1d1d6";
51
+ }
52
+ return COLORS.white;
53
+ };
54
+
55
+ const getSubtitlesIconColor = () => {
56
+ if (!isChannelOnline) {
57
+ return isDarkMode ? "#ffffff" : "#000000";
58
+ }
59
+ return COLORS.white;
60
+ };
38
61
 
39
- const opacity = isChannelOnline ? 1 : 0.8;
62
+ const audioIconColor = getAudioIconColor();
63
+ const subtitlesIconColor = getSubtitlesIconColor();
40
64
 
41
- const getButtonIcon = () => {
65
+ const getAudioIcon = () => {
42
66
  if (isTransitioning) {
43
- return <ActivityIndicator size={20} color={iconColor} style={{ opacity }} />;
67
+ return <ActivityIndicator size={20} color={audioIconColor} style={{}} />;
44
68
  }
45
69
  return isPlaying ? (
46
70
  <Image
47
- source={require('../icons/pause.png')}
48
- style={[{tintColor: iconColor, width: 20, height: 20}]}
49
- />) : (
71
+ source={require("../icons/pause.png")}
72
+ style={[{ tintColor: audioIconColor, width: 30, height: 26 }]}
73
+ />
74
+ ) : (
50
75
  <Image
51
- source={require('../icons/play.png')}
52
- style={[{tintColor: iconColor, width: 20, height: 20}]}
76
+ source={require("../icons/play.png")}
77
+ style={[{ tintColor: audioIconColor, width: 30, height: 26 }]}
78
+ />
79
+ );
80
+ };
81
+
82
+ const getSubtitlesIcon = () => {
83
+ return (
84
+ <Image
85
+ source={require("../icons/captions.png")}
86
+ style={[{ tintColor: subtitlesIconColor, width: 30, height: 26 }]}
53
87
  />
54
88
  );
55
89
  };
56
90
 
57
91
  const getStyleType = () => {
58
- if (!isChannelOnline) return 'offline';
59
- if (isPlaying) return 'playing';
60
- return 'paused';
92
+ if (!isChannelOnline) return "offline";
93
+ if (isPlaying) return "playing";
94
+ return "paused";
61
95
  };
62
96
 
97
+ // If no audio and no subtitles, render disabled button with dashed border
98
+ if (!hasAudio && !hasSubtitles) {
99
+ const noContentStyle = {
100
+ ...baseButtonStyleNoContent,
101
+ backgroundColor: isDarkMode ? "#1c1c1e00" : "#ffffff",
102
+ borderColor: isDarkMode
103
+ ? COLORS_SCHEME.borderGrayDark
104
+ : COLORS_SCHEME.borderGrayLight,
105
+ borderStyle: "dashed" as const,
106
+ };
107
+ return (
108
+ <TouchableOpacity
109
+ style={noContentStyle}
110
+ disabled={true}
111
+ activeOpacity={0.8}
112
+ >
113
+ <View />
114
+ </TouchableOpacity>
115
+ );
116
+ }
117
+
118
+ // If only audio, render simple button
119
+ if (hasAudio && !hasSubtitles) {
120
+ return (
121
+ <TouchableOpacity
122
+ style={getButtonStyle(getStyleType(), isDarkMode, false)}
123
+ onPress={onAudioPress || onPress}
124
+ activeOpacity={0.8}
125
+ >
126
+ {getAudioIcon()}
127
+ </TouchableOpacity>
128
+ );
129
+ }
130
+
131
+ // If only subtitles, render subtitles button
132
+ if (!hasAudio && hasSubtitles) {
133
+ return (
134
+ <TouchableOpacity
135
+ style={getButtonStyle(getStyleType(), isDarkMode, false)}
136
+ onPress={onSubtitlesPress || onPress}
137
+ activeOpacity={0.8}
138
+ >
139
+ {getSubtitlesIcon()}
140
+ </TouchableOpacity>
141
+ );
142
+ }
143
+
144
+ // If both audio and subtitles, render split button
63
145
  return (
64
- <TouchableOpacity
65
- style={[getButtonStyle(getStyleType(), isDarkMode), { opacity }]}
66
- onPress={onPress}
67
- activeOpacity={0.8}
68
- >
69
- {getButtonIcon()}
70
- </TouchableOpacity>
146
+ <View style={getSplitButtonContainerStyle(getStyleType(), isDarkMode)}>
147
+ <TouchableOpacity
148
+ style={getSplitButtonAudioStyle(getStyleType(), isDarkMode)}
149
+ onPress={onAudioPress || onPress}
150
+ activeOpacity={0.8}
151
+ >
152
+ {getAudioIcon()}
153
+ </TouchableOpacity>
154
+ <View style={getDividerStyle(getStyleType(), isDarkMode)} />
155
+ <TouchableOpacity
156
+ style={getSplitButtonSubtitlesStyle(getStyleType(), isDarkMode)}
157
+ onPress={onSubtitlesPress || onPress}
158
+ activeOpacity={0.8}
159
+ >
160
+ {getSubtitlesIcon()}
161
+ </TouchableOpacity>
162
+ </View>
71
163
  );
72
164
  };
73
165
 
74
- type ButtonStyleType = 'paused' | 'playing' | 'offline';
166
+ type ButtonStyleType = "paused" | "playing" | "offline";
75
167
 
76
168
  export const getButtonStyle = (
77
169
  type: ButtonStyleType,
78
- isDarkMode: boolean
170
+ isDarkMode: boolean,
171
+ isSplit: boolean = false,
79
172
  ) => {
80
- return ButtonStyles[type][isDarkMode ? 'dark' : 'light'];
173
+ if (isSplit) {
174
+ return SplitButtonStyles[type][isDarkMode ? "dark" : "light"].container;
175
+ }
176
+ return ButtonStyles[type][isDarkMode ? "dark" : "light"];
81
177
  };
82
178
 
83
- const baseButtonStyle = {
84
- paddingVertical: 8,
85
- paddingHorizontal: 18,
86
- borderRadius: 10,
87
- borderWidth: 2,
88
- outlineStyle: 'solid' as const,
89
- outlineWidth: 3,
179
+ export const getSplitButtonContainerStyle = (
180
+ type: ButtonStyleType,
181
+ isDarkMode: boolean,
182
+ ) => {
183
+ return SplitButtonStyles[type][isDarkMode ? "dark" : "light"].container;
90
184
  };
91
185
 
92
- const ButtonColorLight = {
93
- orange: '#f56230',
94
- orange_light: '#f67b51',
95
- orange_dark: '#b93305',
186
+ export const getSplitButtonAudioStyle = (
187
+ type: ButtonStyleType,
188
+ isDarkMode: boolean,
189
+ ) => {
190
+ return SplitButtonStyles[type][isDarkMode ? "dark" : "light"].audio;
191
+ };
96
192
 
97
- errorBackground: '#f1f1f1',
193
+ export const getSplitButtonSubtitlesStyle = (
194
+ type: ButtonStyleType,
195
+ isDarkMode: boolean,
196
+ ) => {
197
+ return SplitButtonStyles[type][isDarkMode ? "dark" : "light"].subtitles;
198
+ };
98
199
 
99
- playButtonBorderThinOffline: '#d1d1d6',
100
- playButtonBorderThickOffline: '#f2f2f7',
101
- playButtonIconOffline: '#dee2e6',
200
+ export const getDividerStyle = (type: ButtonStyleType, isDarkMode: boolean) => {
201
+ // When button is online (orange background), divider is light orange
202
+ if (type === "paused" || type === "playing") {
203
+ return {
204
+ width: 1,
205
+ height: 24,
206
+ backgroundColor: COLORS_SCHEME.dividerOnOrange,
207
+ };
208
+ }
102
209
 
103
- playButtonBorderThickOnline: '#f5623021',
104
- playButtonIconOnline: '#ffffff',
105
- playButtonFillOnline: '#f56230',
210
+ // When button is offline, divider is gray (same as border)
211
+ return {
212
+ width: 1,
213
+ height: 24,
214
+ backgroundColor: isDarkMode
215
+ ? COLORS_SCHEME.borderGrayDark
216
+ : COLORS_SCHEME.borderGrayLight,
217
+ };
218
+ };
106
219
 
107
- playButtonGlowPlaying: '#f56230b3',
108
- playButtonBorderThickPlaying: '#f56230',
109
- playButtonIconPlaying: '#f56230',
110
- playButtonFillPlaying: '#ffffff',
220
+ const baseButtonStyle = {
221
+ width: 96,
222
+ height: 44,
223
+ borderRadius: 22,
224
+ borderWidth: 1,
225
+ alignItems: "center" as const,
226
+ justifyContent: "center" as const,
111
227
  };
112
228
 
113
- const ButtonColorDark = {
114
- orange: '#f56230',
115
- orange_light: '#f67b51',
116
- orange_dark: '#b93305',
229
+ const baseButtonStyleNoContent = {
230
+ width: 96,
231
+ height: 44,
232
+ borderRadius: 22,
233
+ borderWidth: 1,
234
+ alignItems: "center" as const,
235
+ justifyContent: "center" as const,
236
+ };
117
237
 
118
- errorBackground: '#111111',
238
+ const baseSplitButtonStyle = {
239
+ width: 96,
240
+ height: 44,
241
+ borderRadius: 22,
242
+ borderWidth: 1,
243
+ flexDirection: "row" as const,
244
+ alignItems: "center" as const,
245
+ justifyContent: "center" as const,
246
+ overflow: "hidden" as const,
247
+ };
119
248
 
120
- playButtonBorderThinOffline: '#212121',
121
- playButtonBorderThickOffline: '#585858',
122
- playButtonIconOffline: '#585858',
249
+ const baseSplitAudioStyle = {
250
+ flex: 1,
251
+ height: 44,
252
+ alignItems: "center" as const,
253
+ justifyContent: "center" as const,
254
+ };
123
255
 
124
- playButtonBorderThickOnline: '#77392421',
125
- playButtonIconOnline: '#ffffff',
126
- playButtonFillOnline: '#f56230',
256
+ const baseSplitSubtitlesStyle = {
257
+ flex: 1,
258
+ height: 44,
259
+ alignItems: "center" as const,
260
+ justifyContent: "center" as const,
261
+ };
127
262
 
128
- playButtonGlowPlaying: '#f56230',
129
- playButtonBorderThickPlaying: '#ff7433',
130
- playButtonIconPlaying: '#f56230',
131
- playButtonFillPlaying: '#ffffff',
263
+ const COLORS_SCHEME = {
264
+ orange: "#f56230",
265
+ dividerOnOrange: "#ffffff80",
266
+ borderGrayLight: "#d1d1d6",
267
+ borderGrayDark: "#5a5a60",
132
268
  };
133
269
 
134
270
  export const ButtonStyles = {
135
271
  paused: {
136
272
  light: {
137
273
  ...baseButtonStyle,
138
- backgroundColor: ButtonColorLight.playButtonFillOnline,
139
- borderColor: 'transparent',
140
- outlineColor: ButtonColorLight.playButtonBorderThickOnline,
274
+ backgroundColor: COLORS_SCHEME.orange,
275
+ borderColor: "transparent",
141
276
  },
142
277
  dark: {
143
278
  ...baseButtonStyle,
144
- backgroundColor: ButtonColorDark.playButtonFillOnline,
145
- borderColor: 'transparent',
146
- outlineColor: ButtonColorDark.playButtonBorderThickOnline,
279
+ backgroundColor: COLORS_SCHEME.orange,
280
+ borderColor: "transparent",
147
281
  },
148
282
  },
149
283
 
150
284
  playing: {
151
285
  light: {
152
286
  ...baseButtonStyle,
153
- backgroundColor: ButtonColorLight.playButtonFillPlaying,
154
- borderColor: ButtonColorLight.playButtonFillPlaying,
155
- outlineColor: ButtonColorLight.playButtonBorderThickPlaying,
287
+ backgroundColor: COLORS_SCHEME.orange,
288
+ borderColor: "transparent",
156
289
  },
157
290
  dark: {
158
291
  ...baseButtonStyle,
159
- backgroundColor: ButtonColorDark.playButtonFillPlaying,
160
- borderColor: ButtonColorDark.playButtonFillPlaying,
161
- outlineColor: ButtonColorDark.playButtonBorderThickPlaying,
292
+ backgroundColor: COLORS_SCHEME.orange,
293
+ borderColor: "transparent",
162
294
  },
163
295
  },
164
296
 
165
297
  offline: {
166
298
  light: {
167
299
  ...baseButtonStyle,
168
- backgroundColor: 'transparent',
169
- borderColor: ButtonColorLight.playButtonBorderThinOffline,
170
- outlineColor: ButtonColorLight.playButtonBorderThickOffline,
300
+ backgroundColor: "#ffffff",
301
+ borderColor: COLORS_SCHEME.borderGrayLight,
171
302
  },
172
303
  dark: {
173
304
  ...baseButtonStyle,
174
- backgroundColor: 'transparent',
175
- borderColor: ButtonColorDark.playButtonBorderThinOffline,
176
- outlineColor: ButtonColorDark.playButtonBorderThickOffline,
305
+ backgroundColor: "#212429",
306
+ borderColor: COLORS_SCHEME.borderGrayDark,
307
+ },
308
+ },
309
+ };
310
+
311
+ export const SplitButtonStyles = {
312
+ paused: {
313
+ light: {
314
+ container: {
315
+ ...baseSplitButtonStyle,
316
+ backgroundColor: COLORS_SCHEME.orange,
317
+ borderColor: "transparent",
318
+ },
319
+ audio: baseSplitAudioStyle,
320
+ subtitles: baseSplitSubtitlesStyle,
321
+ },
322
+ dark: {
323
+ container: {
324
+ ...baseSplitButtonStyle,
325
+ backgroundColor: COLORS_SCHEME.orange,
326
+ borderColor: "transparent",
327
+ },
328
+ audio: baseSplitAudioStyle,
329
+ subtitles: baseSplitSubtitlesStyle,
330
+ },
331
+ },
332
+
333
+ playing: {
334
+ light: {
335
+ container: {
336
+ ...baseSplitButtonStyle,
337
+ backgroundColor: COLORS_SCHEME.orange,
338
+ borderColor: "transparent",
339
+ },
340
+ audio: baseSplitAudioStyle,
341
+ subtitles: baseSplitSubtitlesStyle,
342
+ },
343
+ dark: {
344
+ container: {
345
+ ...baseSplitButtonStyle,
346
+ backgroundColor: COLORS_SCHEME.orange,
347
+ borderColor: "transparent",
348
+ },
349
+ audio: baseSplitAudioStyle,
350
+ subtitles: baseSplitSubtitlesStyle,
351
+ },
352
+ },
353
+
354
+ offline: {
355
+ light: {
356
+ container: {
357
+ ...baseSplitButtonStyle,
358
+ backgroundColor: "#ffffff",
359
+ borderColor: COLORS_SCHEME.borderGrayLight,
360
+ },
361
+ audio: baseSplitAudioStyle,
362
+ subtitles: baseSplitSubtitlesStyle,
363
+ },
364
+ dark: {
365
+ container: {
366
+ ...baseSplitButtonStyle,
367
+ backgroundColor: "#212429",
368
+ borderColor: COLORS_SCHEME.borderGrayDark,
369
+ },
370
+ audio: baseSplitAudioStyle,
371
+ subtitles: baseSplitSubtitlesStyle,
177
372
  },
178
373
  },
179
374
  };
@@ -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 React, { useEffect } from 'react';
13
15
  import { View, Text, useColorScheme, StyleSheet, TouchableOpacity, ActivityIndicator } from 'react-native';
@@ -32,12 +34,10 @@ export const ReconnectingView: React.FC<ReconnectingProps> = (props) => {
32
34
  //updated the countdown every second!
33
35
  useEffect(() => {
34
36
  const newValue = calculateSecondsUntilRetry(reconnectingState)
35
- console.log('Updated seconds' + newValue)
36
37
  setSecUntilRetry(newValue);
37
38
 
38
39
  const interval = setInterval(() => {
39
40
  const newValue = calculateSecondsUntilRetry(reconnectingState)
40
- console.log('Updated seconds' + newValue)
41
41
  setSecUntilRetry(newValue);
42
42
  }, 1000);
43
43
 
@@ -92,7 +92,14 @@ export const ReconnectingView: React.FC<ReconnectingProps> = (props) => {
92
92
  };
93
93
 
94
94
  function calculateSecondsUntilRetry(reconnectingState: Reconnecting): number {
95
- return reconnectingState.state.type == 'awaitingRetry' ? Math.max(0, reconnectingState.state.atTimestamp - Date.now() / 1000) : 0
95
+ if (reconnectingState.state.type !== 'awaitingRetry') {
96
+ return 0;
97
+ }
98
+
99
+ return Math.max(
100
+ 0,
101
+ (reconnectingState.state.retryAt.getTime() / 1000) - (Date.now() / 1000),
102
+ );
96
103
  }
97
104
 
98
105
  const styles = StyleSheet.create({
@@ -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 React from 'react';
13
15
  import { View, Text, useColorScheme, StyleSheet } from 'react-native';
@@ -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 * from './AudioOutputSwitchView';
13
15
  export * from './BrandingView';
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file