livevoice-sdk-react-native 2.0.1 → 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 (207) hide show
  1. package/README.md +105 -66
  2. package/android/build.gradle +5 -4
  3. package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +122 -188
  4. package/android/src/main/java/io/livevoice/react/__SDK.kt +2 -2
  5. package/ios/LiveVoiceRNBridge.swift +362 -0
  6. package/ios/LiveVoiceSdkReactNative.mm +187 -158
  7. package/ios/__SDK.h +1 -1
  8. package/ios/livevoice_spm_backport.rb +202 -0
  9. package/lib/module/components/BrandingView.js +58 -39
  10. package/lib/module/components/BrandingView.js.map +1 -1
  11. package/lib/module/components/ChannelView.js +355 -44
  12. package/lib/module/components/ChannelView.js.map +1 -1
  13. package/lib/module/components/ErrorView.js +5 -6
  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 +311 -133
  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 +180 -244
  22. package/lib/module/components/PlayButtonView.js.map +1 -1
  23. package/lib/module/components/ReconnectingView.js +31 -53
  24. package/lib/module/components/ReconnectingView.js.map +1 -1
  25. package/lib/module/icons/branding-ios.png +0 -0
  26. package/lib/module/icons/camera-off-android.png +0 -0
  27. package/lib/module/icons/camera-off-android@2x.png +0 -0
  28. package/lib/module/icons/camera-off-android@3x.png +0 -0
  29. package/lib/module/icons/cpu-android.png +0 -0
  30. package/lib/module/icons/cpu-android@2x.png +0 -0
  31. package/lib/module/icons/cpu-android@3x.png +0 -0
  32. package/lib/module/icons/cpu-ios.png +0 -0
  33. package/lib/module/icons/cpu-ios@2x.png +0 -0
  34. package/lib/module/icons/cpu-ios@3x.png +0 -0
  35. package/lib/module/icons/lock-android.png +0 -0
  36. package/lib/module/icons/lock-android@2x.png +0 -0
  37. package/lib/module/icons/lock-android@3x.png +0 -0
  38. package/lib/module/icons/lock-ios.png +0 -0
  39. package/lib/module/icons/lock-ios@2x.png +0 -0
  40. package/lib/module/icons/lock-ios@3x.png +0 -0
  41. package/lib/module/icons/mic-off-android.png +0 -0
  42. package/lib/module/icons/mic-off-android@2x.png +0 -0
  43. package/lib/module/icons/mic-off-android@3x.png +0 -0
  44. package/lib/module/icons/mic-slash-ios.png +0 -0
  45. package/lib/module/icons/mic-slash-ios@2x.png +0 -0
  46. package/lib/module/icons/mic-slash-ios@3x.png +0 -0
  47. package/lib/module/icons/video-slash-ios.png +0 -0
  48. package/lib/module/icons/video-slash-ios@2x.png +0 -0
  49. package/lib/module/icons/video-slash-ios@3x.png +0 -0
  50. package/lib/module/index.js +11 -6
  51. package/lib/module/index.js.map +1 -1
  52. package/lib/module/sdk/Bridge.js +236 -0
  53. package/lib/module/sdk/Bridge.js.map +1 -0
  54. package/lib/module/sdk/Event.js +160 -0
  55. package/lib/module/sdk/Event.js.map +1 -0
  56. package/lib/module/sdk/Lifecycle.js +331 -0
  57. package/lib/module/sdk/Lifecycle.js.map +1 -0
  58. package/lib/module/sdk/LiveVoiceSdk.js +262 -268
  59. package/lib/module/sdk/LiveVoiceSdk.js.map +1 -1
  60. package/lib/module/sdk/LiveVoiceState.js +208 -40
  61. package/lib/module/sdk/LiveVoiceState.js.map +1 -1
  62. package/lib/module/sdk/LogEntries.js +99 -0
  63. package/lib/module/sdk/LogEntries.js.map +1 -0
  64. package/lib/module/sdk/Models.js +2 -0
  65. package/lib/module/{util/UIState.js.map → sdk/Models.js.map} +1 -1
  66. package/lib/module/{util/PlayingState.js → sdk/NativeSdkVersions.js} +9 -8
  67. package/lib/module/sdk/NativeSdkVersions.js.map +1 -0
  68. package/lib/module/sdk/Observables.js +391 -0
  69. package/lib/module/sdk/Observables.js.map +1 -0
  70. package/lib/module/sdk/Passwords.js +298 -0
  71. package/lib/module/sdk/Passwords.js.map +1 -0
  72. package/lib/module/sdk/Playback.js +35 -0
  73. package/lib/module/sdk/Playback.js.map +1 -0
  74. package/lib/module/specs/NativeLiveVoiceSdk.js.map +1 -1
  75. package/lib/module/util/Colors.js +2 -1
  76. package/lib/module/util/Colors.js.map +1 -1
  77. package/lib/module/util/Translations.js +34 -11
  78. package/lib/module/util/Translations.js.map +1 -1
  79. package/lib/module/util/freeze.js +26 -0
  80. package/lib/module/util/freeze.js.map +1 -0
  81. package/lib/module/util/logger.js +79 -41
  82. package/lib/module/util/logger.js.map +1 -1
  83. package/lib/typescript/src/components/BrandingView.d.ts +4 -0
  84. package/lib/typescript/src/components/BrandingView.d.ts.map +1 -1
  85. package/lib/typescript/src/components/ChannelView.d.ts +29 -3
  86. package/lib/typescript/src/components/ChannelView.d.ts.map +1 -1
  87. package/lib/typescript/src/components/ErrorView.d.ts +5 -3
  88. package/lib/typescript/src/components/ErrorView.d.ts.map +1 -1
  89. package/lib/typescript/src/components/LiveVoiceSpinner.d.ts +16 -0
  90. package/lib/typescript/src/components/LiveVoiceSpinner.d.ts.map +1 -0
  91. package/lib/typescript/src/components/LiveVoiceView.d.ts +81 -21
  92. package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -1
  93. package/lib/typescript/src/components/PasswordPrompt.d.ts +13 -0
  94. package/lib/typescript/src/components/PasswordPrompt.d.ts.map +1 -0
  95. package/lib/typescript/src/components/PlayButtonView.d.ts +12 -329
  96. package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -1
  97. package/lib/typescript/src/components/ReconnectingView.d.ts +6 -3
  98. package/lib/typescript/src/components/ReconnectingView.d.ts.map +1 -1
  99. package/lib/typescript/src/index.d.ts +15 -6
  100. package/lib/typescript/src/index.d.ts.map +1 -1
  101. package/lib/typescript/src/sdk/Bridge.d.ts +36 -0
  102. package/lib/typescript/src/sdk/Bridge.d.ts.map +1 -0
  103. package/lib/typescript/src/sdk/Event.d.ts +97 -0
  104. package/lib/typescript/src/sdk/Event.d.ts.map +1 -0
  105. package/lib/typescript/src/sdk/Lifecycle.d.ts +191 -0
  106. package/lib/typescript/src/sdk/Lifecycle.d.ts.map +1 -0
  107. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts +195 -190
  108. package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts.map +1 -1
  109. package/lib/typescript/src/sdk/LiveVoiceState.d.ts +77 -9
  110. package/lib/typescript/src/sdk/LiveVoiceState.d.ts.map +1 -1
  111. package/lib/typescript/src/sdk/LogEntries.d.ts +28 -0
  112. package/lib/typescript/src/sdk/LogEntries.d.ts.map +1 -0
  113. package/lib/typescript/src/sdk/Models.d.ts +114 -0
  114. package/lib/typescript/src/sdk/Models.d.ts.map +1 -0
  115. package/lib/typescript/src/sdk/NativeSdkVersions.d.ts +6 -0
  116. package/lib/typescript/src/sdk/NativeSdkVersions.d.ts.map +1 -0
  117. package/lib/typescript/src/sdk/Observables.d.ts +123 -0
  118. package/lib/typescript/src/sdk/Observables.d.ts.map +1 -0
  119. package/lib/typescript/src/sdk/Passwords.d.ts +72 -0
  120. package/lib/typescript/src/sdk/Passwords.d.ts.map +1 -0
  121. package/lib/typescript/src/sdk/Playback.d.ts +9 -0
  122. package/lib/typescript/src/sdk/Playback.d.ts.map +1 -0
  123. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts +34 -31
  124. package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts.map +1 -1
  125. package/lib/typescript/src/util/Colors.d.ts.map +1 -1
  126. package/lib/typescript/src/util/Translations.d.ts +30 -8
  127. package/lib/typescript/src/util/Translations.d.ts.map +1 -1
  128. package/lib/typescript/src/util/freeze.d.ts +6 -0
  129. package/lib/typescript/src/util/freeze.d.ts.map +1 -0
  130. package/lib/typescript/src/util/logger.d.ts +17 -7
  131. package/lib/typescript/src/util/logger.d.ts.map +1 -1
  132. package/livevoice-sdk-react-native.podspec +29 -4
  133. package/package.json +12 -9
  134. package/src/components/BrandingView.tsx +42 -55
  135. package/src/components/ChannelView.tsx +329 -38
  136. package/src/components/ErrorView.tsx +9 -12
  137. package/src/components/LiveVoiceSpinner.tsx +87 -0
  138. package/src/components/LiveVoiceView.tsx +319 -201
  139. package/src/components/PasswordPrompt.tsx +144 -0
  140. package/src/components/PlayButtonView.tsx +165 -269
  141. package/src/components/ReconnectingView.tsx +28 -81
  142. package/src/icons/branding-ios.png +0 -0
  143. package/src/icons/camera-off-android.png +0 -0
  144. package/src/icons/camera-off-android@2x.png +0 -0
  145. package/src/icons/camera-off-android@3x.png +0 -0
  146. package/src/icons/cpu-android.png +0 -0
  147. package/src/icons/cpu-android@2x.png +0 -0
  148. package/src/icons/cpu-android@3x.png +0 -0
  149. package/src/icons/cpu-ios.png +0 -0
  150. package/src/icons/cpu-ios@2x.png +0 -0
  151. package/src/icons/cpu-ios@3x.png +0 -0
  152. package/src/icons/lock-android.png +0 -0
  153. package/src/icons/lock-android@2x.png +0 -0
  154. package/src/icons/lock-android@3x.png +0 -0
  155. package/src/icons/lock-ios.png +0 -0
  156. package/src/icons/lock-ios@2x.png +0 -0
  157. package/src/icons/lock-ios@3x.png +0 -0
  158. package/src/icons/mic-off-android.png +0 -0
  159. package/src/icons/mic-off-android@2x.png +0 -0
  160. package/src/icons/mic-off-android@3x.png +0 -0
  161. package/src/icons/mic-slash-ios.png +0 -0
  162. package/src/icons/mic-slash-ios@2x.png +0 -0
  163. package/src/icons/mic-slash-ios@3x.png +0 -0
  164. package/src/icons/video-slash-ios.png +0 -0
  165. package/src/icons/video-slash-ios@2x.png +0 -0
  166. package/src/icons/video-slash-ios@3x.png +0 -0
  167. package/src/index.tsx +92 -6
  168. package/src/sdk/Bridge.ts +259 -0
  169. package/src/sdk/Event.ts +187 -0
  170. package/src/sdk/Lifecycle.ts +366 -0
  171. package/src/sdk/LiveVoiceSdk.ts +285 -309
  172. package/src/sdk/LiveVoiceState.ts +230 -60
  173. package/src/sdk/LogEntries.ts +88 -0
  174. package/src/sdk/Models.ts +129 -0
  175. package/src/{util/PlayingState.ts → sdk/NativeSdkVersions.ts} +7 -6
  176. package/src/sdk/Observables.ts +414 -0
  177. package/src/sdk/Passwords.ts +286 -0
  178. package/src/sdk/Playback.ts +30 -0
  179. package/src/specs/NativeLiveVoiceSdk.ts +42 -38
  180. package/src/util/Colors.ts +2 -1
  181. package/src/util/Translations.ts +34 -12
  182. package/src/util/freeze.ts +23 -0
  183. package/src/util/logger.ts +79 -52
  184. package/lib/module/components/AudioOutputSwitchView.js +0 -138
  185. package/lib/module/components/AudioOutputSwitchView.js.map +0 -1
  186. package/lib/module/components/index.js +0 -24
  187. package/lib/module/components/index.js.map +0 -1
  188. package/lib/module/icons/mic.png +0 -0
  189. package/lib/module/util/ForegroundServiceConfig.js +0 -38
  190. package/lib/module/util/ForegroundServiceConfig.js.map +0 -1
  191. package/lib/module/util/PlayingState.js.map +0 -1
  192. package/lib/module/util/UIState.js +0 -4
  193. package/lib/typescript/src/components/AudioOutputSwitchView.d.ts +0 -6
  194. package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +0 -1
  195. package/lib/typescript/src/components/index.d.ts +0 -9
  196. package/lib/typescript/src/components/index.d.ts.map +0 -1
  197. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts +0 -19
  198. package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +0 -1
  199. package/lib/typescript/src/util/PlayingState.d.ts +0 -7
  200. package/lib/typescript/src/util/PlayingState.d.ts.map +0 -1
  201. package/lib/typescript/src/util/UIState.d.ts +0 -86
  202. package/lib/typescript/src/util/UIState.d.ts.map +0 -1
  203. package/src/components/AudioOutputSwitchView.tsx +0 -146
  204. package/src/components/index.tsx +0 -21
  205. package/src/icons/mic.png +0 -0
  206. package/src/util/ForegroundServiceConfig.tsx +0 -42
  207. package/src/util/UIState.ts +0 -106
