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.
- package/README.md +105 -66
- package/android/build.gradle +5 -4
- package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +122 -188
- package/android/src/main/java/io/livevoice/react/__SDK.kt +2 -2
- package/ios/LiveVoiceRNBridge.swift +362 -0
- package/ios/LiveVoiceSdkReactNative.mm +187 -158
- package/ios/__SDK.h +1 -1
- package/ios/livevoice_spm_backport.rb +202 -0
- package/lib/module/components/BrandingView.js +58 -39
- package/lib/module/components/BrandingView.js.map +1 -1
- package/lib/module/components/ChannelView.js +355 -44
- package/lib/module/components/ChannelView.js.map +1 -1
- package/lib/module/components/ErrorView.js +5 -6
- package/lib/module/components/ErrorView.js.map +1 -1
- package/lib/module/components/LiveVoiceSpinner.js +81 -0
- package/lib/module/components/LiveVoiceSpinner.js.map +1 -0
- package/lib/module/components/LiveVoiceView.js +311 -133
- package/lib/module/components/LiveVoiceView.js.map +1 -1
- package/lib/module/components/PasswordPrompt.js +165 -0
- package/lib/module/components/PasswordPrompt.js.map +1 -0
- package/lib/module/components/PlayButtonView.js +180 -244
- package/lib/module/components/PlayButtonView.js.map +1 -1
- package/lib/module/components/ReconnectingView.js +31 -53
- package/lib/module/components/ReconnectingView.js.map +1 -1
- package/lib/module/icons/branding-ios.png +0 -0
- package/lib/module/icons/camera-off-android.png +0 -0
- package/lib/module/icons/camera-off-android@2x.png +0 -0
- package/lib/module/icons/camera-off-android@3x.png +0 -0
- package/lib/module/icons/cpu-android.png +0 -0
- package/lib/module/icons/cpu-android@2x.png +0 -0
- package/lib/module/icons/cpu-android@3x.png +0 -0
- package/lib/module/icons/cpu-ios.png +0 -0
- package/lib/module/icons/cpu-ios@2x.png +0 -0
- package/lib/module/icons/cpu-ios@3x.png +0 -0
- package/lib/module/icons/lock-android.png +0 -0
- package/lib/module/icons/lock-android@2x.png +0 -0
- package/lib/module/icons/lock-android@3x.png +0 -0
- package/lib/module/icons/lock-ios.png +0 -0
- package/lib/module/icons/lock-ios@2x.png +0 -0
- package/lib/module/icons/lock-ios@3x.png +0 -0
- package/lib/module/icons/mic-off-android.png +0 -0
- package/lib/module/icons/mic-off-android@2x.png +0 -0
- package/lib/module/icons/mic-off-android@3x.png +0 -0
- package/lib/module/icons/mic-slash-ios.png +0 -0
- package/lib/module/icons/mic-slash-ios@2x.png +0 -0
- package/lib/module/icons/mic-slash-ios@3x.png +0 -0
- package/lib/module/icons/video-slash-ios.png +0 -0
- package/lib/module/icons/video-slash-ios@2x.png +0 -0
- package/lib/module/icons/video-slash-ios@3x.png +0 -0
- package/lib/module/index.js +11 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/sdk/Bridge.js +236 -0
- package/lib/module/sdk/Bridge.js.map +1 -0
- package/lib/module/sdk/Event.js +160 -0
- package/lib/module/sdk/Event.js.map +1 -0
- package/lib/module/sdk/Lifecycle.js +331 -0
- package/lib/module/sdk/Lifecycle.js.map +1 -0
- package/lib/module/sdk/LiveVoiceSdk.js +262 -268
- package/lib/module/sdk/LiveVoiceSdk.js.map +1 -1
- package/lib/module/sdk/LiveVoiceState.js +208 -40
- package/lib/module/sdk/LiveVoiceState.js.map +1 -1
- package/lib/module/sdk/LogEntries.js +99 -0
- package/lib/module/sdk/LogEntries.js.map +1 -0
- package/lib/module/sdk/Models.js +2 -0
- package/lib/module/{util/UIState.js.map → sdk/Models.js.map} +1 -1
- package/lib/module/{util/PlayingState.js → sdk/NativeSdkVersions.js} +9 -8
- package/lib/module/sdk/NativeSdkVersions.js.map +1 -0
- package/lib/module/sdk/Observables.js +391 -0
- package/lib/module/sdk/Observables.js.map +1 -0
- package/lib/module/sdk/Passwords.js +298 -0
- package/lib/module/sdk/Passwords.js.map +1 -0
- package/lib/module/sdk/Playback.js +35 -0
- package/lib/module/sdk/Playback.js.map +1 -0
- package/lib/module/specs/NativeLiveVoiceSdk.js.map +1 -1
- package/lib/module/util/Colors.js +2 -1
- package/lib/module/util/Colors.js.map +1 -1
- package/lib/module/util/Translations.js +34 -11
- package/lib/module/util/Translations.js.map +1 -1
- package/lib/module/util/freeze.js +26 -0
- package/lib/module/util/freeze.js.map +1 -0
- package/lib/module/util/logger.js +79 -41
- package/lib/module/util/logger.js.map +1 -1
- package/lib/typescript/src/components/BrandingView.d.ts +4 -0
- package/lib/typescript/src/components/BrandingView.d.ts.map +1 -1
- package/lib/typescript/src/components/ChannelView.d.ts +29 -3
- package/lib/typescript/src/components/ChannelView.d.ts.map +1 -1
- package/lib/typescript/src/components/ErrorView.d.ts +5 -3
- package/lib/typescript/src/components/ErrorView.d.ts.map +1 -1
- package/lib/typescript/src/components/LiveVoiceSpinner.d.ts +16 -0
- package/lib/typescript/src/components/LiveVoiceSpinner.d.ts.map +1 -0
- package/lib/typescript/src/components/LiveVoiceView.d.ts +81 -21
- package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -1
- package/lib/typescript/src/components/PasswordPrompt.d.ts +13 -0
- package/lib/typescript/src/components/PasswordPrompt.d.ts.map +1 -0
- package/lib/typescript/src/components/PlayButtonView.d.ts +12 -329
- package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -1
- package/lib/typescript/src/components/ReconnectingView.d.ts +6 -3
- package/lib/typescript/src/components/ReconnectingView.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +15 -6
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/sdk/Bridge.d.ts +36 -0
- package/lib/typescript/src/sdk/Bridge.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Event.d.ts +97 -0
- package/lib/typescript/src/sdk/Event.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Lifecycle.d.ts +191 -0
- package/lib/typescript/src/sdk/Lifecycle.d.ts.map +1 -0
- package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts +195 -190
- package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts.map +1 -1
- package/lib/typescript/src/sdk/LiveVoiceState.d.ts +77 -9
- package/lib/typescript/src/sdk/LiveVoiceState.d.ts.map +1 -1
- package/lib/typescript/src/sdk/LogEntries.d.ts +28 -0
- package/lib/typescript/src/sdk/LogEntries.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Models.d.ts +114 -0
- package/lib/typescript/src/sdk/Models.d.ts.map +1 -0
- package/lib/typescript/src/sdk/NativeSdkVersions.d.ts +6 -0
- package/lib/typescript/src/sdk/NativeSdkVersions.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Observables.d.ts +123 -0
- package/lib/typescript/src/sdk/Observables.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Passwords.d.ts +72 -0
- package/lib/typescript/src/sdk/Passwords.d.ts.map +1 -0
- package/lib/typescript/src/sdk/Playback.d.ts +9 -0
- package/lib/typescript/src/sdk/Playback.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts +34 -31
- package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts.map +1 -1
- package/lib/typescript/src/util/Colors.d.ts.map +1 -1
- package/lib/typescript/src/util/Translations.d.ts +30 -8
- package/lib/typescript/src/util/Translations.d.ts.map +1 -1
- package/lib/typescript/src/util/freeze.d.ts +6 -0
- package/lib/typescript/src/util/freeze.d.ts.map +1 -0
- package/lib/typescript/src/util/logger.d.ts +17 -7
- package/lib/typescript/src/util/logger.d.ts.map +1 -1
- package/livevoice-sdk-react-native.podspec +29 -4
- package/package.json +12 -9
- package/src/components/BrandingView.tsx +42 -55
- package/src/components/ChannelView.tsx +329 -38
- package/src/components/ErrorView.tsx +9 -12
- package/src/components/LiveVoiceSpinner.tsx +87 -0
- package/src/components/LiveVoiceView.tsx +319 -201
- package/src/components/PasswordPrompt.tsx +144 -0
- package/src/components/PlayButtonView.tsx +165 -269
- package/src/components/ReconnectingView.tsx +28 -81
- package/src/icons/branding-ios.png +0 -0
- package/src/icons/camera-off-android.png +0 -0
- package/src/icons/camera-off-android@2x.png +0 -0
- package/src/icons/camera-off-android@3x.png +0 -0
- package/src/icons/cpu-android.png +0 -0
- package/src/icons/cpu-android@2x.png +0 -0
- package/src/icons/cpu-android@3x.png +0 -0
- package/src/icons/cpu-ios.png +0 -0
- package/src/icons/cpu-ios@2x.png +0 -0
- package/src/icons/cpu-ios@3x.png +0 -0
- package/src/icons/lock-android.png +0 -0
- package/src/icons/lock-android@2x.png +0 -0
- package/src/icons/lock-android@3x.png +0 -0
- package/src/icons/lock-ios.png +0 -0
- package/src/icons/lock-ios@2x.png +0 -0
- package/src/icons/lock-ios@3x.png +0 -0
- package/src/icons/mic-off-android.png +0 -0
- package/src/icons/mic-off-android@2x.png +0 -0
- package/src/icons/mic-off-android@3x.png +0 -0
- package/src/icons/mic-slash-ios.png +0 -0
- package/src/icons/mic-slash-ios@2x.png +0 -0
- package/src/icons/mic-slash-ios@3x.png +0 -0
- package/src/icons/video-slash-ios.png +0 -0
- package/src/icons/video-slash-ios@2x.png +0 -0
- package/src/icons/video-slash-ios@3x.png +0 -0
- package/src/index.tsx +92 -6
- package/src/sdk/Bridge.ts +259 -0
- package/src/sdk/Event.ts +187 -0
- package/src/sdk/Lifecycle.ts +366 -0
- package/src/sdk/LiveVoiceSdk.ts +285 -309
- package/src/sdk/LiveVoiceState.ts +230 -60
- package/src/sdk/LogEntries.ts +88 -0
- package/src/sdk/Models.ts +129 -0
- package/src/{util/PlayingState.ts → sdk/NativeSdkVersions.ts} +7 -6
- package/src/sdk/Observables.ts +414 -0
- package/src/sdk/Passwords.ts +286 -0
- package/src/sdk/Playback.ts +30 -0
- package/src/specs/NativeLiveVoiceSdk.ts +42 -38
- package/src/util/Colors.ts +2 -1
- package/src/util/Translations.ts +34 -12
- package/src/util/freeze.ts +23 -0
- package/src/util/logger.ts +79 -52
- package/lib/module/components/AudioOutputSwitchView.js +0 -138
- package/lib/module/components/AudioOutputSwitchView.js.map +0 -1
- package/lib/module/components/index.js +0 -24
- package/lib/module/components/index.js.map +0 -1
- package/lib/module/icons/mic.png +0 -0
- package/lib/module/util/ForegroundServiceConfig.js +0 -38
- package/lib/module/util/ForegroundServiceConfig.js.map +0 -1
- package/lib/module/util/PlayingState.js.map +0 -1
- package/lib/module/util/UIState.js +0 -4
- package/lib/typescript/src/components/AudioOutputSwitchView.d.ts +0 -6
- package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +0 -1
- package/lib/typescript/src/components/index.d.ts +0 -9
- package/lib/typescript/src/components/index.d.ts.map +0 -1
- package/lib/typescript/src/util/ForegroundServiceConfig.d.ts +0 -19
- package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +0 -1
- package/lib/typescript/src/util/PlayingState.d.ts +0 -7
- package/lib/typescript/src/util/PlayingState.d.ts.map +0 -1
- package/lib/typescript/src/util/UIState.d.ts +0 -86
- package/lib/typescript/src/util/UIState.d.ts.map +0 -1
- package/src/components/AudioOutputSwitchView.tsx +0 -146
- package/src/components/index.tsx +0 -21
- package/src/icons/mic.png +0 -0
- package/src/util/ForegroundServiceConfig.tsx +0 -42
- package/src/util/UIState.ts +0 -106
package/README.md
CHANGED
|
@@ -6,11 +6,14 @@ The React Native SDK for integrating the LiveVoice service into your app.
|
|
|
6
6
|
|
|
7
7
|
The LiveVoice SDK enables your app to browse and listen to your configured LiveVoice channels,
|
|
8
8
|
as well as present a channel's live subtitles where available.
|
|
9
|
+
The SDK plays audio and subtitles; video will be supported in an upcoming version. Until
|
|
10
|
+
then a channel with video and audio plays its audio, one with only video cannot be played, and
|
|
11
|
+
a channel's `hasVideo` tells which channels have video.
|
|
9
12
|
|
|
10
13
|
Using the LiveVoice SDK requires an account with SDK access enabled. Depending on your
|
|
11
14
|
subscription, the SDK allows for hiding the LiveVoice branding or building a fully customized
|
|
12
15
|
presentation. For more information contact sdk-support@livevoice.io. Once SDK access has been
|
|
13
|
-
granted, you can find your personal API key in the API
|
|
16
|
+
granted, you can find your personal API key in the 'API/SDK Keys' section of your account page at
|
|
14
17
|
https://livevoice.io/en/account/api.
|
|
15
18
|
|
|
16
19
|
## Features
|
|
@@ -18,14 +21,19 @@ https://livevoice.io/en/account/api.
|
|
|
18
21
|
- Browse and play the channels of a LiveVoice event
|
|
19
22
|
- Live subtitles where the channel provides them
|
|
20
23
|
- A drop-in `LiveVoiceView`, or a fully custom presentation with your own channel cells
|
|
21
|
-
-
|
|
24
|
+
- Password-protected events and channels, with a built-in prompt or your own
|
|
25
|
+
- Audio output preference (system route or loudspeaker), audio focus and the system media
|
|
26
|
+
controls
|
|
27
|
+
- The event's brand colours, language requests and linked events
|
|
28
|
+
- Diagnostic events for your own logging
|
|
22
29
|
- Optional branding control and custom UI (subscription-dependent)
|
|
23
30
|
|
|
24
31
|
## Requirements
|
|
25
32
|
|
|
26
|
-
- React Native 0.
|
|
27
|
-
- iOS 15.1 or newer
|
|
28
|
-
- Android 7.0 (API level 24) or newer
|
|
33
|
+
- React Native 0.81 or newer
|
|
34
|
+
- iOS 15.1 or newer; Xcode 26.5 or newer (Swift 6.3)
|
|
35
|
+
- Android 7.0 (API level 24) or newer; the app's `compileSdk` must be 36 or newer
|
|
36
|
+
- JDK 21 for Android builds
|
|
29
37
|
|
|
30
38
|
## Installation
|
|
31
39
|
|
|
@@ -35,90 +43,121 @@ npm install livevoice-sdk-react-native
|
|
|
35
43
|
yarn add livevoice-sdk-react-native
|
|
36
44
|
```
|
|
37
45
|
|
|
38
|
-
On iOS,
|
|
46
|
+
On iOS, CocoaPods is the supported setup. Install the pods from your app's
|
|
47
|
+
`ios/` directory:
|
|
39
48
|
|
|
40
49
|
```sh
|
|
41
50
|
pod install
|
|
42
51
|
```
|
|
43
52
|
|
|
44
|
-
|
|
53
|
+
This also fetches the native LiveVoice SDK, as a Swift package; do not add it
|
|
54
|
+
to your app yourself, and remove any `pod 'LiveVoiceSDK'` line left from 2.x. On Android there is nothing else to add.
|
|
45
55
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
joinEvent,
|
|
50
|
-
leaveEvent,
|
|
51
|
-
LiveVoiceView,
|
|
52
|
-
} from 'livevoice-sdk-react-native';
|
|
56
|
+
Each release of this package is built for exactly one version of the native
|
|
57
|
+
iOS and Android SDKs, which it pins. Other combinations are not supported:
|
|
58
|
+
`initialize()` rejects with `unsupported_sdk`.
|
|
53
59
|
|
|
54
|
-
|
|
55
|
-
initialize();
|
|
60
|
+
## Usage
|
|
56
61
|
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
```tsx
|
|
63
|
+
import { useEffect, useState } from 'react';
|
|
64
|
+
import { Text } from 'react-native';
|
|
65
|
+
import { initialize, joinEvent, LiveVoiceError, LiveVoiceView } from 'livevoice-sdk-react-native';
|
|
66
|
+
|
|
67
|
+
// Your app's root: initialize once, and render the screens that join after it.
|
|
68
|
+
export function App() {
|
|
69
|
+
// `null` while initializing, then 'ready' or the error.
|
|
70
|
+
const [launch, setLaunch] = useState<'ready' | LiveVoiceError | null>(null);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
initialize().then(() => setLaunch('ready'), (error: LiveVoiceError) => setLaunch(error));
|
|
73
|
+
}, []);
|
|
74
|
+
if (launch === 'ready') return <EventScreen />;
|
|
75
|
+
// For example `unsupported_sdk`, when the native SDK isn't the version this package needs.
|
|
76
|
+
if (launch) return <Text>Unable to initialize LiveVoice: {launch.code}</Text>;
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
59
79
|
|
|
60
|
-
|
|
61
|
-
|
|
80
|
+
function EventScreen() {
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
// This effect's own join. Under StrictMode the second run's join supersedes the first.
|
|
83
|
+
const joining = joinEvent({ joinCode: 'YOUR_JOIN_CODE', apiKey: 'YOUR_API_KEY' })
|
|
84
|
+
.catch((error: unknown) => {
|
|
85
|
+
// `superseded` or `cancelled`: a newer join or a leave ended it. LiveVoiceView shows
|
|
86
|
+
// connection errors itself.
|
|
87
|
+
const ended = error instanceof LiveVoiceError &&
|
|
88
|
+
(error.code === 'superseded' || error.code === 'cancelled');
|
|
89
|
+
if (!ended) console.warn(error);
|
|
90
|
+
return undefined;
|
|
91
|
+
});
|
|
92
|
+
return () => {
|
|
93
|
+
// Leaves this join, also one that resolves after unmounting, and never a newer one.
|
|
94
|
+
joining.then(joined => joined?.leave()).catch(error => console.warn(error));
|
|
95
|
+
};
|
|
96
|
+
}, []);
|
|
97
|
+
|
|
98
|
+
// Mounted at once: it shows loading while joining, asks for a protected event's password,
|
|
99
|
+
// and shows errors and reconnects.
|
|
62
100
|
return <LiveVoiceView />;
|
|
63
101
|
}
|
|
64
|
-
|
|
65
|
-
// Leave the event when you no longer display any channels.
|
|
66
|
-
leaveEvent();
|
|
67
102
|
```
|
|
68
103
|
|
|
69
|
-
`
|
|
70
|
-
|
|
71
|
-
interface; the API key is on your account page.
|
|
104
|
+
Await `initialize()` before joining an event; commands before it reject with
|
|
105
|
+
`not_initialized`. The join code and password come from the event's admin page.
|
|
72
106
|
|
|
73
|
-
|
|
107
|
+
`joinEvent()` is a fresh join on every call: it replaces whatever is joined or
|
|
108
|
+
joining, and resolves once the event is ready. The joined event it returns
|
|
109
|
+
only leaves that join, never a newer one; `leaveEvent()` leaves whatever is
|
|
110
|
+
joined. Joining, switching, reconnecting and leaving resolve only when their
|
|
111
|
+
result is final, so the next line of your code can rely on it.
|
|
74
112
|
|
|
75
|
-
|
|
76
|
-
`
|
|
113
|
+
Channels start from the cells of `LiveVoiceView`: a tap on a default cell, or
|
|
114
|
+
your custom cell's `togglePlayback()`. `stopChannel()` stops the playing
|
|
115
|
+
channel.
|
|
77
116
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// Custom cells require an API key that permits
|
|
82
|
-
// custom UI. If you provide renderChannel but the
|
|
83
|
-
// joined key isn't allowed, the SDK shows the
|
|
84
|
-
// invalid-api-key error instead of your cells.
|
|
85
|
-
<LiveVoiceView
|
|
86
|
-
renderChannel={(channel, { isLastInList, onAudioPress }) => (
|
|
87
|
-
<MyCustomCell
|
|
88
|
-
name={channel.name}
|
|
89
|
-
online={channel.isOnline}
|
|
90
|
-
playing={channel.playingState === PlayingState.PLAYING}
|
|
91
|
-
isLast={isLastInList}
|
|
92
|
-
onPlayPress={onAudioPress}
|
|
93
|
-
/>
|
|
94
|
-
)}
|
|
95
|
-
/>;
|
|
96
|
-
```
|
|
117
|
+
Errors are `LiveVoiceError`s with a `code`, `isRetryable` and a localised
|
|
118
|
+
`message` to show as it is. `superseded` and `cancelled` generally need no
|
|
119
|
+
message to the listener.
|
|
97
120
|
|
|
98
|
-
|
|
121
|
+
Every state (the connection, the subtitles, the features, the joined event and
|
|
122
|
+
more) has a getter, a listener and a React hook, such as
|
|
123
|
+
`useLiveVoiceConnection()`.
|
|
99
124
|
|
|
100
|
-
|
|
101
|
-
disabled by default — enable it by passing a configuration to `initialize`:
|
|
125
|
+
## Background playback
|
|
102
126
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
serviceEnabledWithMessage,
|
|
108
|
-
} from 'livevoice-sdk-react-native';
|
|
127
|
+
To keep audio playing while the app is in the background or the screen is locked, the iOS app
|
|
128
|
+
needs the audio background mode: select the app target in Xcode, open **Signing & Capabilities**,
|
|
129
|
+
add **Background Modes** and check **Audio, AirPlay, and Picture in Picture**. Without it, iOS
|
|
130
|
+
stops playback when the app leaves the foreground.
|
|
109
131
|
|
|
110
|
-
|
|
111
|
-
initialize(
|
|
112
|
-
|
|
113
|
-
// Or provide your own text; %s becomes the playing channel's name.
|
|
114
|
-
initialize(serviceEnabledWithMessage('Channel %s is playing'));
|
|
115
|
-
```
|
|
132
|
+
On Android, the SDK keeps playback alive in the background with a foreground service, enabled by
|
|
133
|
+
default; `initialize({ androidServiceConfig: { kind: 'disabled' } })` turns it off.
|
|
116
134
|
|
|
117
|
-
## Examples and
|
|
135
|
+
## Examples and documentation
|
|
118
136
|
|
|
119
137
|
The [example apps](https://github.com/LiveVoiceOfficial/livevoice-sdk-examples) are the best
|
|
120
|
-
place to start
|
|
121
|
-
[
|
|
138
|
+
place to start: each is a working integration you can run and read. The
|
|
139
|
+
[React Native sample](https://github.com/LiveVoiceOfficial/livevoice-sdk-examples/tree/main/react-native)
|
|
140
|
+
explains the integration step by step, including what an awaited call guarantees and how
|
|
141
|
+
passwords work, and has a screen for each feature in `src/screens`:
|
|
142
|
+
|
|
143
|
+
| Topic | Screen |
|
|
144
|
+
|---|---|
|
|
145
|
+
| Joining and leaving an event | `GettingStarted/JoiningEventScreen.tsx` |
|
|
146
|
+
| Subtitles | `Subtitles/SubtitlesScreen.tsx` |
|
|
147
|
+
| Custom channel cells, loading, error and empty parts, filtering | `Channels/` |
|
|
148
|
+
| Passwords, your own prompt and password store | `EventFeatures/PasswordsScreen.tsx` |
|
|
149
|
+
| Language requests and linked events | `EventFeatures/` |
|
|
150
|
+
| Audio output, audio focus, media controls and artwork | `AudioAndSystem/` |
|
|
151
|
+
| Branding, localization and diagnostic events | `Customization/` |
|
|
152
|
+
|
|
153
|
+
Every function and type of this package is documented in its TypeScript declarations, which
|
|
154
|
+
your editor shows.
|
|
155
|
+
|
|
156
|
+
Migrating from 2.x: see
|
|
157
|
+
[`react-native/MIGRATION.md`](https://github.com/LiveVoiceOfficial/livevoice-sdk-examples/blob/main/react-native/MIGRATION.md)
|
|
158
|
+
in the example apps repository.
|
|
159
|
+
|
|
160
|
+
Questions: sdk-support@livevoice.io.
|
|
122
161
|
|
|
123
162
|
## License
|
|
124
163
|
|
package/android/build.gradle
CHANGED
|
@@ -15,8 +15,8 @@ buildscript {
|
|
|
15
15
|
ext.LiveVoiceSdkReactNative = [
|
|
16
16
|
kotlinVersion: "2.0.21",
|
|
17
17
|
minSdkVersion: 24,
|
|
18
|
-
compileSdkVersion:
|
|
19
|
-
targetSdkVersion:
|
|
18
|
+
compileSdkVersion: 37,
|
|
19
|
+
targetSdkVersion: 37
|
|
20
20
|
]
|
|
21
21
|
|
|
22
22
|
ext.getExtOrDefault = { prop ->
|
|
@@ -85,7 +85,6 @@ android {
|
|
|
85
85
|
* see: https://github.com/facebook/react-native/issues/39114
|
|
86
86
|
*/
|
|
87
87
|
rootProject.allprojects { Project project ->
|
|
88
|
-
println "Adding LiveVoice repository to project \"$project.name\""
|
|
89
88
|
project.repositories {
|
|
90
89
|
google()
|
|
91
90
|
mavenCentral()
|
|
@@ -96,7 +95,9 @@ android {
|
|
|
96
95
|
|
|
97
96
|
dependencies {
|
|
98
97
|
implementation "com.facebook.react:react-android"
|
|
99
|
-
|
|
98
|
+
// Exact: another requested version of the native SDK fails the build.
|
|
99
|
+
implementation("io.livevoice.sdk:android") {
|
|
100
|
+
version { strictly("3.0.0") }
|
|
100
101
|
exclude group: 'org.jspecify', module: 'jspecify'
|
|
101
102
|
}
|
|
102
103
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
|
|
@@ -13,261 +13,195 @@
|
|
|
13
13
|
|
|
14
14
|
package io.livevoice.react
|
|
15
15
|
|
|
16
|
-
import
|
|
17
|
-
import androidx.activity.ComponentActivity
|
|
18
|
-
import androidx.appcompat.app.AppCompatActivity
|
|
19
|
-
import androidx.lifecycle.lifecycleScope
|
|
16
|
+
import com.facebook.react.bridge.Promise
|
|
20
17
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
18
|
+
import com.facebook.react.bridge.UiThreadUtil
|
|
21
19
|
import com.facebook.react.module.annotations.ReactModule
|
|
22
20
|
import com.facebook.react.modules.systeminfo.ReactNativeVersion
|
|
21
|
+
import io.livevoice.sdk.android.internal.wrappers.LiveVoiceWrapperApi
|
|
22
|
+
import io.livevoice.sdk.android.internal.wrappers.LiveVoiceWrapperBridge
|
|
23
23
|
import io.livevoice.sdk.android.publicApi.core.LiveVoice
|
|
24
|
-
import io.livevoice.sdk.android.publicApi.core.model.
|
|
25
|
-
import io.livevoice.sdk.android.publicApi.core.model.
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import io.livevoice.sdk.android.publicApi.serialization.LiveVoiceSerialization
|
|
24
|
+
import io.livevoice.sdk.android.publicApi.core.model.LiveVoiceErrorCode
|
|
25
|
+
import io.livevoice.sdk.android.publicApi.core.model.LiveVoiceException
|
|
26
|
+
import kotlinx.coroutines.CoroutineScope
|
|
27
|
+
import kotlinx.coroutines.Dispatchers
|
|
28
|
+
import kotlinx.coroutines.Job
|
|
29
|
+
import kotlinx.coroutines.SupervisorJob
|
|
30
|
+
import kotlinx.coroutines.flow.first
|
|
32
31
|
import kotlinx.coroutines.launch
|
|
33
32
|
|
|
33
|
+
/**
|
|
34
|
+
* The only place the React Native wrapper talks to the native SDK, through its wrapper bridge.
|
|
35
|
+
* Every structured value is a JSON string the SDK encodes and decodes; this module only forwards
|
|
36
|
+
* them (bridge.md 1.1). Internal: only [LiveVoiceSdkReactNativePackage] creates it.
|
|
37
|
+
*/
|
|
38
|
+
@OptIn(LiveVoiceWrapperApi::class)
|
|
34
39
|
@ReactModule(name = LiveVoiceModule.NAME)
|
|
35
|
-
class LiveVoiceModule(reactContext: ReactApplicationContext) :
|
|
40
|
+
internal class LiveVoiceModule(reactContext: ReactApplicationContext) :
|
|
36
41
|
NativeLiveVoiceSdkSpec(reactContext) {
|
|
37
42
|
|
|
38
43
|
override fun getName(): String {
|
|
39
44
|
return NAME
|
|
40
45
|
}
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
DEFAULT_MESSAGE_SENTINEL -> ForegroundServiceConfig.enabledWithDefaultMessage
|
|
46
|
-
else -> ForegroundServiceConfig.Enabled(NotificationText.RawValue(androidServiceConfig))
|
|
47
|
-
}
|
|
47
|
+
@Volatile private var bridge: LiveVoiceWrapperBridge? = null
|
|
48
|
+
@Volatile private var invalidated = false
|
|
49
|
+
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
logError(EVENT_BRIDGE_ERROR, "action" to "initialize", "reason" to "missingActivity")
|
|
53
|
-
return
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
val versionInfo = ReactNativeVersion.VERSION
|
|
57
|
-
val reactVersion = "${versionInfo["major"]}.${versionInfo["minor"]}.${versionInfo["patch"]}"
|
|
58
|
-
|
|
59
|
-
//initialize SDK
|
|
60
|
-
LiveVoice.initializeLiveVoice(
|
|
61
|
-
applicationContext = activity,
|
|
62
|
-
foregroundServiceConfig = parsedServiceConfig,
|
|
63
|
-
sdkPlatform = SdkPlatform.ReactNative(
|
|
64
|
-
sdkVersion = Version.SDK_VERSION,
|
|
65
|
-
reactVersion = reactVersion
|
|
66
|
-
)
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
logInfo(EVENT_INIT, "platformVersion" to reactVersion)
|
|
70
|
-
|
|
71
|
-
//forward serialized state and events from the SDK
|
|
72
|
-
launchObservations(activity)
|
|
73
|
-
|
|
74
|
-
} catch (ex: Exception) {
|
|
75
|
-
logError(EVENT_BRIDGE_ERROR, ex, "action" to "initialize")
|
|
76
|
-
}
|
|
51
|
+
private fun reject(promise: Promise, error: Throwable) {
|
|
52
|
+
val code = (error as? LiveVoiceException)?.code?.value ?: "generic"
|
|
53
|
+
promise.reject(code, LiveVoiceWrapperBridge.errorJSON(error), error)
|
|
77
54
|
}
|
|
78
55
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
* (see [LiveVoiceSerialization]) so the wire format is identical across Android and iOS.
|
|
82
|
-
*/
|
|
83
|
-
private fun launchObservations(activity: AppCompatActivity) {
|
|
84
|
-
activity.lifecycleScope.launch {
|
|
85
|
-
LiveVoiceSerialization.viewState.collect { emitOnUiStateChanged(it) }
|
|
86
|
-
}
|
|
87
|
-
activity.lifecycleScope.launch {
|
|
88
|
-
LiveVoiceSerialization.audioOutputIsSpeaker.collect { emitOnAudioOutputChanged(it) }
|
|
89
|
-
}
|
|
90
|
-
activity.lifecycleScope.launch {
|
|
91
|
-
LiveVoiceSerialization.availableSubtitles.collect { emitOnAvailableSubtitleConfigsChanged(it) }
|
|
92
|
-
}
|
|
93
|
-
activity.lifecycleScope.launch {
|
|
94
|
-
LiveVoiceSerialization.subtitles.collect { emitOnSubtitlesChanged(it) }
|
|
95
|
-
}
|
|
96
|
-
activity.lifecycleScope.launch {
|
|
97
|
-
LiveVoiceSerialization.subtitleState.collect { emitOnSubtitleStateChanged(it) }
|
|
98
|
-
}
|
|
56
|
+
private fun reject(promise: Promise, code: LiveVoiceErrorCode) {
|
|
57
|
+
promise.reject(code.value, LiveVoiceWrapperBridge.errorJSON(code, reactApplicationContext))
|
|
99
58
|
}
|
|
100
59
|
|
|
101
|
-
|
|
102
|
-
|
|
60
|
+
/** The attached bridge, attaching it first; `null` once the runtime went away. */
|
|
61
|
+
private fun attachedBridge(): LiveVoiceWrapperBridge? {
|
|
62
|
+
if (invalidated) return null
|
|
63
|
+
bridge?.let { return it }
|
|
64
|
+
val owner = LiveVoiceWrapperBridge.attach()
|
|
65
|
+
bridge = owner
|
|
66
|
+
launchObservations(owner)
|
|
67
|
+
return owner
|
|
68
|
+
}
|
|
103
69
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
70
|
+
// The configuration is the JSON object of bridge.md 3.2; the SDK applies it, initializing itself
|
|
71
|
+
// with the application context and this wrapper's identity.
|
|
72
|
+
override fun initialize(configuration: String, promise: Promise) { UiThreadUtil.runOnUiThread {
|
|
73
|
+
val owner = attachedBridge()
|
|
74
|
+
if (owner == null || !owner.isCurrent) { reject(promise, LiveVoiceErrorCode.CANCELLED); return@runOnUiThread }
|
|
75
|
+
val version = ReactNativeVersion.VERSION
|
|
76
|
+
owner.initializeReactNative(reactApplicationContext, Version.SDK_VERSION,
|
|
77
|
+
"${version["major"]}.${version["minor"]}.${version["patch"]}", configuration) { result ->
|
|
78
|
+
result.fold({ promise.resolve(it) }, { reject(promise, it) })
|
|
108
79
|
}
|
|
109
|
-
|
|
110
|
-
?: run {
|
|
111
|
-
logWarn(EVENT_ACTION_IGNORED, "action" to "stopChannel", "reason" to "noActiveChannel")
|
|
112
|
-
return
|
|
113
|
-
}
|
|
80
|
+
} }
|
|
114
81
|
|
|
115
|
-
|
|
82
|
+
private fun launchObservations(owner: LiveVoiceWrapperBridge) {
|
|
83
|
+
scope.launch {
|
|
84
|
+
owner.invalidation.first { it }
|
|
85
|
+
invalidated = true
|
|
86
|
+
scope.coroutineContext[Job]?.cancel()
|
|
87
|
+
}
|
|
88
|
+
// Not replayed: collection starts here, before initialize, and ends with the bridge.
|
|
89
|
+
scope.launch { owner.logEntries.collect { emitOnLogEntry(it) } }
|
|
90
|
+
scope.launch { owner.states.collect { emitOnState(it) } }
|
|
91
|
+
scope.launch { owner.passwordRequests.collect { emitOnPasswordRequest(it) } }
|
|
92
|
+
scope.launch { owner.passwordRequestCancellations.collect { emitOnPasswordRequestCancelled(it) } }
|
|
93
|
+
scope.launch { owner.passwordStoreRequests.collect { emitOnPasswordStoreRequest(it) } }
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
override fun execute(command: String, arguments: String, promise: Promise) {
|
|
97
|
+
UiThreadUtil.runOnUiThread {
|
|
98
|
+
val owner = bridge
|
|
99
|
+
if (invalidated || owner?.isCurrent == false) {
|
|
100
|
+
reject(promise, LiveVoiceErrorCode.CANCELLED)
|
|
101
|
+
} else if (owner == null) {
|
|
102
|
+
reject(promise, LiveVoiceErrorCode.NOT_INITIALIZED)
|
|
103
|
+
} else owner.execute(command, arguments) { result ->
|
|
104
|
+
result.fold({ promise.resolve(it ?: "null") }, { reject(promise, it) })
|
|
105
|
+
}
|
|
106
|
+
}
|
|
116
107
|
}
|
|
117
108
|
|
|
118
|
-
override fun
|
|
119
|
-
|
|
120
|
-
override fun getCurrentAudioState(): Boolean = LiveVoiceSerialization.currentAudioOutputIsSpeaker()
|
|
121
|
-
|
|
122
|
-
override fun getCurrentSubtitles(): String = LiveVoiceSerialization.currentSubtitles()
|
|
123
|
-
|
|
124
|
-
override fun getCurrentSubtitleState(): String = LiveVoiceSerialization.currentSubtitleState()
|
|
125
|
-
|
|
126
|
-
override fun getCurrentAvailableSubtitleConfigs(): String =
|
|
127
|
-
LiveVoiceSerialization.currentAvailableSubtitles()
|
|
128
|
-
|
|
129
|
-
override fun getCurrentClaims(): String? = LiveVoiceSerialization.currentClaims()
|
|
109
|
+
override fun getErrorMessages(): String = LiveVoiceWrapperBridge.errorMessagesJSON(reactApplicationContext)
|
|
130
110
|
|
|
131
|
-
|
|
132
|
-
|
|
111
|
+
// Works before `initialize`: attaches the bridge first if needed, so the preference reaches the
|
|
112
|
+
// SDK and the snapshot later carries it. Ignored once the runtime went away.
|
|
113
|
+
override fun setAudioOutput(payload: String) {
|
|
114
|
+
UiThreadUtil.runOnUiThread { attachedBridge()?.setAudioOutput(payload) }
|
|
133
115
|
}
|
|
134
116
|
|
|
135
|
-
override fun
|
|
136
|
-
|
|
137
|
-
LiveVoice.startSubtitles(nullableChannelId)
|
|
117
|
+
override fun writeLogEntry(payload: String) {
|
|
118
|
+
LiveVoiceWrapperBridge.writeLogEntry(payload)
|
|
138
119
|
}
|
|
139
120
|
|
|
140
|
-
override fun
|
|
141
|
-
|
|
142
|
-
override fun openLiveVoiceWebsite() {
|
|
143
|
-
LiveVoice.openLiveVoiceWebsite()
|
|
121
|
+
override fun answerPasswordRequest(payload: String) {
|
|
122
|
+
UiThreadUtil.runOnUiThread { if (!invalidated) bridge?.answerPasswordRequest(payload) }
|
|
144
123
|
}
|
|
145
124
|
|
|
146
|
-
override fun
|
|
125
|
+
override fun answerPasswordStoreRequest(payload: String) {
|
|
126
|
+
UiThreadUtil.runOnUiThread { if (!invalidated) bridge?.answerPasswordStoreRequest(payload) }
|
|
127
|
+
}
|
|
147
128
|
|
|
148
|
-
override fun
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
logError(EVENT_BRIDGE_ERROR, "action" to "joinEvent", "reason" to "missingActivity")
|
|
152
|
-
error("Could not create scope to connect! activity: ${reactApplicationContext.currentActivity}")
|
|
153
|
-
}
|
|
129
|
+
override fun setPasswordStore(payload: String) {
|
|
130
|
+
UiThreadUtil.runOnUiThread { if (!invalidated) bridge?.setPasswordStore(payload) }
|
|
131
|
+
}
|
|
154
132
|
|
|
155
|
-
|
|
156
|
-
|
|
133
|
+
override fun invalidate() {
|
|
134
|
+
invalidated = true
|
|
135
|
+
bridge?.requestInvalidation()
|
|
136
|
+
UiThreadUtil.runOnUiThread {
|
|
137
|
+
bridge?.invalidate(); bridge = null
|
|
138
|
+
scope.coroutineContext[Job]?.cancel()
|
|
157
139
|
}
|
|
140
|
+
super.invalidate()
|
|
158
141
|
}
|
|
159
142
|
|
|
160
|
-
override fun
|
|
161
|
-
|
|
143
|
+
override fun openLiveVoiceWebsite() {
|
|
144
|
+
LiveVoiceWrapperBridge.openLiveVoiceWebsite(reactApplicationContext)
|
|
162
145
|
}
|
|
163
146
|
|
|
164
|
-
override fun
|
|
147
|
+
override fun getSdkVersion(): String = Version.SDK_VERSION
|
|
148
|
+
|
|
149
|
+
override fun getNativeSdkVersion(): String = LiveVoice.sdkVersion
|
|
165
150
|
|
|
166
|
-
override fun channelStatusOffline(): String =
|
|
151
|
+
override fun channelStatusOffline(): String = LiveVoiceWrapperBridge.channelStatusOffline(reactApplicationContext)
|
|
167
152
|
|
|
168
|
-
override fun noChannels(): String =
|
|
153
|
+
override fun noChannels(): String = LiveVoiceWrapperBridge.noChannels(reactApplicationContext)
|
|
169
154
|
|
|
170
155
|
override fun isAiChannelStatusMessage(): String =
|
|
171
|
-
|
|
156
|
+
LiveVoiceWrapperBridge.isAiChannelStatusMessage(reactApplicationContext)
|
|
172
157
|
|
|
173
158
|
override fun errorScreenRetrying(): String =
|
|
174
|
-
|
|
159
|
+
LiveVoiceWrapperBridge.errorScreenRetrying(reactApplicationContext)
|
|
175
160
|
|
|
176
161
|
override fun errorScreenRetryingIn(seconds: Double): String =
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
override fun sdkErrorGeneric(): String =
|
|
180
|
-
LiveVoice.translations.sdkErrorGeneric()
|
|
181
|
-
|
|
182
|
-
override fun sdkErrorInactive(): String =
|
|
183
|
-
LiveVoice.translations.sdkErrorInactive()
|
|
184
|
-
|
|
185
|
-
override fun sdkErrorInvalidApiKey(): String =
|
|
186
|
-
LiveVoice.translations.sdkErrorInvalidApiKey()
|
|
187
|
-
|
|
188
|
-
override fun sdkErrorListenerLimitReached(): String =
|
|
189
|
-
LiveVoice.translations.sdkErrorListenerLimitReached()
|
|
190
|
-
|
|
191
|
-
override fun sdkErrorNoNetwork(): String =
|
|
192
|
-
LiveVoice.translations.sdkErrorNoNetwork()
|
|
193
|
-
|
|
194
|
-
override fun sdkErrorNotFound(): String =
|
|
195
|
-
LiveVoice.translations.sdkErrorNotFound()
|
|
196
|
-
|
|
197
|
-
override fun sdkErrorRequestFailed(errorCode: Double): String =
|
|
198
|
-
LiveVoice.translations.sdkErrorRequestFailed(errorCode.toInt())
|
|
199
|
-
|
|
200
|
-
override fun sdkErrorWrongPassword(): String =
|
|
201
|
-
LiveVoice.translations.sdkErrorWrongPassword()
|
|
162
|
+
LiveVoiceWrapperBridge.errorScreenRetryingIn(reactApplicationContext, seconds.toLong())
|
|
202
163
|
|
|
203
164
|
override fun sdkNoMatchingChannels(): String =
|
|
204
|
-
|
|
165
|
+
LiveVoiceWrapperBridge.sdkNoMatchingChannels(reactApplicationContext)
|
|
205
166
|
|
|
206
167
|
override fun streamingByTitle(): String =
|
|
207
|
-
|
|
168
|
+
LiveVoiceWrapperBridge.streamingByTitle(reactApplicationContext)
|
|
208
169
|
|
|
209
170
|
override fun errorRetryNowButton(): String =
|
|
210
|
-
|
|
171
|
+
LiveVoiceWrapperBridge.errorRetryNowButton(reactApplicationContext)
|
|
211
172
|
|
|
212
173
|
override fun accessibilityChannelPlay(): String =
|
|
213
|
-
|
|
174
|
+
LiveVoiceWrapperBridge.accessibilityChannelPlay(reactApplicationContext)
|
|
214
175
|
|
|
215
176
|
override fun accessibilityChannelStatusMuted(): String =
|
|
216
|
-
|
|
177
|
+
LiveVoiceWrapperBridge.accessibilityChannelStatusMuted(reactApplicationContext)
|
|
217
178
|
|
|
218
179
|
override fun accessibilityChannelStop(): String =
|
|
219
|
-
|
|
180
|
+
LiveVoiceWrapperBridge.accessibilityChannelStop(reactApplicationContext)
|
|
220
181
|
|
|
182
|
+
override fun passwordPromptTitle(): String = LiveVoiceWrapperBridge.passwordPromptTitle(reactApplicationContext)
|
|
221
183
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
try {
|
|
225
|
-
block()
|
|
226
|
-
} catch (ex: SdkNotConnectedException) {
|
|
227
|
-
logError(EVENT_BRIDGE_ERROR, ex, "action" to methodName, "reason" to "notConnected")
|
|
228
|
-
}
|
|
229
|
-
}
|
|
184
|
+
override fun passwordPromptChannelMessage(): String =
|
|
185
|
+
LiveVoiceWrapperBridge.passwordPromptChannelMessage(reactApplicationContext)
|
|
230
186
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
187
|
+
override fun passwordPromptEventMessage(): String =
|
|
188
|
+
LiveVoiceWrapperBridge.passwordPromptEventMessage(reactApplicationContext)
|
|
234
189
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
190
|
+
override fun passwordPromptWrongPassword(): String =
|
|
191
|
+
LiveVoiceWrapperBridge.passwordPromptWrongPassword(reactApplicationContext)
|
|
238
192
|
|
|
239
|
-
|
|
240
|
-
Log.e(NAME, formatMessage(event, *fields))
|
|
241
|
-
}
|
|
193
|
+
override fun passwordPromptField(): String = LiveVoiceWrapperBridge.passwordPromptField(reactApplicationContext)
|
|
242
194
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
195
|
+
override fun passwordPromptCancelButton(): String =
|
|
196
|
+
LiveVoiceWrapperBridge.passwordPromptCancelButton(reactApplicationContext)
|
|
246
197
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
.filter { it.second != null }
|
|
250
|
-
.sortedBy { it.first }
|
|
251
|
-
.joinToString(" ") { (key, value) -> "$key=$value" }
|
|
198
|
+
override fun passwordPromptChannelConfirmButton(): String =
|
|
199
|
+
LiveVoiceWrapperBridge.passwordPromptChannelConfirmButton(reactApplicationContext)
|
|
252
200
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
} else {
|
|
256
|
-
"$event $fieldText"
|
|
257
|
-
}
|
|
258
|
-
}
|
|
201
|
+
override fun passwordPromptEventConfirmButton(): String =
|
|
202
|
+
LiveVoiceWrapperBridge.passwordPromptEventConfirmButton(reactApplicationContext)
|
|
259
203
|
|
|
260
204
|
companion object {
|
|
261
|
-
private const val EVENT_ACTION_IGNORED = "LV_ACTION_IGNORED"
|
|
262
|
-
private const val EVENT_BRIDGE_ERROR = "LV_BRIDGE_ERROR"
|
|
263
|
-
private const val EVENT_INIT = "LV_INIT"
|
|
264
205
|
const val NAME = "LiveVoiceModule"
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Sentinel the JS layer sends when the foreground service is enabled without a custom
|
|
268
|
-
* message. Must stay in sync with `serviceEnabledWithDefaultMessage` in
|
|
269
|
-
* `src/util/ForegroundServiceConfig.tsx`.
|
|
270
|
-
*/
|
|
271
|
-
const val DEFAULT_MESSAGE_SENTINEL = "LV_NOTIFICATION_DEFAULT_MESSAGE"
|
|
272
206
|
}
|
|
273
207
|
}
|