livevoice-sdk-react-native 2.0.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/README.md +158 -7
  2. package/android/build.gradle +18 -6
  3. package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +121 -221
  4. package/android/src/main/java/io/livevoice/react/__SDK.kt +17 -3
  5. package/ios/LiveVoiceRNBridge.swift +362 -0
  6. package/ios/LiveVoiceSdkReactNative.mm +247 -145
  7. package/ios/__SDK.h +16 -2
  8. package/ios/livevoice_spm_backport.rb +202 -0
  9. package/lib/module/components/BrandingView.js +71 -50
  10. package/lib/module/components/BrandingView.js.map +1 -1
  11. package/lib/module/components/ChannelView.js +368 -54
  12. package/lib/module/components/ChannelView.js.map +1 -1
  13. package/lib/module/components/ErrorView.js +17 -16
  14. package/lib/module/components/ErrorView.js.map +1 -1
  15. package/lib/module/components/LiveVoiceSpinner.js +81 -0
  16. package/lib/module/components/LiveVoiceSpinner.js.map +1 -0
  17. package/lib/module/components/LiveVoiceView.js +351 -104
  18. package/lib/module/components/LiveVoiceView.js.map +1 -1
  19. package/lib/module/components/PasswordPrompt.js +165 -0
  20. package/lib/module/components/PasswordPrompt.js.map +1 -0
  21. package/lib/module/components/PlayButtonView.js +192 -254
  22. package/lib/module/components/PlayButtonView.js.map +1 -1
  23. package/lib/module/components/ReconnectingView.js +43 -62
  24. package/lib/module/components/ReconnectingView.js.map +1 -1
  25. package/lib/module/components/WarningView.js +12 -10
  26. package/lib/module/components/WarningView.js.map +1 -1
  27. package/lib/module/icons/branding-ios.png +0 -0
  28. package/lib/module/icons/camera-off-android.png +0 -0
  29. package/lib/module/icons/camera-off-android@2x.png +0 -0
  30. package/lib/module/icons/camera-off-android@3x.png +0 -0
  31. package/lib/module/icons/cpu-android.png +0 -0
  32. package/lib/module/icons/cpu-android@2x.png +0 -0
  33. package/lib/module/icons/cpu-android@3x.png +0 -0
  34. package/lib/module/icons/cpu-ios.png +0 -0
  35. package/lib/module/icons/cpu-ios@2x.png +0 -0
  36. package/lib/module/icons/cpu-ios@3x.png +0 -0
  37. package/lib/module/icons/lock-android.png +0 -0
  38. package/lib/module/icons/lock-android@2x.png +0 -0
  39. package/lib/module/icons/lock-android@3x.png +0 -0
  40. package/lib/module/icons/lock-ios.png +0 -0
  41. package/lib/module/icons/lock-ios@2x.png +0 -0
  42. package/lib/module/icons/lock-ios@3x.png +0 -0
  43. package/lib/module/icons/mic-off-android.png +0 -0
  44. package/lib/module/icons/mic-off-android@2x.png +0 -0
  45. package/lib/module/icons/mic-off-android@3x.png +0 -0
  46. package/lib/module/icons/mic-slash-ios.png +0 -0
  47. package/lib/module/icons/mic-slash-ios@2x.png +0 -0
  48. package/lib/module/icons/mic-slash-ios@3x.png +0 -0
  49. package/lib/module/icons/video-slash-ios.png +0 -0
  50. package/lib/module/icons/video-slash-ios@2x.png +0 -0
  51. package/lib/module/icons/video-slash-ios@3x.png +0 -0
  52. package/lib/module/index.js +24 -225
  53. package/lib/module/index.js.map +1 -1
  54. package/lib/module/sdk/Bridge.js +236 -0
  55. package/lib/module/sdk/Bridge.js.map +1 -0
  56. package/lib/module/sdk/Event.js +160 -0
  57. package/lib/module/sdk/Event.js.map +1 -0
  58. package/lib/module/sdk/Lifecycle.js +331 -0
  59. package/lib/module/sdk/Lifecycle.js.map +1 -0
  60. package/lib/module/sdk/LiveVoiceSdk.js +365 -0
  61. package/lib/module/sdk/LiveVoiceSdk.js.map +1 -0
  62. package/lib/module/sdk/LiveVoiceState.js +234 -0
  63. package/lib/module/sdk/LiveVoiceState.js.map +1 -0
  64. package/lib/module/sdk/LogEntries.js +99 -0
  65. package/lib/module/sdk/LogEntries.js.map +1 -0
  66. package/lib/module/sdk/Models.js +2 -0
  67. package/lib/module/{util/UIState.js.map → sdk/Models.js.map} +1 -1
  68. package/lib/module/sdk/NativeSdkVersions.js +24 -0
  69. package/lib/module/sdk/NativeSdkVersions.js.map +1 -0
  70. package/lib/module/sdk/Observables.js +391 -0
  71. package/lib/module/sdk/Observables.js.map +1 -0
  72. package/lib/module/sdk/Passwords.js +298 -0
  73. package/lib/module/sdk/Passwords.js.map +1 -0
  74. package/lib/module/sdk/Playback.js +35 -0
  75. package/lib/module/sdk/Playback.js.map +1 -0
  76. package/lib/module/specs/NativeLiveVoiceSdk.js +12 -10
  77. package/lib/module/specs/NativeLiveVoiceSdk.js.map +1 -1
  78. package/lib/module/util/Colors.js +14 -11
  79. package/lib/module/util/Colors.js.map +1 -1
  80. package/lib/module/util/Translations.js +46 -21
  81. package/lib/module/util/Translations.js.map +1 -1
  82. package/lib/module/util/freeze.js +26 -0
  83. package/lib/module/util/freeze.js.map +1 -0
  84. package/lib/module/util/logger.js +114 -0
  85. package/lib/module/util/logger.js.map +1 -0
  86. package/lib/typescript/src/components/BrandingView.d.ts +4 -0
  87. package/lib/typescript/src/components/BrandingView.d.ts.map +1 -1
  88. package/lib/typescript/src/components/ChannelView.d.ts +29 -3
  89. package/lib/typescript/src/components/ChannelView.d.ts.map +1 -1
  90. package/lib/typescript/src/components/ErrorView.d.ts +5 -3
  91. package/lib/typescript/src/components/ErrorView.d.ts.map +1 -1
  92. package/lib/typescript/src/components/LiveVoiceSpinner.d.ts +16 -0
  93. package/lib/typescript/src/components/LiveVoiceSpinner.d.ts.map +1 -0
  94. package/lib/typescript/src/components/LiveVoiceView.d.ts +85 -3
  95. package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -1
  96. package/lib/typescript/src/components/PasswordPrompt.d.ts +13 -0
  97. package/lib/typescript/src/components/PasswordPrompt.d.ts.map +1 -0
  98. package/lib/typescript/src/components/PlayButtonView.d.ts +12 -329
  99. package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -1
  100. package/lib/typescript/src/components/ReconnectingView.d.ts +6 -3
  101. package/lib/typescript/src/components/ReconnectingView.d.ts.map +1 -1
  102. package/lib/typescript/src/components/WarningView.d.ts.map +1 -1
  103. package/lib/typescript/src/index.d.ts +15 -144
  104. package/lib/typescript/src/index.d.ts.map +1 -1
  105. package/lib/typescript/src/sdk/Bridge.d.ts +36 -0
  106. package/lib/typescript/src/sdk/Bridge.d.ts.map +1 -0
  107. package/lib/typescript/src/sdk/Event.d.ts +97 -0
  108. package/lib/typescript/src/sdk/Event.d.ts.map +1 -0
  109. package/lib/typescript/src/sdk/Lifecycle.d.ts +191 -0
  110. package/lib/typescript/src/sdk/Lifecycle.d.ts.map +1 -0
  111. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts +215 -0
  112. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts.map +1 -0
  113. package/lib/typescript/src/sdk/LiveVoiceState.d.ts +80 -0
  114. package/lib/typescript/src/sdk/LiveVoiceState.d.ts.map +1 -0
  115. package/lib/typescript/src/sdk/LogEntries.d.ts +28 -0
  116. package/lib/typescript/src/sdk/LogEntries.d.ts.map +1 -0
  117. package/lib/typescript/src/sdk/Models.d.ts +114 -0
  118. package/lib/typescript/src/sdk/Models.d.ts.map +1 -0
  119. package/lib/typescript/src/sdk/NativeSdkVersions.d.ts +6 -0
  120. package/lib/typescript/src/sdk/NativeSdkVersions.d.ts.map +1 -0
  121. package/lib/typescript/src/sdk/Observables.d.ts +123 -0
  122. package/lib/typescript/src/sdk/Observables.d.ts.map +1 -0
  123. package/lib/typescript/src/sdk/Passwords.d.ts +72 -0
  124. package/lib/typescript/src/sdk/Passwords.d.ts.map +1 -0
  125. package/lib/typescript/src/sdk/Playback.d.ts +9 -0
  126. package/lib/typescript/src/sdk/Playback.d.ts.map +1 -0
  127. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts +35 -29
  128. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts.map +1 -1
  129. package/lib/typescript/src/util/Colors.d.ts.map +1 -1
  130. package/lib/typescript/src/util/Translations.d.ts +30 -8
  131. package/lib/typescript/src/util/Translations.d.ts.map +1 -1
  132. package/lib/typescript/src/util/freeze.d.ts +6 -0
  133. package/lib/typescript/src/util/freeze.d.ts.map +1 -0
  134. package/lib/typescript/src/util/logger.d.ts +33 -0
  135. package/lib/typescript/src/util/logger.d.ts.map +1 -0
  136. package/livevoice-sdk-react-native.podspec +41 -16
  137. package/package.json +26 -14
  138. package/src/components/BrandingView.tsx +55 -66
  139. package/src/components/ChannelView.tsx +342 -48
  140. package/src/components/ErrorView.tsx +21 -22
  141. package/src/components/LiveVoiceSpinner.tsx +87 -0
  142. package/src/components/LiveVoiceView.tsx +360 -151
  143. package/src/components/PasswordPrompt.tsx +144 -0
  144. package/src/components/PlayButtonView.tsx +177 -279
  145. package/src/components/ReconnectingView.tsx +40 -86
  146. package/src/components/WarningView.tsx +12 -10
  147. package/src/icons/branding-ios.png +0 -0
  148. package/src/icons/camera-off-android.png +0 -0
  149. package/src/icons/camera-off-android@2x.png +0 -0
  150. package/src/icons/camera-off-android@3x.png +0 -0
  151. package/src/icons/cpu-android.png +0 -0
  152. package/src/icons/cpu-android@2x.png +0 -0
  153. package/src/icons/cpu-android@3x.png +0 -0
  154. package/src/icons/cpu-ios.png +0 -0
  155. package/src/icons/cpu-ios@2x.png +0 -0
  156. package/src/icons/cpu-ios@3x.png +0 -0
  157. package/src/icons/lock-android.png +0 -0
  158. package/src/icons/lock-android@2x.png +0 -0
  159. package/src/icons/lock-android@3x.png +0 -0
  160. package/src/icons/lock-ios.png +0 -0
  161. package/src/icons/lock-ios@2x.png +0 -0
  162. package/src/icons/lock-ios@3x.png +0 -0
  163. package/src/icons/mic-off-android.png +0 -0
  164. package/src/icons/mic-off-android@2x.png +0 -0
  165. package/src/icons/mic-off-android@3x.png +0 -0
  166. package/src/icons/mic-slash-ios.png +0 -0
  167. package/src/icons/mic-slash-ios@2x.png +0 -0
  168. package/src/icons/mic-slash-ios@3x.png +0 -0
  169. package/src/icons/video-slash-ios.png +0 -0
  170. package/src/icons/video-slash-ios@2x.png +0 -0
  171. package/src/icons/video-slash-ios@3x.png +0 -0
  172. package/src/index.tsx +105 -252
  173. package/src/sdk/Bridge.ts +259 -0
  174. package/src/sdk/Event.ts +187 -0
  175. package/src/sdk/Lifecycle.ts +366 -0
  176. package/src/sdk/LiveVoiceSdk.ts +384 -0
  177. package/src/sdk/LiveVoiceState.ts +259 -0
  178. package/src/sdk/LogEntries.ts +88 -0
  179. package/src/sdk/Models.ts +129 -0
  180. package/src/sdk/NativeSdkVersions.ts +21 -0
  181. package/src/sdk/Observables.ts +414 -0
  182. package/src/sdk/Passwords.ts +286 -0
  183. package/src/sdk/Playback.ts +30 -0
  184. package/src/specs/NativeLiveVoiceSdk.ts +56 -46
  185. package/src/util/Colors.ts +14 -11
  186. package/src/util/Translations.ts +46 -22
  187. package/src/util/freeze.ts +23 -0
  188. package/src/util/logger.ts +119 -0
  189. package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeLiveVoiceSdkSpec.java +0 -186
  190. package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -28
  191. package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec-generated.cpp +0 -235
  192. package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec.h +0 -31
  193. package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI.h +0 -341
  194. package/android/src/main/java/io/livevoice/react/Mappings.kt +0 -85
  195. package/android/src/main/java/io/livevoice/react/NativeModels.kt +0 -79
  196. package/lib/module/components/AudioOutputSwitchView.js +0 -138
  197. package/lib/module/components/AudioOutputSwitchView.js.map +0 -1
  198. package/lib/module/components/index.js +0 -22
  199. package/lib/module/components/index.js.map +0 -1
  200. package/lib/module/icons/mic.png +0 -0
  201. package/lib/module/util/ForegroundServiceConfig.js +0 -28
  202. package/lib/module/util/ForegroundServiceConfig.js.map +0 -1
  203. package/lib/module/util/PlayingState.js +0 -21
  204. package/lib/module/util/PlayingState.js.map +0 -1
  205. package/lib/module/util/UIState.js +0 -4
  206. package/lib/typescript/src/components/AudioOutputSwitchView.d.ts +0 -6
  207. package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +0 -1
  208. package/lib/typescript/src/components/index.d.ts +0 -9
  209. package/lib/typescript/src/components/index.d.ts.map +0 -1
  210. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts +0 -12
  211. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +0 -1
  212. package/lib/typescript/src/util/PlayingState.d.ts +0 -7
  213. package/lib/typescript/src/util/PlayingState.d.ts.map +0 -1
  214. package/lib/typescript/src/util/UIState.d.ts +0 -66
  215. package/lib/typescript/src/util/UIState.d.ts.map +0 -1
  216. package/src/components/AudioOutputSwitchView.tsx +0 -146
  217. package/src/components/index.tsx +0 -19
  218. package/src/icons/mic.png +0 -0
  219. package/src/util/ForegroundServiceConfig.tsx +0 -32
  220. package/src/util/PlayingState.ts +0 -18
  221. package/src/util/UIState.ts +0 -89