@@ -0,0 +1,298 @@
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
+ // The password round trips of the bridge (bridge.md 4.2, 4.3). Native looks up its memory and the
17
+ // host's store first; it asks here only for a password neither had. This module answers from the
18
+ // host's provider when one is set, otherwise from the built-in prompt of the most recently shown
19
+ // LiveVoiceView, otherwise it gives up. It never logs a password or a host exception's text.
20
+
21
+ import Native from "../specs/NativeLiveVoiceSdk.js";
22
+ import { writeLogEntry } from "../util/logger.js";
23
+
24
+ /** What a password is for, keyed by join code, since an event's id is unknown before joining. */
25
+
26
+ /** A password the SDK needs. `isRetry` is `true` after a rejected password in the same operation. */
27
+
28
+ /**
29
+ * Supplies a password, or `null` to give up. Giving up fails the call with `password_required`
30
+ * (for a channel `channel_password_required`), or after a rejected password with `wrong_password`
31
+ * (`channel_wrong_password`). A rejection or a thrown error gives up as well.
32
+ */
33
+
34
+ /**
35
+ * Keeps passwords between launches. The SDK loads one before asking for it, saves it once the
36
+ * server accepted it and removes it once the server rejected it. Calls for one subject complete in
37
+ * the order they were made. A failure is a cache miss; it never fails an operation.
38
+ */
39
+
40
+ /** A request waiting for the built-in prompt. `name` is its title when known. */
41
+
42
+ let provider = null;
43
+ let store = null;
44
+ let bridgeInitialized = false;
45
+
46
+ /** Requests already taken or cancelled: a snapshot delivering one again never reopens it. */
47
+ const seen = new Set();
48
+ const cancelled = new Set();
49
+ /** Requests for the built-in prompt, oldest first; the first one is shown. */
50
+ const queue = [];
51
+
52
+ /** Views that can present the prompt, in the order they were shown; the last one presents. */
53
+ const presenters = [];
54
+ let nextPresenter = 1;
55
+ const promptListeners = new Set();
56
+
57
+ /**
58
+ * Sets the provider every later password request asks, or `null` for the built-in prompt. It can
59
+ * be set before `initialize()`. The built-in prompt needs a `LiveVoiceView` on screen: without a
60
+ * provider and without a view, a request gives up and its call fails with the password error.
61
+ */
62
+ export function setPasswordProvider(newProvider) {
63
+ provider = typeof newProvider === 'function' ? newProvider : null;
64
+ }
65
+
66
+ /**
67
+ * Sets the store the SDK loads passwords from and saves them to, or `null` for none. It can be set
68
+ * before `initialize()`.
69
+ */
70
+ export function setPasswordStore(newStore) {
71
+ store = newStore != null && typeof newStore === 'object' ? newStore : null;
72
+ if (bridgeInitialized) Native.setPasswordStore(JSON.stringify({
73
+ isSet: store !== null
74
+ }));
75
+ }
76
+
77
+ /** Whether a store is set, for `initialize`'s configuration. */
78
+ export function hasPasswordStore() {
79
+ return store !== null;
80
+ }
81
+
82
+ /** `initialize` delivered its configuration; later store changes go to native at once. */
83
+ export function bridgeDidInitialize() {
84
+ bridgeInitialized = true;
85
+ }
86
+
87
+ /** `onPasswordRequest` and the snapshot's waiting requests. Each id is answered once. */
88
+ export function receivePasswordRequest(wire) {
89
+ const request = promptRequest(wire);
90
+ if (request === undefined || seen.has(request.requestId) || cancelled.has(request.requestId)) return;
91
+ seen.add(request.requestId);
92
+ const host = provider;
93
+ if (host !== null) {
94
+ const publicRequest = Object.freeze({
95
+ subject: Object.freeze({
96
+ ...request.subject
97
+ }),
98
+ isRetry: request.isRetry
99
+ });
100
+ let answer;
101
+ try {
102
+ answer = Promise.resolve(host(publicRequest));
103
+ } catch {
104
+ answerPasswordRequest(request.requestId, null, true);
105
+ return;
106
+ }
107
+ answer.then(password => answerPasswordRequest(request.requestId, typeof password === 'string' ? password : null), () => answerPasswordRequest(request.requestId, null, true));
108
+ return;
109
+ }
110
+ if (presenters.length === 0) {
111
+ // No view on screen to ask: give up with the password error.
112
+ logPrompt(request, 'noView');
113
+ answerPasswordRequest(request.requestId, null);
114
+ return;
115
+ }
116
+ queue.push(request);
117
+ notifyPrompt();
118
+ }
119
+
120
+ /** `onPasswordRequestCancelled`: the operation ended without the password. */
121
+ export function receivePasswordRequestCancellation(wire) {
122
+ const requestId = record(wire) && typeof wire.requestId === 'string' ? wire.requestId : undefined;
123
+ if (requestId === undefined) return;
124
+ cancelled.add(requestId);
125
+ const index = queue.findIndex(request => request.requestId === requestId);
126
+ if (index >= 0) {
127
+ const [dismissed] = queue.splice(index, 1);
128
+ logPrompt(dismissed, 'dismissed');
129
+ notifyPrompt();
130
+ }
131
+ }
132
+
133
+ /** `onPasswordStoreRequest`: calls the host's store and answers once its call has finished. */
134
+ export function receivePasswordStoreRequest(wire) {
135
+ if (!record(wire) || typeof wire.requestId !== 'string') return;
136
+ const requestId = wire.requestId;
137
+ const subject = passwordSubject(wire.subject);
138
+ const host = store;
139
+ if (subject === undefined || host === null) {
140
+ answerStoreRequest(requestId, false);
141
+ return;
142
+ }
143
+ const frozenSubject = Object.freeze(subject);
144
+ let call;
145
+ try {
146
+ switch (wire.operation) {
147
+ case 'load':
148
+ call = Promise.resolve(host.load(frozenSubject)).then(password => {
149
+ answerStoreRequest(requestId, true, typeof password === 'string' ? password : null);
150
+ });
151
+ break;
152
+ case 'save':
153
+ if (typeof wire.password !== 'string') {
154
+ answerStoreRequest(requestId, false);
155
+ return;
156
+ }
157
+ call = Promise.resolve(host.save(frozenSubject, wire.password)).then(() => answerStoreRequest(requestId, true));
158
+ break;
159
+ case 'remove':
160
+ call = Promise.resolve(host.remove(frozenSubject)).then(() => answerStoreRequest(requestId, true));
161
+ break;
162
+ default:
163
+ answerStoreRequest(requestId, false);
164
+ return;
165
+ }
166
+ } catch {
167
+ answerStoreRequest(requestId, false);
168
+ return;
169
+ }
170
+ // Native logs a failure without credentials; a failed load is a cache miss.
171
+ call.catch(() => answerStoreRequest(requestId, false));
172
+ }
173
+
174
+ // MARK: The built-in prompt
175
+
176
+ /** A view that can present the prompt. The most recently registered one still mounted presents. */
177
+ export function registerPresenter() {
178
+ const id = nextPresenter++;
179
+ presenters.push(id);
180
+ notifyPrompt();
181
+ return id;
182
+ }
183
+
184
+ /**
185
+ * The view went away. If it was presenting, its request gives up with the password error; with no
186
+ * view left, every waiting request does.
187
+ */
188
+ export function unregisterPresenter(id) {
189
+ const index = presenters.indexOf(id);
190
+ if (index < 0) return;
191
+ const wasPresenting = index === presenters.length - 1;
192
+ presenters.splice(index, 1);
193
+ if (wasPresenting && queue.length > 0) {
194
+ const shown = queue.shift();
195
+ logPrompt(shown, 'dismissed');
196
+ answerPasswordRequest(shown.requestId, null);
197
+ }
198
+ if (presenters.length === 0) {
199
+ for (const request of queue.splice(0)) {
200
+ logPrompt(request, 'noView');
201
+ answerPasswordRequest(request.requestId, null);
202
+ }
203
+ }
204
+ notifyPrompt();
205
+ }
206
+
207
+ /** The request `presenter` shows now, or `null`. */
208
+ export function promptFor(presenter) {
209
+ if (presenters[presenters.length - 1] !== presenter) return null;
210
+ return queue[0] ?? null;
211
+ }
212
+
213
+ /** Calls `listener` whenever the shown prompt or its presenter changes. */
214
+ export function observePrompt(listener) {
215
+ promptListeners.add(listener);
216
+ return () => {
217
+ promptListeners.delete(listener);
218
+ };
219
+ }
220
+
221
+ /** The prompt's answer: a password, or `null` for Cancel. */
222
+ export function answerPrompt(requestId, password) {
223
+ const index = queue.findIndex(request => request.requestId === requestId);
224
+ if (index < 0) return;
225
+ const [answered] = queue.splice(index, 1);
226
+ logPrompt(answered, password === null ? 'cancelled' : 'entered');
227
+ answerPasswordRequest(requestId, password);
228
+ notifyPrompt();
229
+ }
230
+
231
+ /** How the built-in prompt ended (bridge.md 3.6); never with the password. */
232
+ function logPrompt(request, result) {
233
+ writeLogEntry('LV_PASSWORD_PROMPT', 'info', {
234
+ subject: request.subject.kind,
235
+ result,
236
+ isRetry: String(request.isRetry)
237
+ });
238
+ }
239
+ function notifyPrompt() {
240
+ for (const listener of [...promptListeners]) {
241
+ try {
242
+ listener();
243
+ } catch {/* A view's update must not stop the others. */}
244
+ }
245
+ }
246
+
247
+ // MARK: Wire
248
+
249
+ function answerPasswordRequest(requestId, password, failed = false) {
250
+ Native.answerPasswordRequest(JSON.stringify(failed ? {
251
+ requestId,
252
+ password: null,
253
+ failed: true
254
+ } : {
255
+ requestId,
256
+ password
257
+ }));
258
+ }
259
+ function answerStoreRequest(requestId, ok, password) {
260
+ Native.answerPasswordStoreRequest(JSON.stringify(ok && password !== undefined ? {
261
+ requestId,
262
+ ok,
263
+ password
264
+ } : {
265
+ requestId,
266
+ ok
267
+ }));
268
+ }
269
+ function promptRequest(wire) {
270
+ if (!record(wire) || typeof wire.requestId !== 'string') return undefined;
271
+ const subject = passwordSubject(wire.subject);
272
+ if (subject === undefined) return undefined;
273
+ return {
274
+ requestId: wire.requestId,
275
+ subject,
276
+ isRetry: wire.isRetry === true,
277
+ name: typeof wire.name === 'string' && wire.name !== '' ? wire.name : null
278
+ };
279
+ }
280
+ function passwordSubject(wire) {
281
+ if (!record(wire) || typeof wire.joinCode !== 'string') return undefined;
282
+ if (wire.kind === 'event') return {
283
+ kind: 'event',
284
+ joinCode: wire.joinCode
285
+ };
286
+ if (wire.kind === 'channel' && typeof wire.channelId === 'number') {
287
+ return {
288
+ kind: 'channel',
289
+ joinCode: wire.joinCode,
290
+ channelId: wire.channelId
291
+ };
292
+ }
293
+ return undefined;
294
+ }
295
+ function record(value) {
296
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
297
+ }
298
+ //# sourceMappingURL=Passwords.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Native","writeLogEntry","provider","store","bridgeInitialized","seen","Set","cancelled","queue","presenters","nextPresenter","promptListeners","setPasswordProvider","newProvider","setPasswordStore","newStore","JSON","stringify","isSet","hasPasswordStore","bridgeDidInitialize","receivePasswordRequest","wire","request","promptRequest","undefined","has","requestId","add","host","publicRequest","Object","freeze","subject","isRetry","answer","Promise","resolve","answerPasswordRequest","then","password","length","logPrompt","push","notifyPrompt","receivePasswordRequestCancellation","record","index","findIndex","dismissed","splice","receivePasswordStoreRequest","passwordSubject","answerStoreRequest","frozenSubject","call","operation","load","save","remove","catch","registerPresenter","id","unregisterPresenter","indexOf","wasPresenting","shown","shift","promptFor","presenter","observePrompt","listener","delete","answerPrompt","answered","result","kind","String","failed","ok","answerPasswordStoreRequest","name","joinCode","channelId","value","Array","isArray"],"sourceRoot":"../../../src","sources":["sdk/Passwords.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,OAAOA,MAAM,MAAM,gCAA6B;AAChD,SAASC,aAAa,QAAQ,mBAAgB;;AAE9C;;AAKA;;AAMA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAOA;;AAQA,IAAIC,QAA0C,GAAG,IAAI;AACrD,IAAIC,KAAoC,GAAG,IAAI;AAC/C,IAAIC,iBAAiB,GAAG,KAAK;;AAE7B;AACA,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAS,CAAC;AAC9B,MAAMC,SAAS,GAAG,IAAID,GAAG,CAAS,CAAC;AACnC;AACA,MAAME,KAAsB,GAAG,EAAE;;AAEjC;AACA,MAAMC,UAAoB,GAAG,EAAE;AAC/B,IAAIC,aAAa,GAAG,CAAC;AACrB,MAAMC,eAAe,GAAG,IAAIL,GAAG,CAAa,CAAC;;AAE7C;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,mBAAmBA,CAACC,WAA6C,EAAQ;EACvFX,QAAQ,GAAG,OAAOW,WAAW,KAAK,UAAU,GAAGA,WAAW,GAAG,IAAI;AACnE;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,QAAuC,EAAQ;EAC9EZ,KAAK,GAAGY,QAAQ,IAAI,IAAI,IAAI,OAAOA,QAAQ,KAAK,QAAQ,GAAGA,QAAQ,GAAG,IAAI;EAC1E,IAAIX,iBAAiB,EAAEJ,MAAM,CAACc,gBAAgB,CAACE,IAAI,CAACC,SAAS,CAAC;IAAEC,KAAK,EAAEf,KAAK,KAAK;EAAK,CAAC,CAAC,CAAC;AAC3F;;AAEA;AACA,OAAO,SAASgB,gBAAgBA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,OAAOtD,IAAI,CAAC6D,SAAS,KAAK,QAAQ,EAAE;IACjE,OAAO;MAAEP,IAAI,EAAE,SAAS;MAAEM,QAAQ,EAAE5D,IAAI,CAAC4D,QAAQ;MAAEC,SAAS,EAAE7D,IAAI,CAAC6D;IAAU,CAAC;EAChF;EACA,OAAO1D,SAAS;AAClB;AAEA,SAASqB,MAAMA,CAACsC,KAAc,EAAoC;EAChE,OAAOA,KAAK,KAAK,IAAI,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC;AAC7E","ignoreList":[]}
@@ -0,0 +1,35 @@
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
+ // Internal: the action of a channel cell, the wrapper's only playback start. It is not exported
17
+ // from the package entry point; only `LiveVoiceView` calls it, for its default cells and for the
18
+ // `LiveVoiceChannelCell` objects it hands to `renderChannelCell`.
19
+
20
+ import { channelId as validateChannelId, invoke } from "./Lifecycle.js";
21
+
22
+ /** Which kind of cell acts: native checks the custom-UI permission again for `custom`. */
23
+
24
+ /**
25
+ * Starts the channel if it is stopped, stops it if it is playing, as native decides from the
26
+ * current playback state at admission (bridge.md 3.3). Resolves once the channel plays or has
27
+ * stopped; rejects with the native error otherwise.
28
+ */
29
+ export async function togglePlayback(channelId, cell) {
30
+ await invoke('togglePlayback', {
31
+ channelId: validateChannelId(channelId, 'togglePlayback'),
32
+ cell
33
+ });
34
+ }
35
+ //# sourceMappingURL=Playback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["channelId","validateChannelId","invoke","togglePlayback","cell"],"sourceRoot":"../../../src","sources":["sdk/Playback.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAASA,SAAS,IAAIC,iBAAiB,EAAEC,MAAM,QAAQ,gBAAa;;AAEpE;;AAGA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,cAAcA,CAACH,SAAiB,EAAEI,IAAc,EAAiB;EACrF,MAAMF,MAAM,CAAC,gBAAgB,EAAE;IAAEF,SAAS,EAAEC,iBAAiB,CAACD,SAAS,EAAE,gBAAgB,CAAC;IAAEI;EAAK,CAAC,CAAC;AACrG","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["specs/NativeLiveVoiceSdk.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAA6C,cAAc;;AAEvF;AACA;;AAoEA,eAAeA,mBAAmB,CAACC,YAAY,CAAO,iBAAiB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../../src","sources":["specs/NativeLiveVoiceSdk.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAA6C,cAAc;;AAEvF;AACA;;AAwEA,eAAeA,mBAAmB,CAACC,YAAY,CAAO,iBAAiB,CAAC","ignoreList":[]}
@@ -18,7 +18,8 @@ export const COLORS = {
18
18
  bg: '#F5F5F5',
19
19
  bgDark: '#1E1F23',
20
20
  cardBg: '#fff',
21
- cardBgDark: '#212429',
21
+ // Both native SDK views' dark background (Android `veryDarkGray`).
22
+ cardBgDark: '#212529',
22
23
  divider: '#f0f0f0',
23
24
  dividerDark: '#333333',
24
25
  white: '#fff',
@@ -1 +1 @@
1
- {"version":3,"names":["COLORS","primary","bg","bgDark","cardBg","cardBgDark","divider","dividerDark","white","black","gray"],"sourceRoot":"../../../src","sources":["util/Colors.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,MAAM,GAAG;EACpBC,OAAO,EAAE,SAAS;EAElBC,EAAE,EAAE,SAAS;EACbC,MAAM,EAAE,SAAS;EAEjBC,MAAM,EAAE,MAAM;EACdC,UAAU,EAAE,SAAS;EAErBC,OAAO,EAAE,SAAS;EAClBC,WAAW,EAAE,SAAS;EAEtBC,KAAK,EAAE,MAAM;EACbC,KAAK,EAAE,SAAS;EAChBC,IAAI,EAAE,SAAS;EAEf,UAAU,EAAE;AACd,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["COLORS","primary","bg","bgDark","cardBg","cardBgDark","divider","dividerDark","white","black","gray"],"sourceRoot":"../../../src","sources":["util/Colors.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,MAAM,GAAG;EACpBC,OAAO,EAAE,SAAS;EAElBC,EAAE,EAAE,SAAS;EACbC,MAAM,EAAE,SAAS;EAEjBC,MAAM,EAAE,MAAM;EACd;EACAC,UAAU,EAAE,SAAS;EAErBC,OAAO,EAAE,SAAS;EAClBC,WAAW,EAAE,SAAS;EAEtBC,KAAK,EAAE,MAAM;EACbC,KAAK,EAAE,SAAS;EAChBC,IAAI,EAAE,SAAS;EAEf,UAAU,EAAE;AACd,CAAC","ignoreList":[]}
@@ -14,30 +14,53 @@
14
14
  //===----------------------------------------------------------------------===//
15
15
 
16
16
  /**
17
- * @fileoverview Translated strings for the React Native SDK.
18
- * These methods will return a translated string for the current locale.
19
- * German, English, and Spanish are supported at this time.
17
+ * @fileoverview The native SDK's texts: the public `Translations` of the default view, and the
18
+ * built-in password prompt's own texts, which stay internal.
20
19
  */
21
20
  import LiveVoiceSdkReactNative from "../specs/NativeLiveVoiceSdk.js";
21
+
22
+ /**
23
+ * Localized strings the SDK uses for its default UI, in the device's language (English, German and
24
+ * Spanish).
25
+ *
26
+ * Reuse them in your own parts, such as a custom channel cell, so your UI matches the SDK's
27
+ * wording. Each call reads the text synchronously from the native SDK and needs no join. Error
28
+ * texts are not here: every error carries its own `message`.
29
+ */
22
30
  export const Translations = {
31
+ /** "Inactive": a channel without a speaker. */
23
32
  channelStatusOffline: () => LiveVoiceSdkReactNative.channelStatusOffline(),
33
+ /** "This event currently has no channels visible for listeners." */
24
34
  noChannels: () => LiveVoiceSdkReactNative.noChannels(),
35
+ /** "AI active": a channel whose speaker is an AI voice. */
25
36
  isAiChannelStatusMessage: () => LiveVoiceSdkReactNative.isAiChannelStatusMessage(),
37
+ /** "No matching channels": a channel filter that leaves none. */
26
38
  sdkNoMatchingChannels: () => LiveVoiceSdkReactNative.sdkNoMatchingChannels(),
39
+ /** "Attempting to reconnect…" */
27
40
  errorScreenRetrying: () => LiveVoiceSdkReactNative.errorScreenRetrying(),
41
+ /** "Reconnecting in `seconds` seconds…" */
28
42
  errorScreenRetryingIn: seconds => LiveVoiceSdkReactNative.errorScreenRetryingIn(seconds),
29
- sdkErrorGeneric: () => LiveVoiceSdkReactNative.sdkErrorGeneric(),
30
- sdkErrorInactive: () => LiveVoiceSdkReactNative.sdkErrorInactive(),
31
- sdkErrorInvalidApiKey: () => LiveVoiceSdkReactNative.sdkErrorInvalidApiKey(),
32
- sdkErrorListenerLimitReached: () => LiveVoiceSdkReactNative.sdkErrorListenerLimitReached(),
33
- sdkErrorNoNetwork: () => LiveVoiceSdkReactNative.sdkErrorNoNetwork(),
34
- sdkErrorNotFound: () => LiveVoiceSdkReactNative.sdkErrorNotFound(),
35
- sdkErrorRequestFailed: errorCode => LiveVoiceSdkReactNative.sdkErrorRequestFailed(errorCode),
36
- sdkErrorWrongPassword: () => LiveVoiceSdkReactNative.sdkErrorWrongPassword(),
43
+ /** "Retry now" */
37
44
  errorRetryNowButton: () => LiveVoiceSdkReactNative.errorRetryNowButton(),
45
+ /** "Live Audio Streaming by", before the LiveVoice logo. */
38
46
  streamingByTitle: () => LiveVoiceSdkReactNative.streamingByTitle(),
47
+ /** "Play channel", the accessibility label of a channel's play button. */
39
48
  accessibilityChannelPlay: () => LiveVoiceSdkReactNative.accessibilityChannelPlay(),
49
+ /** "Muted by speaker" */
40
50
  accessibilityChannelStatusMuted: () => LiveVoiceSdkReactNative.accessibilityChannelStatusMuted(),
51
+ /** "Stop channel", the accessibility label of a channel's stop button. */
41
52
  accessibilityChannelStop: () => LiveVoiceSdkReactNative.accessibilityChannelStop()
42
53
  };
54
+
55
+ /** Internal: the built-in password prompt's texts. Its title is the channel's or event's name when known. */
56
+ export const PasswordPromptTexts = {
57
+ title: () => LiveVoiceSdkReactNative.passwordPromptTitle(),
58
+ channelMessage: () => LiveVoiceSdkReactNative.passwordPromptChannelMessage(),
59
+ eventMessage: () => LiveVoiceSdkReactNative.passwordPromptEventMessage(),
60
+ wrongPassword: () => LiveVoiceSdkReactNative.passwordPromptWrongPassword(),
61
+ field: () => LiveVoiceSdkReactNative.passwordPromptField(),
62
+ cancelButton: () => LiveVoiceSdkReactNative.passwordPromptCancelButton(),
63
+ channelConfirmButton: () => LiveVoiceSdkReactNative.passwordPromptChannelConfirmButton(),
64
+ eventConfirmButton: () => LiveVoiceSdkReactNative.passwordPromptEventConfirmButton()
65
+ };
43
66
  //# sourceMappingURL=Translations.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["LiveVoiceSdkReactNative","Translations","channelStatusOffline","noChannels","isAiChannelStatusMessage","sdkNoMatchingChannels","errorScreenRetrying","errorScreenRetryingIn","seconds","sdkErrorGeneric","sdkErrorInactive","sdkErrorInvalidApiKey","sdkErrorListenerLimitReached","sdkErrorNoNetwork","sdkErrorNotFound","sdkErrorRequestFailed","errorCode","sdkErrorWrongPassword","errorRetryNowButton","streamingByTitle","accessibilityChannelPlay","accessibilityChannelStatusMuted","accessibilityChannelStop"],"sourceRoot":"../../../src","sources":["util/Translations.ts"],"mappings":";;AAA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;EAChFC,gBAAgB,EAAEA,CAAA,KAAcnB,uBAAuB,CAACmB,gBAAgB,CAAC,CAAC;EAC1EC,wBAAwB,EAAEA,CAAA,KAAcpB,uBAAuB,CAACoB,wBAAwB,CAAC,CAAC;EAC1FC,+BAA+B,EAAEA,CAAA,KAAcrB,uBAAuB,CAACqB,+BAA+B,CAAC,CAAC;EACxGC,wBAAwB,EAAEA,CAAA,KAActB,uBAAuB,CAACsB,wBAAwB,CAAC;AAC3F,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["LiveVoiceSdkReactNative","Translations","channelStatusOffline","noChannels","isAiChannelStatusMessage","sdkNoMatchingChannels","errorScreenRetrying","errorScreenRetryingIn","seconds","errorRetryNowButton","streamingByTitle","accessibilityChannelPlay","accessibilityChannelStatusMuted","accessibilityChannelStop","PasswordPromptTexts","title","passwordPromptTitle","channelMessage","passwordPromptChannelMessage","eventMessage","passwordPromptEventMessage","wrongPassword","passwordPromptWrongPassword","field","passwordPromptField","cancelButton","passwordPromptCancelButton","channelConfirmButton","passwordPromptChannelConfirmButton","eventConfirmButton","passwordPromptEventConfirmButton"],"sourceRoot":"../../../src","sources":["util/Translations.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAOA,uBAAuB,MAAM,gCAA6B;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAG;EAC1B;EACAC,oBAAoB,EAAEA,CAAA,KAAcF,uBAAuB,CAACE,oBAAoB,CAAC,CAAC;EAClF;EACAC,UAAU,EAAEA,CAAA,KAAcH,uBAAuB,CAACG,UAAU,CAAC,CAAC;EAC9D;EACAC,wBAAwB,EAAEA,CAAA,KAAcJ,uBAAuB,CAACI,wBAAwB,CAAC,CAAC;EAC1F;EACAC,qBAAqB,EAAEA,CAAA,KAAcL,uBAAuB,CAACK,qBAAqB,CAAC,CAAC;EACpF;EACAC,mBAAmB,EAAEA,CAAA,KAAcN,uBAAuB,CAACM,mBAAmB,CAAC,CAAC;EAChF;EACAC,qBAAqB,EAAGC,OAAe,IAAaR,uBAAuB,CAACO,qBAAqB,CAACC,OAAO,CAAC;EAC1G;EACAC,mBAAmB,EAAEA,CAAA,KAAcT,uBAAuB,CAACS,mBAAmB,CAAC,CAAC;EAChF;EACAC,gBAAgB,EAAEA,CAAA,KAAcV,uBAAuB,CAACU,gBAAgB,CAAC,CAAC;EAC1E;EACAC,wBAAwB,EAAEA,CAAA,KAAcX,uBAAuB,CAACW,wBAAwB,CAAC,CAAC;EAC1F;EACAC,+BAA+B,EAAEA,CAAA,KAAcZ,uBAAuB,CAACY,+BAA+B,CAAC,CAAC;EACxG;EACAC,wBAAwB,EAAEA,CAAA,KAAcb,uBAAuB,CAACa,wBAAwB,CAAC;AAC3F,CAAC;;AAED;AACA,OAAO,MAAMC,mBAAmB,GAAG;EACjCC,KAAK,EAAEA,CAAA,KAAcf,uBAAuB,CAACgB,mBAAmB,CAAC,CAAC;EAClEC,cAAc,EAAEA,CAAA,KAAcjB,uBAAuB,CAACkB,4BAA4B,CAAC,CAAC;EACpFC,YAAY,EAAEA,CAAA,KAAcnB,uBAAuB,CAACoB,0BAA0B,CAAC,CAAC;EAChFC,aAAa,EAAEA,CAAA,KAAcrB,uBAAuB,CAACsB,2BAA2B,CAAC,CAAC;EAClFC,KAAK,EAAEA,CAAA,KAAcvB,uBAAuB,CAACwB,mBAAmB,CAAC,CAAC;EAClEC,YAAY,EAAEA,CAAA,KAAczB,uBAAuB,CAAC0B,0BAA0B,CAAC,CAAC;EAChFC,oBAAoB,EAAEA,CAAA,KAAc3B,uBAAuB,CAAC4B,kCAAkC,CAAC,CAAC;EAChGC,kBAAkB,EAAEA,CAAA,KAAc7B,uBAAuB,CAAC8B,gCAAgC,CAAC;AAC7F,CAAC","ignoreList":[]}
@@ -0,0 +1,26 @@
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
+ /**
17
+ * Freezes `value` and every plain object and array inside it, so a host cannot change what the
18
+ * SDK handed out. `Date`s and errors are left as they are.
19
+ */
20
+ export function deepFreeze(value) {
21
+ if (value === null || typeof value !== 'object' || Object.isFrozen(value)) return value;
22
+ if (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype) return value;
23
+ for (const nested of Object.values(value)) deepFreeze(nested);
24
+ return Object.freeze(value);
25
+ }
26
+ //# sourceMappingURL=freeze.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["deepFreeze","value","Object","isFrozen","Array","isArray","getPrototypeOf","prototype","nested","values","freeze"],"sourceRoot":"../../../src","sources":["util/freeze.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASA,UAAUA,CAAIC,KAAQ,EAAK;EACzC,IAAIA,KAAK,KAAK,IAAI,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIC,MAAM,CAACC,QAAQ,CAACF,KAAK,CAAC,EAAE,OAAOA,KAAK;EACvF,IAAI,CAACG,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,IAAIC,MAAM,CAACI,cAAc,CAACL,KAAK,CAAC,KAAKC,MAAM,CAACK,SAAS,EAAE,OAAON,KAAK;EAC5F,KAAK,MAAMO,MAAM,IAAIN,MAAM,CAACO,MAAM,CAACR,KAAe,CAAC,EAAED,UAAU,CAACQ,MAAM,CAAC;EACvE,OAAON,MAAM,CAACQ,MAAM,CAACT,KAAK,CAAC;AAC7B","ignoreList":[]}
@@ -13,64 +13,102 @@
13
13
  //
14
14
  //===----------------------------------------------------------------------===//
15
15
 
16
+ // Internal: the wrapper's two outputs. Its own entries go through native into the one SDK log
17
+ // stream (`writeLogEntry`, bridge.md 3.6), which reaches the system log and `addLogListener`.
18
+ // Console lines are for development builds only. Neither ever carries a credential: the API key
19
+ // or a password. The join code is not one and may appear.
20
+
21
+ import Native from "../specs/NativeLiveVoiceSdk.js";
22
+ /** The console tags of development builds. They are not entries of the SDK log. */
16
23
  export const LiveVoiceLogEvent = {
17
- init: "LV_INIT",
18
- joinRequest: "LV_JOIN_REQUEST",
19
- leave: "LV_LEAVE",
20
- reconnectRequest: "LV_RECONNECT_REQUEST",
21
- uiState: "LV_UI_STATE",
22
- audioOutputSet: "LV_AUDIO_OUTPUT_SET",
23
- audioOutputChanged: "LV_AUDIO_OUTPUT_CHANGED",
24
- channelStart: "LV_CHANNEL_START",
25
- channelStop: "LV_CHANNEL_STOP",
26
- subtitlesStart: "LV_SUBTITLES_START",
27
- subtitlesStop: "LV_SUBTITLES_STOP",
28
- openWebsite: "LV_OPEN_WEBSITE"
24
+ init: 'LV_INIT',
25
+ joinRequest: 'LV_JOIN_REQUEST',
26
+ leave: 'LV_LEAVE',
27
+ reconnectRequest: 'LV_RECONNECT_REQUEST',
28
+ uiState: 'LV_UI_STATE',
29
+ audioOutputSet: 'LV_AUDIO_OUTPUT_SET',
30
+ nowPlayingArtworkSet: 'LV_NOW_PLAYING_ARTWORK_SET',
31
+ channelStop: 'LV_CHANNEL_STOP',
32
+ subtitlesStart: 'LV_SUBTITLES_START',
33
+ subtitlesStop: 'LV_SUBTITLES_STOP',
34
+ openWebsite: 'LV_OPEN_WEBSITE'
29
35
  };
36
+
37
+ /** The entries the wrapper writes into the SDK log itself (bridge.md 3.6). */
38
+
39
+ /** Whether this is a development build, where the wrapper may write to the console. */
40
+ function isDevelopment() {
41
+ return typeof __DEV__ !== 'undefined' && __DEV__ === true;
42
+ }
43
+
44
+ /** A console line in development builds; nothing otherwise. */
30
45
  export function logInfo(event, fields) {
31
- console.info(formatMessage("INFO", event, fields));
46
+ if (!isDevelopment()) return;
47
+ console.info(formatMessage('INFO', event, fields));
32
48
  }
33
- export function logUiState(state) {
34
- logInfo(LiveVoiceLogEvent.uiState, describeUiState(state));
49
+
50
+ /** A host callback threw: reported on the console in development builds only, never in the log. */
51
+ export function logListenerError(event, error) {
52
+ if (!isDevelopment()) return;
53
+ console.warn(`[LiveVoiceSDK] ${event}`, error);
35
54
  }
36
- export function logAudioOutputChanged(useSpeaker) {
37
- logInfo(LiveVoiceLogEvent.audioOutputChanged, {
38
- mode: useSpeaker ? "speaker" : "receiver"
39
- });
55
+ export function logViewState(model) {
56
+ logInfo(LiveVoiceLogEvent.uiState, describeViewState(model));
40
57
  }
41
- export function describeForegroundServiceConfig(serviceConfig) {
42
- if (serviceConfig.type === "Disabled") return "disabled";
43
- return serviceConfig.message == null ? "default" : "custom";
58
+
59
+ /**
60
+ * Writes one of the wrapper's own entries into the SDK log, where it reaches the system log and
61
+ * the log listeners like a native entry. Fields without a value are left out. Callers never pass
62
+ * a credential.
63
+ */
64
+ export function writeLogEntry(event, level, fields) {
65
+ const values = {};
66
+ for (const [key, value] of Object.entries(fields)) {
67
+ if (value !== undefined) values[key] = value;
68
+ }
69
+ try {
70
+ Native.writeLogEntry(JSON.stringify({
71
+ event,
72
+ level,
73
+ fields: values
74
+ }));
75
+ } catch {/* Logging never fails a call. */}
76
+ }
77
+
78
+ /** Native sent something the wrapper cannot read: a bug, since the versions match exactly. */
79
+ export function logDecodeError(what, name) {
80
+ writeLogEntry('LV_BRIDGE_DECODE_ERROR', 'error', {
81
+ what,
82
+ name
83
+ });
44
84
  }
45
- function describeUiState(state) {
46
- switch (state.type) {
47
- case "loading":
85
+ function describeViewState(model) {
86
+ const part = model.part;
87
+ switch (part.kind) {
88
+ case 'loading':
48
89
  return {
49
- type: "loading"
90
+ type: 'loading'
50
91
  };
51
- case "ready":
92
+ case 'ready':
52
93
  return {
53
- channelCount: state.channels.length,
54
- outputMode: state.outputMode,
55
- type: "ready"
94
+ channelCount: part.channels.length,
95
+ inReconnectGrace: part.inReconnectGrace,
96
+ type: 'ready'
56
97
  };
57
- case "error":
98
+ case 'error':
58
99
  return {
59
- canBeRetried: state.canBeRetried,
60
- type: "error"
100
+ code: part.error.code,
101
+ type: 'error'
61
102
  };
62
- case "reconnecting":
103
+ case 'reconnecting':
63
104
  return {
64
- retryState: describeRetryState(state.state),
65
- type: "reconnecting"
105
+ retryState: part.retry.kind,
106
+ type: 'reconnecting'
66
107
  };
67
108
  }
68
109
  }
69
- function describeRetryState(state) {
70
- return state.type;
71
- }
72
110
  function formatMessage(level, event, fields) {
73
- const fieldText = fields == null ? "" : Object.entries(fields).filter(([, value]) => value != null).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => `${key}=${value}`).join(" ");
74
- return ["[LiveVoiceSDK]", level, event, fieldText].filter(part => part.length > 0).join(" ");
111
+ const fieldText = fields == null ? '' : Object.entries(fields).filter(([, value]) => value != null).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => `${key}=${value}`).join(' ');
112
+ return ['[LiveVoiceSDK]', level, event, fieldText].filter(part => part.length > 0).join(' ');
75
113
  }
76
114
  //# sourceMappingURL=logger.js.map