@@ -1,86 +1,400 @@
1
1
  "use strict";
2
2
 
3
- /*
4
- * This source file is part of the LiveVoice SDK project
5
- *
6
- * Copyright (c) LiveVoice GmbH
7
- * Licensed under the MIT license
8
- *
9
- * See LICENSE for license information
10
- *
11
- * SPDX-License-Identifier: MIT
12
- */
3
+ //===----------------------------------------------------------------------===//
4
+ //
5
+ // This source file is part of the LiveVoice SDK project
6
+ //
7
+ // Copyright (c) LiveVoice GmbH
8
+ // Licensed under the MIT license
9
+ //
10
+ // See LICENSE for license information
11
+ //
12
+ // SPDX-License-Identifier: MIT
13
+ //
14
+ //===----------------------------------------------------------------------===//
13
15
 
14
16
  import React, { useState } from 'react';
15
- import { View, Text, StyleSheet, TouchableOpacity, useColorScheme, Image } from 'react-native';
16
- import { COLORS } from "../util/Colors.js";
17
+ import { View, Text, StyleSheet, TouchableOpacity, useColorScheme, useWindowDimensions, Image, Platform } from 'react-native';
17
18
  import PlayButtonView from "./PlayButtonView.js";
18
19
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ /**
21
+ * The default channel cell, drawn as the native SDK of the platform draws its row (iOS
22
+ * `ChannelCellView` in the `.sdk` mode, Android `DefaultChannel`; change them together). Where
23
+ * the two natives differed in behaviour, both follow iOS: the status rule, the expanded name, the
24
+ * dimming during the reconnect grace.
25
+ */
19
26
  export const ChannelView = ({
20
27
  channelName,
21
28
  playingState,
22
- muted,
23
29
  isOnline,
24
30
  hasAudio,
25
31
  hasSubtitles,
32
+ status = null,
33
+ muteMark = null,
34
+ isPasswordProtected = false,
26
35
  isDarkMode = useColorScheme() === 'dark',
36
+ isDimmed = false,
37
+ brandColor = null,
38
+ subtitlesOpen = false,
39
+ accessibility = null,
27
40
  onAudioPress,
28
41
  onSubtitlesPress
29
42
  }) => {
30
- const [collapsed, setCollapsed] = useState(true);
31
- const iconColor = isDarkMode ? COLORS.white : COLORS.black;
32
- return /*#__PURE__*/_jsxs(View, {
33
- style: styles.container,
34
- children: [/*#__PURE__*/_jsx(PlayButtonView, {
35
- playingState: playingState,
36
- onAudioPress: onAudioPress,
37
- onSubtitlesPress: onSubtitlesPress,
38
- isDarkMode: isDarkMode,
39
- isChannelOnline: isOnline,
40
- hasAudio: hasAudio,
41
- hasSubtitles: hasSubtitles
42
- }), /*#__PURE__*/_jsx(View, {
43
- style: {
44
- flex: 1,
45
- marginLeft: 10
46
- },
47
- children: /*#__PURE__*/_jsx(TouchableOpacity, {
48
- onPress: () => setCollapsed(!collapsed),
43
+ const [isExpanded, setExpanded] = useState(false);
44
+ /** How many lines the whole name takes at the column's width. */
45
+ const [nameLines, setNameLines] = useState(1);
46
+ // As iOS: a tap opens a name that does not fit one line to at most 4, and the row then aligns
47
+ // to the top; one that fits stays as it is.
48
+ const isOpen = isExpanded && nameLines > 1;
49
+ const look = cellLook(isDarkMode, useWindowDimensions().fontScale);
50
+ const onSubtitles = isDimmed ? () => {} : onSubtitlesPress;
51
+ // An accessibility action does what a tap on the matching half does.
52
+ const run = kind => {
53
+ if (kind === 'toggleAudio') onAudioPress?.();else if (kind === 'toggleSubtitles') onSubtitles?.();
54
+ };
55
+ return /*#__PURE__*/_jsx(View, {
56
+ ...(accessibility === null ? null : rowAccessibility(accessibility, run)),
57
+ children: /*#__PURE__*/_jsxs(View, {
58
+ style: [styles.container, {
59
+ alignItems: isOpen ? 'flex-start' : 'center'
60
+ }],
61
+ ...(accessibility === null ? null : hiddenFromAccessibility),
62
+ children: [/*#__PURE__*/_jsx(View, {
63
+ style: [styles.button, {
64
+ opacity: isDimmed ? 0.5 : 1
65
+ }],
66
+ children: /*#__PURE__*/_jsx(PlayButtonView, {
67
+ playingState: playingState,
68
+ onAudioPress: onAudioPress,
69
+ onSubtitlesPress: onSubtitles,
70
+ isDarkMode: isDarkMode,
71
+ isChannelOnline: isOnline,
72
+ hasAudio: hasAudio,
73
+ hasSubtitles: hasSubtitles,
74
+ brandColor: brandColor,
75
+ subtitlesOpen: subtitlesOpen
76
+ })
77
+ }), /*#__PURE__*/_jsxs(TouchableOpacity, {
78
+ style: look.title,
79
+ onPress: () => setExpanded(!isExpanded),
49
80
  activeOpacity: 1,
50
- children: /*#__PURE__*/_jsx(Text, {
51
- numberOfLines: collapsed ? 1 : undefined,
52
- ellipsizeMode: "tail",
53
- style: [styles.text, {
54
- color: isDarkMode ? COLORS.white : COLORS.black
55
- }],
56
- children: channelName
81
+ children: [/*#__PURE__*/_jsxs(View, {
82
+ children: [/*#__PURE__*/_jsx(Text, {
83
+ numberOfLines: isOpen ? 4 : 1,
84
+ ellipsizeMode: "tail",
85
+ style: look.name,
86
+ children: channelName
87
+ }), /*#__PURE__*/_jsx(Text, {
88
+ style: [look.name, styles.measure],
89
+ importantForAccessibility: "no-hide-descendants",
90
+ accessibilityElementsHidden: true,
91
+ onTextLayout: event => setNameLines(event.nativeEvent.lines.length),
92
+ children: channelName
93
+ })]
94
+ }), status !== null && /*#__PURE__*/_jsxs(View, {
95
+ style: look.statusRow,
96
+ children: [status.showsAiIcon && /*#__PURE__*/_jsx(Image, {
97
+ source: look.cpu.source,
98
+ style: [look.cpu.style, {
99
+ tintColor: look.status.color
100
+ }]
101
+ }), /*#__PURE__*/_jsxs(Text, {
102
+ numberOfLines: 1,
103
+ style: [look.status, status.showsAiIcon ? look.cpu.text : null],
104
+ children: [status.showsAiIcon ? look.cpu.before : '', status.text]
105
+ })]
106
+ })]
107
+ }), look.spacer && /*#__PURE__*/_jsx(View, {
108
+ style: styles.spacer
109
+ }), muteMark !== null && /*#__PURE__*/_jsx(View, {
110
+ style: look.mute.frame,
111
+ children: /*#__PURE__*/_jsx(Image, {
112
+ source: look.mute[muteMark].source,
113
+ style: look.mute[muteMark].style
114
+ })
115
+ }), isPasswordProtected && /*#__PURE__*/_jsx(View, {
116
+ style: look.lock.frame,
117
+ children: /*#__PURE__*/_jsx(Image, {
118
+ source: look.lock.source,
119
+ style: look.lock.style
57
120
  })
58
- })
59
- }), muted && /*#__PURE__*/_jsx(Image, {
60
- source: require('../icons/mic.png'),
121
+ })]
122
+ })
123
+ });
124
+ };
125
+
126
+ /** The system grey of the mute mark and the lock: iOS `.gray`, Android `RawColors.systemGray`. */
127
+ const systemGray = '#8E8E93';
128
+
129
+ /**
130
+ * The row's type, colours and marks on this platform.
131
+ *
132
+ * - iOS (`ChannelCellView.swift`): the name `.headline` (17 pt semibold) in `.primary`; the status
133
+ * `.caption` (12 pt) in `.secondary`, `Text(Image("cpu")) + " " + Text(status)` for an AI
134
+ * speaker; the mute mark `mic.slash.fill` or `video.slash.fill` and the lock `lock.fill`, each at
135
+ * its natural size centred in a 30 pt frame, 12 apart and 12 after the flexible space (at least
136
+ * 8) that follows the name. The glyphs are UIKit's renders at `.body` and `.caption`, sized by
137
+ * their point sizes.
138
+ * - Android (`DefaultChannel.kt`, `ChannelNameAndStatus.kt`, `ChannelMuteIcon.kt`): the name
139
+ * `titleMedium` (16 sp, 500, line height 24, letter spacing 0.15) in `onBackground`; the status
140
+ * `bodySmall` (12 sp, line height 16, letter spacing 0.4) in `onBackgroundInactive`,
141
+ * `livevoice_ic_cpu` 16 dp and 4 dp before an AI speaker's; the mute mark
142
+ * `livevoice_ic_microphone_off` or `livevoice_ic_camera_off` 24 dp right after the name; the
143
+ * lock `livevoice_ic_lock` in a 30 dp frame with 5 dp padding, 12 dp after.
144
+ *
145
+ * `fontScale` is the system text size React Native applies to text; only the iOS `cpu` uses it, to
146
+ * keep its baseline on the text's.
147
+ */
148
+ function cellLook(isDarkMode, fontScale) {
149
+ if (Platform.OS === 'ios') {
150
+ // The `cpu` symbol in the caption line, as `Text(Image)`: its baseline, 2.33 above its bottom,
151
+ // on the text's, which lies the caption font's ascender (11.43 at 12 pt) below the line's top.
152
+ // Whichever of the two would start higher starts the row; the other moves down.
153
+ const cpuTop = 11.43 * fontScale - (40 / 3 - 7 / 3);
154
+ return {
155
+ name: {
156
+ fontSize: 17,
157
+ fontWeight: '600',
158
+ color: isDarkMode ? '#FFFFFF' : '#000000'
159
+ },
160
+ status: {
161
+ fontSize: 12,
162
+ fontWeight: '400',
163
+ color: isDarkMode ? 'rgba(235, 235, 245, 0.6)' : 'rgba(60, 60, 67, 0.6)'
164
+ },
165
+ statusRow: styles.statusIos,
166
+ cpu: {
167
+ source: require('../icons/cpu-ios.png'),
168
+ style: {
169
+ width: 44 / 3,
170
+ height: 40 / 3,
171
+ marginTop: Math.max(0, cpuTop)
172
+ },
173
+ text: {
174
+ marginTop: Math.max(0, -cpuTop)
175
+ },
176
+ // The space of `+ " " +`, in the caption font.
177
+ before: ' '
178
+ },
179
+ // As wide as the name needs; the flexible space after it takes the rest.
180
+ title: styles.titleShrinks,
181
+ spacer: true,
182
+ mute: {
183
+ frame: styles.iosMark,
184
+ microphone: {
185
+ source: require('../icons/mic-slash-ios.png'),
186
+ style: {
187
+ width: 17,
188
+ height: 20,
189
+ tintColor: systemGray
190
+ }
191
+ },
192
+ camera: {
193
+ source: require('../icons/video-slash-ios.png'),
194
+ style: {
195
+ width: 25,
196
+ height: 67 / 3,
197
+ tintColor: systemGray
198
+ }
199
+ }
200
+ },
201
+ lock: {
202
+ frame: styles.iosMark,
203
+ source: require('../icons/lock-ios.png'),
204
+ style: {
205
+ width: 16,
206
+ height: 55 / 3,
207
+ tintColor: systemGray
208
+ }
209
+ }
210
+ };
211
+ }
212
+ return {
213
+ name: {
214
+ fontSize: 16,
215
+ fontWeight: '500',
216
+ lineHeight: 24,
217
+ letterSpacing: 0.15,
218
+ includeFontPadding: false,
219
+ color: isDarkMode ? '#FFFFFF' : '#191919'
220
+ },
221
+ status: {
222
+ fontSize: 12,
223
+ fontWeight: '400',
224
+ lineHeight: 16,
225
+ letterSpacing: 0.4,
226
+ includeFontPadding: false,
227
+ color: isDarkMode ? '#8B9299' : '#6D757D'
228
+ },
229
+ statusRow: styles.statusAndroid,
230
+ cpu: {
231
+ source: require('../icons/cpu-android.png'),
232
+ style: {
233
+ width: 16,
234
+ height: 16,
235
+ marginRight: 4
236
+ },
237
+ text: null,
238
+ before: ''
239
+ },
240
+ // The rest of the row (`weight(1f)`), so the mute mark sits at its end.
241
+ title: styles.titleFills,
242
+ spacer: false,
243
+ mute: {
244
+ frame: styles.androidMute,
245
+ microphone: {
246
+ source: require('../icons/mic-off-android.png'),
247
+ style: {
248
+ width: 24,
249
+ height: 24,
250
+ tintColor: systemGray
251
+ }
252
+ },
253
+ camera: {
254
+ source: require('../icons/camera-off-android.png'),
255
+ style: {
256
+ width: 24,
257
+ height: 24,
258
+ tintColor: systemGray
259
+ }
260
+ }
261
+ },
262
+ lock: {
263
+ frame: styles.androidLock,
264
+ source: require('../icons/lock-android.png'),
61
265
  style: {
62
- tintColor: iconColor,
63
266
  width: 20,
64
267
  height: 20,
65
- resizeMode: 'contain'
268
+ tintColor: systemGray
66
269
  }
67
- })]
68
- });
270
+ }
271
+ };
272
+ }
273
+
274
+ /** The row's parts, which the row's own element speaks for. */
275
+ const hiddenFromAccessibility = {
276
+ importantForAccessibility: 'no-hide-descendants',
277
+ accessibilityElementsHidden: true
278
+ };
279
+
280
+ /**
281
+ * React Native clears an Android view's whole content description, label included, when its
282
+ * `accessibilityValue` goes away, and keeps a stale value when one without `text` replaces it. An
283
+ * empty value is therefore a value whose `text` is `null`: no value on either platform.
284
+ */
285
+ const noValue = {
286
+ text: null
69
287
  };
288
+
289
+ /**
290
+ * The row as one accessibility element, exactly as native computed it: its label, value, button
291
+ * role and selected state, what a double tap does, and the named actions in the native order.
292
+ *
293
+ * - iOS: VoiceOver's double tap is `onAccessibilityTap`, a no-op without an activation (the
294
+ * default would tap the row's middle). Every named action is a custom action, as the native row
295
+ * lists play or stop beside the double tap.
296
+ * - Android: TalkBack's double tap is the click, named after the activation's own action, as the
297
+ * native row's click label; TalkBack lists it with the actions, so the activation's entry
298
+ * becomes that click instead of a second action of the same name.
299
+ */
300
+ function rowAccessibility(accessibility, run) {
301
+ const {
302
+ activation
303
+ } = accessibility;
304
+ const click = Platform.OS === 'android' && activation !== null ? accessibility.actions.findIndex(action => action.kind === activation) : -1;
305
+ const actions = accessibility.actions.map((action, index) => ({
306
+ name: index === click ? 'activate' : action.kind,
307
+ label: action.name
308
+ }));
309
+ if (Platform.OS === 'android' && activation !== null && click < 0) actions.unshift({
310
+ name: 'activate'
311
+ });
312
+ return {
313
+ accessible: true,
314
+ accessibilityLabel: accessibility.label,
315
+ accessibilityValue: accessibility.value === '' ? noValue : {
316
+ text: accessibility.value
317
+ },
318
+ accessibilityRole: accessibility.isButton ? 'button' : undefined,
319
+ accessibilityState: {
320
+ selected: accessibility.isSelected
321
+ },
322
+ accessibilityActions: actions,
323
+ onAccessibilityTap: () => run(activation),
324
+ onAccessibilityAction: ({
325
+ nativeEvent: {
326
+ actionName
327
+ }
328
+ }) => {
329
+ if (actionName === 'activate') run(activation);else if (actionName === 'toggleAudio' || actionName === 'toggleSubtitles') run(actionName);
330
+ }
331
+ };
332
+ }
70
333
  const styles = StyleSheet.create({
334
+ // 12 at the sides (iOS `defaultCellInsets`, Android `padding(horizontal = 12.dp)`), 8 above and below.
71
335
  container: {
72
336
  flexDirection: 'row',
337
+ paddingHorizontal: 12,
338
+ paddingVertical: 8
339
+ },
340
+ // 2 above and below the button, so a row is 64 tall, and 12 to the name.
341
+ button: {
342
+ paddingVertical: 2,
343
+ marginRight: 12
344
+ },
345
+ // The name and the status line.
346
+ titleShrinks: {
347
+ flexShrink: 1
348
+ },
349
+ // Android: the rest of the row, 20 clear of the marks as iOS's spacing of 12 and Spacer of 8.
350
+ titleFills: {
351
+ flex: 1,
352
+ marginRight: 20
353
+ },
354
+ measure: {
355
+ position: 'absolute',
356
+ left: 0,
357
+ right: 0,
358
+ top: 0,
359
+ opacity: 0
360
+ },
361
+ // iOS: the `cpu` placed on the text's baseline from the top; Android: centred, as its `Row`.
362
+ statusIos: {
363
+ flexDirection: 'row',
364
+ alignItems: 'flex-start',
365
+ marginTop: 2
366
+ },
367
+ statusAndroid: {
368
+ flexDirection: 'row',
369
+ alignItems: 'center',
370
+ marginTop: 2
371
+ },
372
+ // iOS's `Spacer()`: at least the default spacing of 8, 12 from the name beside it.
373
+ spacer: {
374
+ flexGrow: 1,
375
+ minWidth: 8,
376
+ marginLeft: 12
377
+ },
378
+ iosMark: {
379
+ width: 30,
380
+ height: 30,
381
+ marginLeft: 12,
73
382
  alignItems: 'center',
74
- padding: 10
383
+ justifyContent: 'center'
75
384
  },
76
- text: {
77
- fontSize: 16,
78
- fontWeight: '500'
385
+ // `ChannelMuteIcon`: the 24 dp glyph centred in a 30 dp frame, 12 after the name's gap.
386
+ androidMute: {
387
+ width: 30,
388
+ height: 30,
389
+ marginLeft: 12,
390
+ alignItems: 'center',
391
+ justifyContent: 'center'
79
392
  },
80
- aiText: {
81
- fontSize: 12,
82
- fontWeight: '400',
83
- marginLeft: 4
393
+ androidLock: {
394
+ width: 30,
395
+ height: 30,
396
+ padding: 5,
397
+ marginLeft: 12
84
398
  }
85
399
  });
86
400
  //# sourceMappingURL=ChannelView.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","useState","View","Text","StyleSheet","TouchableOpacity","useColorScheme","Image","COLORS","PlayButtonView","jsx","_jsx","jsxs","_jsxs","ChannelView","channelName","playingState","muted","isOnline","hasAudio","hasSubtitles","isDarkMode","onAudioPress","onSubtitlesPress","collapsed","setCollapsed","iconColor","white","black","style","styles","container","children","isChannelOnline","flex","marginLeft","onPress","activeOpacity","numberOfLines","undefined","ellipsizeMode","text","color","source","require","tintColor","width","height","resizeMode","create","flexDirection","alignItems","padding","fontSize","fontWeight","aiText"],"sourceRoot":"../../../src","sources":["components/ChannelView.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,IAAI,EAAEC,IAAI,EAAEC,UAAU,EAAEC,gBAAgB,EAAEC,cAAc,EAAEC,KAAK,QAAQ,cAAc;AAC9F,SAASC,MAAM,QAAQ,mBAAgB;AAEvC,OAAOC,cAAc,MAAM,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAe9C,OAAO,MAAMC,WAAmC,GAAGA,CAAC;EAClDC,WAAW;EACXC,YAAY;EACZC,KAAK;EACLC,QAAQ;EACRC,QAAQ;EACRC,YAAY;EACZC,UAAU,GAAGf,cAAc,CAAC,CAAC,KAAK,MAAM;EACxCgB,YAAY;EACZC;AACF,CAAC,KAAK;EAEJ,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGxB,QAAQ,CAAC,IAAI,CAAC;EAEhD,MAAMyB,SAAS,GAAGL,UAAU,GAAGb,MAAM,CAACmB,KAAK,GAAGnB,MAAM,CAACoB,KAAK;EAE1D,oBACEf,KAAA,CAACX,IAAI;IAAC2B,KAAK,EAAEC,MAAM,CAACC,SAAU;IAAAC,QAAA,gBAC5BrB,IAAA,CAACF,cAAc;MACbO,YAAY,EAAEA,YAAa;MAC3BM,YAAY,EAAEA,YAAa;MAC3BC,gBAAgB,EAAEA,gBAAiB;MACnCF,UAAU,EAAEA,UAAW;MACvBY,eAAe,EAAEf,QAAS;MAC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 {"version":3,"names":["React","useState","View","Text","StyleSheet","TouchableOpacity","useColorScheme","useWindowDimensions","Image","Platform","PlayButtonView","jsx","_jsx","jsxs","_jsxs","ChannelView","channelName","playingState","isOnline","hasAudio","hasSubtitles","status","muteMark","isPasswordProtected","isDarkMode","isDimmed","brandColor","subtitlesOpen","accessibility","onAudioPress","onSubtitlesPress","isExpanded","setExpanded","nameLines","setNameLines","isOpen","look","cellLook","fontScale","onSubtitles","run","kind","rowAccessibility","children","style","styles","container","alignItems","hiddenFromAccessibility","button","opacity","isChannelOnline","title","onPress","activeOpacity","numberOfLines","ellipsizeMode","name","measure","importantForAccessibility","accessibilityElementsHidden","onTextLayout","event","nativeEvent","lines","length","statusRow","showsAiIcon","source","cpu","tintColor","color","text","before","spacer","mute","frame","lock","systemGray","OS","cpuTop","fontSize","fontWeight","statusIos","require","width","height","marginTop","Math","max","titleShrinks","iosMark","microphone","camera","lineHeight","letterSpacing","includeFontPadding","statusAndroid","marginRight","titleFills","androidMute","androidLock","noValue","activation","click","actions","findIndex","action","map","index","label","unshift","accessible","accessibilityLabel","accessibilityValue","value","accessibilityRole","isButton","undefined","accessibilityState","selected","isSelected","accessibilityActions","onAccessibilityTap","onAccessibilityAction","actionName","create","flexDirection","paddingHorizontal","paddingVertical","flexShrink","flex","position","left","right","top","flexGrow","minWidth","marginLeft","justifyContent","padding"],"sourceRoot":"../../../src","sources":["components/ChannelView.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SACEC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,gBAAgB,EAChBC,cAAc,EACdC,mBAAmB,EACnBC,KAAK,EACLC,QAAQ,QAKH,cAAc;AAQrB,OAAOC,cAAc,MAAM,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAkC9C;AACA;AACA;A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,EAAE;IACVoD,UAAU,EAAE,EAAE;IACd3F,UAAU,EAAE,QAAQ;IACpB4F,cAAc,EAAE;EAClB,CAAC;EACDtC,WAAW,EAAE;IACXhB,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACVsD,OAAO,EAAE,CAAC;IACVF,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,25 +1,26 @@
1
1
  "use strict";
2
2
 
3
- /*
4
- * This source file is part of the LiveVoice SDK project
5
- *
6
- * Copyright (c) LiveVoice GmbH
7
- * Licensed under the MIT license
8
- *
9
- * See LICENSE for license information
10
- *
11
- * SPDX-License-Identifier: MIT
12
- */
3
+ //===----------------------------------------------------------------------===//
4
+ //
5
+ // This source file is part of the LiveVoice SDK project
6
+ //
7
+ // Copyright (c) LiveVoice GmbH
8
+ // Licensed under the MIT license
9
+ //
10
+ // See LICENSE for license information
11
+ //
12
+ // SPDX-License-Identifier: MIT
13
+ //
14
+ //===----------------------------------------------------------------------===//
13
15
 
14
16
  import React from 'react';
15
17
  import { View, Text, useColorScheme, StyleSheet, TouchableOpacity } from 'react-native';
16
18
  import { COLORS } from "../util/Colors.js";
17
19
  import { Translations } from "../util/Translations.js";
18
20
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
+ /** The default error part. */
19
22
  export const ErrorView = props => {
20
23
  const isDarkMode = props.isDarkMode ?? useColorScheme() === 'dark';
21
- const state = props.state;
22
- const canBeRetried = state.type === 'error' && state.canBeRetried;
23
24
  return /*#__PURE__*/_jsxs(View, {
24
25
  style: [styles.container, isDarkMode ? {
25
26
  backgroundColor: COLORS.cardBgDark
@@ -27,10 +28,10 @@ export const ErrorView = props => {
27
28
  backgroundColor: COLORS.cardBg
28
29
  }],
29
30
  children: [/*#__PURE__*/_jsx(Text, {
30
- style: [styles.text, state.type === 'error' ? styles.dangerText : isDarkMode ? styles.darkText : styles.lightText],
31
- children: state.message
32
- }), canBeRetried && /*#__PURE__*/_jsx(TouchableOpacity, {
33
- onPress: props.onPress,
31
+ style: [styles.text, styles.dangerText],
32
+ children: props.message
33
+ }), props.onRetry != null && /*#__PURE__*/_jsx(TouchableOpacity, {
34
+ onPress: props.onRetry,
34
35
  activeOpacity: 0.9,
35
36
  style: [styles.button, isDarkMode ? {
36
37
  backgroundColor: '#fff'
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","Text","useColorScheme","StyleSheet","TouchableOpacity","COLORS","Translations","jsx","_jsx","jsxs","_jsxs","ErrorView","props","isDarkMode","state","canBeRetried","type","style","styles","container","backgroundColor","cardBgDark","cardBg","children","text","dangerText","darkText","lightText","message","onPress","activeOpacity","button","buttonText","errorRetryNowButton","create","paddingVertical","alignItems","justifyContent","borderRadius","width","marginBottom","fontSize","fontWeight","textAlign","color","paddingHorizontal","marginTop"],"sourceRoot":"../../../src","sources":["components/ErrorView.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,cAAc,EAAEC,UAAU,EAAEC,gBAAgB,QAAQ,cAAc;AACvF,SAASC,MAAM,QAAQ,mBAAgB;AACvC,SAASC,YAAY,QAAQ,yBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AASpD,OAAO,MAAMC,SAA+B,GAAIC,KAAK,IAAK;EACxD,MAAMC,UAAU,GAAGD,KAAK,CAACC,UAAU,IAAIX,cAAc,CAAC,CAAC,KAAK,MAAM;EAClE,MAAMY,KAAK,GAAGF,KAAK,CAACE,KAAK;EAEzB,MAAMC,YAAY,GAAID,KAAK,CAACE,IAAI,KAAK,OAAO,IAAIF,KAAK,CAACC,YAAa;EAEnE,oBACEL,KAAA,CAACV,IAAI;IACHiB,KAAK,EAAE,CACLC,MAAM,CAACC,SAAS,EAChBN,UAAU,GAAG;MAAEO,eAAe,EAAEf,MAAM,CAACgB;I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DlB,QAAQ,EAAE;IACRkB,KAAK,EAAE;EACT,CAAC;EACDjB,SAAS,EAAE;IACTiB,KAAK,EAAE;EACT,CAAC;EACDb,MAAM,EAAE;IACNc,iBAAiB,EAAE,EAAE;IACrBV,eAAe,EAAE,CAAC;IAClBG,YAAY,EAAE,CAAC;IACfQ,SAAS,EAAE;EACb,CAAC;EACDd,UAAU,EAAE;IACVY,KAAK,EAAE,MAAM;IACbH,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","View","Text","useColorScheme","StyleSheet","TouchableOpacity","COLORS","Translations","jsx","_jsx","jsxs","_jsxs","ErrorView","props","isDarkMode","style","styles","container","backgroundColor","cardBgDark","cardBg","children","text","dangerText","message","onRetry","onPress","activeOpacity","button","buttonText","lightText","darkText","errorRetryNowButton","create","paddingVertical","alignItems","justifyContent","borderRadius","width","marginBottom","fontSize","fontWeight","textAlign","color","paddingHorizontal","marginTop"],"sourceRoot":"../../../src","sources":["components/ErrorView.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,IAAI,EAAEC,cAAc,EAAEC,UAAU,EAAEC,gBAAgB,QAAQ,cAAc;AACvF,SAASC,MAAM,QAAQ,mBAAgB;AACvC,SAASC,YAAY,QAAQ,yBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAUpD;AACA,OAAO,MAAMC,SAA+B,GAAIC,KAAK,IAAK;EACxD,MAAMC,UAAU,GAAGD,KAAK,CAACC,UAAU,IAAIX,cAAc,CAAC,CAAC,KAAK,MAAM;EAElE,oBACEQ,KAAA,CAACV,IAAI;IACHc,KAAK,EAAE,CACLC,MAAM,CAACC,SAAS,EAChBH,UAAU,GAAG;MAAEI,eAAe,EAAEZ,MAAM,CAACa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E;EACT,CAAC;EACDf,MAAM,EAAE;IACNgB,iBAAiB,EAAE,EAAE;IACrBV,eAAe,EAAE,CAAC;IAClBG,YAAY,EAAE,CAAC;IACfQ,SAAS,EAAE;EACb,CAAC;EACDhB,UAAU,EAAE;IACVc,KAAK,EAAE,MAAM;IACbH,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ //===----------------------------------------------------------------------===//
4
+ //
5
+ // This source file is part of the LiveVoice SDK project
6
+ //
7
+ // Copyright (c) LiveVoice GmbH
8
+ // Licensed under the MIT license
9
+ //
10
+ // See LICENSE for license information
11
+ //
12
+ // SPDX-License-Identifier: MIT
13
+ //
14
+ //===----------------------------------------------------------------------===//
15
+
16
+ import React, { useEffect, useState } from "react";
17
+ import { StyleSheet, View } from "react-native";
18
+ import { jsx as _jsx } from "react/jsx-runtime";
19
+ const BAR_COUNT = 8;
20
+ /** Milliseconds per revolution. */
21
+ const PERIOD_MS = 1000;
22
+ /** Opacities by how many steps a bar is behind the lit one: the lit bar, then the two fading behind it. */
23
+ const OPACITIES = [1, 0.55, 0.25];
24
+ const TRACK_OPACITY = 0.15;
25
+ /** Bar width and length as fractions of the diameter; the mark's bars are about a quarter as wide as the shortest is tall. */
26
+ const BAR_WIDTH = 0.15;
27
+ const BAR_LENGTH = 0.32;
28
+ /**
29
+ * A spinner in LiveVoice's own hand: the rounded bars of the mark, set around
30
+ * a circle like the iOS spinner's spokes. The lit bar steps round once a
31
+ * second, and the two bars behind it fade out over a faint track of the
32
+ * others. It keeps turning with reduced motion, like the system spinners.
33
+ *
34
+ * Mirrors the native SDKs' and the Flutter spinner; change them together.
35
+ */
36
+ export const LiveVoiceSpinner = ({
37
+ size,
38
+ color
39
+ }) => {
40
+ const [lit, setLit] = useState(0);
41
+ useEffect(() => {
42
+ const timer = setInterval(() => setLit(current => (current + 1) % BAR_COUNT), PERIOD_MS / BAR_COUNT);
43
+ return () => clearInterval(timer);
44
+ }, []);
45
+ const barWidth = size * BAR_WIDTH;
46
+ return /*#__PURE__*/_jsx(View, {
47
+ style: {
48
+ width: size,
49
+ height: size
50
+ },
51
+ accessibilityElementsHidden: true,
52
+ importantForAccessibility: "no-hide-descendants",
53
+ children: Array.from({
54
+ length: BAR_COUNT
55
+ }, (_, index) => {
56
+ const behind = (lit - index + BAR_COUNT) % BAR_COUNT;
57
+ return /*#__PURE__*/_jsx(View, {
58
+ style: [StyleSheet.absoluteFill, styles.spoke, {
59
+ transform: [{
60
+ rotate: `${index * 360 / BAR_COUNT}deg`
61
+ }]
62
+ }],
63
+ children: /*#__PURE__*/_jsx(View, {
64
+ style: {
65
+ width: barWidth,
66
+ height: size * BAR_LENGTH,
67
+ borderRadius: barWidth / 2,
68
+ backgroundColor: color,
69
+ opacity: OPACITIES[behind] ?? TRACK_OPACITY
70
+ }
71
+ })
72
+ }, index);
73
+ })
74
+ });
75
+ };
76
+ const styles = StyleSheet.create({
77
+ spoke: {
78
+ alignItems: "center"
79
+ }
80
+ });
81
+ //# sourceMappingURL=LiveVoiceSpinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useEffect","useState","StyleSheet","View","jsx","_jsx","BAR_COUNT","PERIOD_MS","OPACITIES","TRACK_OPACITY","BAR_WIDTH","BAR_LENGTH","LiveVoiceSpinner","size","color","lit","setLit","timer","setInterval","current","clearInterval","barWidth","style","width","height","accessibilityElementsHidden","importantForAccessibility","children","Array","from","length","_","index","behind","absoluteFill","styles","spoke","transform","rotate","borderRadius","backgroundColor","opacity","create","alignItems"],"sourceRoot":"../../../src","sources":["components/LiveVoiceSpinner.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAAC,SAAA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