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.
- package/README.md +158 -7
- package/android/build.gradle +18 -6
- package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +121 -221
- package/android/src/main/java/io/livevoice/react/__SDK.kt +17 -3
- package/ios/LiveVoiceRNBridge.swift +362 -0
- package/ios/LiveVoiceSdkReactNative.mm +247 -145
- package/ios/__SDK.h +16 -2
- package/ios/livevoice_spm_backport.rb +202 -0
- package/lib/module/components/BrandingView.js +71 -50
- package/lib/module/components/BrandingView.js.map +1 -1
- package/lib/module/components/ChannelView.js +368 -54
- package/lib/module/components/ChannelView.js.map +1 -1
- package/lib/module/components/ErrorView.js +17 -16
- 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 +351 -104
- 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 +192 -254
- package/lib/module/components/PlayButtonView.js.map +1 -1
- package/lib/module/components/ReconnectingView.js +43 -62
- package/lib/module/components/ReconnectingView.js.map +1 -1
- package/lib/module/components/WarningView.js +12 -10
- package/lib/module/components/WarningView.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 +24 -225
- 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 +365 -0
- package/lib/module/sdk/LiveVoiceSdk.js.map +1 -0
- package/lib/module/sdk/LiveVoiceState.js +234 -0
- package/lib/module/sdk/LiveVoiceState.js.map +1 -0
- 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/sdk/NativeSdkVersions.js +24 -0
- 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 +12 -10
- package/lib/module/specs/NativeLiveVoiceSdk.js.map +1 -1
- package/lib/module/util/Colors.js +14 -11
- package/lib/module/util/Colors.js.map +1 -1
- package/lib/module/util/Translations.js +46 -21
- 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 +114 -0
- package/lib/module/util/logger.js.map +1 -0
- 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 +85 -3
- 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/components/WarningView.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +15 -144
- 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 +215 -0
- package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts.map +1 -0
- package/lib/typescript/src/sdk/LiveVoiceState.d.ts +80 -0
- package/lib/typescript/src/sdk/LiveVoiceState.d.ts.map +1 -0
- 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 +35 -29
- 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 +33 -0
- package/lib/typescript/src/util/logger.d.ts.map +1 -0
- package/livevoice-sdk-react-native.podspec +41 -16
- package/package.json +26 -14
- package/src/components/BrandingView.tsx +55 -66
- package/src/components/ChannelView.tsx +342 -48
- package/src/components/ErrorView.tsx +21 -22
- package/src/components/LiveVoiceSpinner.tsx +87 -0
- package/src/components/LiveVoiceView.tsx +360 -151
- package/src/components/PasswordPrompt.tsx +144 -0
- package/src/components/PlayButtonView.tsx +177 -279
- package/src/components/ReconnectingView.tsx +40 -86
- package/src/components/WarningView.tsx +12 -10
- 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 +105 -252
- 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 +384 -0
- package/src/sdk/LiveVoiceState.ts +259 -0
- package/src/sdk/LogEntries.ts +88 -0
- package/src/sdk/Models.ts +129 -0
- package/src/sdk/NativeSdkVersions.ts +21 -0
- 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 +56 -46
- package/src/util/Colors.ts +14 -11
- package/src/util/Translations.ts +46 -22
- package/src/util/freeze.ts +23 -0
- package/src/util/logger.ts +119 -0
- package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeLiveVoiceSdkSpec.java +0 -186
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +0 -28
- package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec-generated.cpp +0 -235
- package/android/app/build/generated/source/codegen/jni/RNLiveVoiceSpec.h +0 -31
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI.h +0 -341
- package/android/src/main/java/io/livevoice/react/Mappings.kt +0 -85
- package/android/src/main/java/io/livevoice/react/NativeModels.kt +0 -79
- package/lib/module/components/AudioOutputSwitchView.js +0 -138
- package/lib/module/components/AudioOutputSwitchView.js.map +0 -1
- package/lib/module/components/index.js +0 -22
- package/lib/module/components/index.js.map +0 -1
- package/lib/module/icons/mic.png +0 -0
- package/lib/module/util/ForegroundServiceConfig.js +0 -28
- package/lib/module/util/ForegroundServiceConfig.js.map +0 -1
- package/lib/module/util/PlayingState.js +0 -21
- 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 -12
- 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 -66
- package/lib/typescript/src/util/UIState.d.ts.map +0 -1
- package/src/components/AudioOutputSwitchView.tsx +0 -146
- package/src/components/index.tsx +0 -19
- package/src/icons/mic.png +0 -0
- package/src/util/ForegroundServiceConfig.tsx +0 -32
- package/src/util/PlayingState.ts +0 -18
- package/src/util/UIState.ts +0 -89
package/README.md
CHANGED
|
@@ -1,13 +1,164 @@
|
|
|
1
|
-
#
|
|
1
|
+
# LiveVoice SDK for React Native
|
|
2
2
|
|
|
3
3
|
The React Native SDK for integrating the LiveVoice service into your app.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The LiveVoice SDK enables your app to browse and listen to your configured LiveVoice channels
|
|
8
|
-
well as present a channel's live subtitles
|
|
7
|
+
The LiveVoice SDK enables your app to browse and listen to your configured LiveVoice channels,
|
|
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
|
-
Using the LiveVoice SDK requires an account with SDK access enabled. Depending on your
|
|
11
|
-
the SDK allows for hiding the LiveVoice branding or
|
|
12
|
-
information contact sdk-support@livevoice.io
|
|
13
|
-
personal API
|
|
13
|
+
Using the LiveVoice SDK requires an account with SDK access enabled. Depending on your
|
|
14
|
+
subscription, the SDK allows for hiding the LiveVoice branding or building a fully customized
|
|
15
|
+
presentation. For more information contact sdk-support@livevoice.io. Once SDK access has been
|
|
16
|
+
granted, you can find your personal API key in the 'API/SDK Keys' section of your account page at
|
|
17
|
+
https://livevoice.io/en/account/api.
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- Browse and play the channels of a LiveVoice event
|
|
22
|
+
- Live subtitles where the channel provides them
|
|
23
|
+
- A drop-in `LiveVoiceView`, or a fully custom presentation with your own channel cells
|
|
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
|
|
29
|
+
- Optional branding control and custom UI (subscription-dependent)
|
|
30
|
+
|
|
31
|
+
## Requirements
|
|
32
|
+
|
|
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
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
npm install livevoice-sdk-react-native
|
|
42
|
+
# or
|
|
43
|
+
yarn add livevoice-sdk-react-native
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
On iOS, CocoaPods is the supported setup. Install the pods from your app's
|
|
47
|
+
`ios/` directory:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
pod install
|
|
51
|
+
```
|
|
52
|
+
|
|
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.
|
|
55
|
+
|
|
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`.
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
|
|
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
|
+
}
|
|
79
|
+
|
|
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.
|
|
100
|
+
return <LiveVoiceView />;
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
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.
|
|
106
|
+
|
|
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.
|
|
112
|
+
|
|
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.
|
|
116
|
+
|
|
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.
|
|
120
|
+
|
|
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()`.
|
|
124
|
+
|
|
125
|
+
## Background playback
|
|
126
|
+
|
|
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.
|
|
131
|
+
|
|
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.
|
|
134
|
+
|
|
135
|
+
## Examples and documentation
|
|
136
|
+
|
|
137
|
+
The [example apps](https://github.com/LiveVoiceOfficial/livevoice-sdk-examples) are the best
|
|
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.
|
|
161
|
+
|
|
162
|
+
## License
|
|
163
|
+
|
|
164
|
+
MIT
|
package/android/build.gradle
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
//
|
|
3
|
+
// This source file is part of the LiveVoice SDK project
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) LiveVoice GmbH
|
|
6
|
+
// Licensed under the MIT license
|
|
7
|
+
//
|
|
8
|
+
// See LICENSE for license information
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
13
|
+
|
|
1
14
|
buildscript {
|
|
2
15
|
ext.LiveVoiceSdkReactNative = [
|
|
3
16
|
kotlinVersion: "2.0.21",
|
|
4
17
|
minSdkVersion: 24,
|
|
5
|
-
compileSdkVersion:
|
|
6
|
-
targetSdkVersion:
|
|
18
|
+
compileSdkVersion: 37,
|
|
19
|
+
targetSdkVersion: 37
|
|
7
20
|
]
|
|
8
21
|
|
|
9
22
|
ext.getExtOrDefault = { prop ->
|
|
@@ -72,11 +85,9 @@ android {
|
|
|
72
85
|
* see: https://github.com/facebook/react-native/issues/39114
|
|
73
86
|
*/
|
|
74
87
|
rootProject.allprojects { Project project ->
|
|
75
|
-
println "Adding LiveVoice repository to project \"$project.name\""
|
|
76
88
|
project.repositories {
|
|
77
89
|
google()
|
|
78
90
|
mavenCentral()
|
|
79
|
-
maven { url "https://jitpack.io" }
|
|
80
91
|
maven { url "https://sdks.livevoice.io/android" }
|
|
81
92
|
}
|
|
82
93
|
}
|
|
@@ -84,9 +95,10 @@ android {
|
|
|
84
95
|
|
|
85
96
|
dependencies {
|
|
86
97
|
implementation "com.facebook.react:react-android"
|
|
87
|
-
|
|
98
|
+
// Exact: another requested version of the native SDK fails the build.
|
|
99
|
+
implementation("io.livevoice.sdk:android") {
|
|
100
|
+
version { strictly("3.0.0") }
|
|
88
101
|
exclude group: 'org.jspecify', module: 'jspecify'
|
|
89
102
|
}
|
|
90
|
-
implementation("com.jakewharton.timber:timber:5.0.1")
|
|
91
103
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
|
|
92
104
|
}
|
|
@@ -13,293 +13,193 @@
|
|
|
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.core.model.subtitle.SdkSubtitleState
|
|
32
|
-
import io.livevoice.sdk.android.publicApi.core.model.SdkUiState
|
|
33
|
-
import io.livevoice.sdk.android.publicApi.core.model.SdkUiState.Ready
|
|
34
|
-
import io.livevoice.sdk.android.publicApi.core.model.exceptions.SdkUninitializedException
|
|
35
|
-
import kotlinx.serialization.encodeToString
|
|
36
|
-
import kotlinx.coroutines.flow.collectLatest
|
|
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
|
|
37
31
|
import kotlinx.coroutines.launch
|
|
38
|
-
import kotlinx.serialization.ExperimentalSerializationApi
|
|
39
|
-
import kotlinx.serialization.json.ClassDiscriminatorMode
|
|
40
|
-
import kotlinx.serialization.json.Json
|
|
41
|
-
import timber.log.Timber
|
|
42
32
|
|
|
43
|
-
|
|
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)
|
|
44
39
|
@ReactModule(name = LiveVoiceModule.NAME)
|
|
45
|
-
class LiveVoiceModule(reactContext: ReactApplicationContext) :
|
|
40
|
+
internal class LiveVoiceModule(reactContext: ReactApplicationContext) :
|
|
46
41
|
NativeLiveVoiceSdkSpec(reactContext) {
|
|
47
42
|
|
|
48
|
-
private val timber = Timber.tag("[SDK]")
|
|
49
|
-
|
|
50
|
-
@OptIn(ExperimentalSerializationApi::class)
|
|
51
|
-
private val json = Json {
|
|
52
|
-
classDiscriminator = "type"
|
|
53
|
-
classDiscriminatorMode = ClassDiscriminatorMode.ALL_JSON_OBJECTS
|
|
54
|
-
}
|
|
55
|
-
|
|
56
43
|
override fun getName(): String {
|
|
57
44
|
return NAME
|
|
58
45
|
}
|
|
59
46
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"DEFAULT_MESSAGE" -> ForegroundServiceConfig.enabledWithDefaultMessage
|
|
64
|
-
else -> ForegroundServiceConfig.Enabled(NotificationText.RawValue(androidServiceConfig))
|
|
65
|
-
}
|
|
47
|
+
@Volatile private var bridge: LiveVoiceWrapperBridge? = null
|
|
48
|
+
@Volatile private var invalidated = false
|
|
49
|
+
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
|
|
66
50
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
currentActivity as? AppCompatActivity ?: run {
|
|
71
|
-
timber.e("initialize failed: currentActivity null or not an AppCompatActivity")
|
|
72
|
-
return
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
val versionInfo = ReactNativeVersion.VERSION
|
|
76
|
-
val reactVersion = "${versionInfo["major"]}.${versionInfo["minor"]}.${versionInfo["patch"]}"
|
|
77
|
-
|
|
78
|
-
//initialize SDK
|
|
79
|
-
LiveVoice.initializeLiveVoice(
|
|
80
|
-
applicationContext = activity,
|
|
81
|
-
foregroundServiceConfig = parsedServiceConfig,
|
|
82
|
-
sdkPlatform = SdkPlatform.ReactNative(
|
|
83
|
-
sdkVersion = Version.SDK_VERSION,
|
|
84
|
-
reactVersion = reactVersion
|
|
85
|
-
)
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
timber.d("finished initializing")
|
|
89
|
-
|
|
90
|
-
//observe ui-state changes
|
|
91
|
-
launchUiStateObservation(activity)
|
|
92
|
-
launchOutputModeObservation(activity)
|
|
93
|
-
launchAvailableSubtitleObservation(activity)
|
|
94
|
-
|
|
95
|
-
} catch (ex: Exception) {
|
|
96
|
-
timber.e(ex, "initialize failed")
|
|
97
|
-
}
|
|
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)
|
|
98
54
|
}
|
|
99
55
|
|
|
100
|
-
private fun
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
val uiStateString = json.encodeToString(newState.mapToTransferable())
|
|
104
|
-
timber.d("New state %s", uiStateString)
|
|
56
|
+
private fun reject(promise: Promise, code: LiveVoiceErrorCode) {
|
|
57
|
+
promise.reject(code.value, LiveVoiceWrapperBridge.errorJSON(code, reactApplicationContext))
|
|
58
|
+
}
|
|
105
59
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
|
109
68
|
}
|
|
110
69
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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) })
|
|
116
79
|
}
|
|
117
|
-
}
|
|
80
|
+
} }
|
|
118
81
|
|
|
119
|
-
private fun
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
82
|
+
private fun launchObservations(owner: LiveVoiceWrapperBridge) {
|
|
83
|
+
scope.launch {
|
|
84
|
+
owner.invalidation.first { it }
|
|
85
|
+
invalidated = true
|
|
86
|
+
scope.coroutineContext[Job]?.cancel()
|
|
125
87
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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) })
|
|
136
105
|
}
|
|
137
106
|
}
|
|
138
107
|
}
|
|
139
108
|
|
|
140
|
-
override fun
|
|
141
|
-
val state = getStateOrNull<Ready>("startChannel") ?: return
|
|
142
|
-
val longId = id.toLong()
|
|
109
|
+
override fun getErrorMessages(): String = LiveVoiceWrapperBridge.errorMessagesJSON(reactApplicationContext)
|
|
143
110
|
|
|
144
|
-
|
|
145
|
-
|
|
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) }
|
|
146
115
|
}
|
|
147
116
|
|
|
148
|
-
override fun
|
|
149
|
-
|
|
150
|
-
val channel = state.channels.firstOrNull { it.playingState in listOf(Connecting, Playing) }
|
|
151
|
-
?: run {
|
|
152
|
-
timber.w("No channel in connecting or playing state to stop!")
|
|
153
|
-
return
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
timber.d("calling stopChannel(${channel.id})")
|
|
157
|
-
state.onStopChannel(channel.id)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
override fun getCurrentUiState(): String {
|
|
161
|
-
return try {
|
|
162
|
-
timber.d("Getting current ui-state")
|
|
163
|
-
val currentState: SdkUiState = LiveVoice.uiState.value
|
|
164
|
-
json.encodeToString(currentState.mapToTransferable())
|
|
165
|
-
} catch (ex: Exception) {
|
|
166
|
-
timber.w(ex, "Tried accessing state without prior initialization, returning default!")
|
|
167
|
-
json.encodeToString(NativeLoading)
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
override fun getCurrentAudioState(): Boolean {
|
|
172
|
-
return try {
|
|
173
|
-
LiveVoice.outputMode.value == LiveVoiceOutput.SPEAKER
|
|
174
|
-
} catch (ex: Exception) {
|
|
175
|
-
timber.w(ex, "Tried accessing audio state without prior initialization, returning default!")
|
|
176
|
-
false
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
override fun getCurrentSubtitles(): String {
|
|
181
|
-
val value = LiveVoice.subtitleState.value
|
|
182
|
-
if (value !is SdkSubtitleState.Enabled) return "[]"
|
|
183
|
-
|
|
184
|
-
return json.encodeToString(value.fragments.value)
|
|
117
|
+
override fun writeLogEntry(payload: String) {
|
|
118
|
+
LiveVoiceWrapperBridge.writeLogEntry(payload)
|
|
185
119
|
}
|
|
186
120
|
|
|
187
|
-
override fun
|
|
188
|
-
|
|
189
|
-
return json.encodeToString(value.map { it.mapToNative() })
|
|
121
|
+
override fun answerPasswordRequest(payload: String) {
|
|
122
|
+
UiThreadUtil.runOnUiThread { if (!invalidated) bridge?.answerPasswordRequest(payload) }
|
|
190
123
|
}
|
|
191
124
|
|
|
192
|
-
override fun
|
|
193
|
-
|
|
194
|
-
return json.encodeToString(claims ?: return null)
|
|
125
|
+
override fun answerPasswordStoreRequest(payload: String) {
|
|
126
|
+
UiThreadUtil.runOnUiThread { if (!invalidated) bridge?.answerPasswordStoreRequest(payload) }
|
|
195
127
|
}
|
|
196
128
|
|
|
197
|
-
override fun
|
|
198
|
-
|
|
129
|
+
override fun setPasswordStore(payload: String) {
|
|
130
|
+
UiThreadUtil.runOnUiThread { if (!invalidated) bridge?.setPasswordStore(payload) }
|
|
199
131
|
}
|
|
200
132
|
|
|
201
|
-
override fun
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
override fun stopSubtitles() {
|
|
210
|
-
val state = getStateOrNull<Ready>("stopSubtitles") ?: return
|
|
211
|
-
state.onStopSubtitles()
|
|
133
|
+
override fun invalidate() {
|
|
134
|
+
invalidated = true
|
|
135
|
+
bridge?.requestInvalidation()
|
|
136
|
+
UiThreadUtil.runOnUiThread {
|
|
137
|
+
bridge?.invalidate(); bridge = null
|
|
138
|
+
scope.coroutineContext[Job]?.cancel()
|
|
139
|
+
}
|
|
140
|
+
super.invalidate()
|
|
212
141
|
}
|
|
213
142
|
|
|
214
143
|
override fun openLiveVoiceWebsite() {
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
override fun joinEvent(joinCode: String, password: String?, apiKey: String) {
|
|
219
|
-
val scope = (reactApplicationContext.currentActivity as? ComponentActivity)?.lifecycleScope
|
|
220
|
-
?: error("Could not create scope to connect! activity: ${reactApplicationContext.currentActivity}")
|
|
221
|
-
|
|
222
|
-
scope.launch {
|
|
223
|
-
LiveVoice.joinEvent(joinCode, password, apiKey)
|
|
224
|
-
}
|
|
144
|
+
LiveVoiceWrapperBridge.openLiveVoiceWebsite(reactApplicationContext)
|
|
225
145
|
}
|
|
226
146
|
|
|
227
|
-
override fun
|
|
228
|
-
LiveVoice.leaveEvent()
|
|
229
|
-
}
|
|
147
|
+
override fun getSdkVersion(): String = Version.SDK_VERSION
|
|
230
148
|
|
|
231
|
-
override fun
|
|
149
|
+
override fun getNativeSdkVersion(): String = LiveVoice.sdkVersion
|
|
232
150
|
|
|
233
|
-
override fun channelStatusOffline(): String =
|
|
151
|
+
override fun channelStatusOffline(): String = LiveVoiceWrapperBridge.channelStatusOffline(reactApplicationContext)
|
|
234
152
|
|
|
235
|
-
override fun noChannels(): String =
|
|
153
|
+
override fun noChannels(): String = LiveVoiceWrapperBridge.noChannels(reactApplicationContext)
|
|
236
154
|
|
|
237
155
|
override fun isAiChannelStatusMessage(): String =
|
|
238
|
-
|
|
156
|
+
LiveVoiceWrapperBridge.isAiChannelStatusMessage(reactApplicationContext)
|
|
239
157
|
|
|
240
158
|
override fun errorScreenRetrying(): String =
|
|
241
|
-
|
|
159
|
+
LiveVoiceWrapperBridge.errorScreenRetrying(reactApplicationContext)
|
|
242
160
|
|
|
243
161
|
override fun errorScreenRetryingIn(seconds: Double): String =
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
override fun sdkErrorGeneric(): String =
|
|
247
|
-
LiveVoice.translations.sdkErrorGeneric()
|
|
248
|
-
|
|
249
|
-
override fun sdkErrorInactive(): String =
|
|
250
|
-
LiveVoice.translations.sdkErrorInactive()
|
|
251
|
-
|
|
252
|
-
override fun sdkErrorInvalidApiKey(): String =
|
|
253
|
-
LiveVoice.translations.sdkErrorInvalidApiKey()
|
|
254
|
-
|
|
255
|
-
override fun sdkErrorListenerLimitReached(): String =
|
|
256
|
-
LiveVoice.translations.sdkErrorListenerLimitReached()
|
|
257
|
-
|
|
258
|
-
override fun sdkErrorNoNetwork(): String =
|
|
259
|
-
LiveVoice.translations.sdkErrorNoNetwork()
|
|
260
|
-
|
|
261
|
-
override fun sdkErrorNotFound(): String =
|
|
262
|
-
LiveVoice.translations.sdkErrorNotFound()
|
|
263
|
-
|
|
264
|
-
override fun sdkErrorRequestFailed(errorCode: Double): String =
|
|
265
|
-
LiveVoice.translations.sdkErrorRequestFailed(errorCode.toInt())
|
|
266
|
-
|
|
267
|
-
override fun sdkErrorWrongPassword(): String =
|
|
268
|
-
LiveVoice.translations.sdkErrorWrongPassword()
|
|
162
|
+
LiveVoiceWrapperBridge.errorScreenRetryingIn(reactApplicationContext, seconds.toLong())
|
|
269
163
|
|
|
270
164
|
override fun sdkNoMatchingChannels(): String =
|
|
271
|
-
|
|
165
|
+
LiveVoiceWrapperBridge.sdkNoMatchingChannels(reactApplicationContext)
|
|
272
166
|
|
|
273
167
|
override fun streamingByTitle(): String =
|
|
274
|
-
|
|
168
|
+
LiveVoiceWrapperBridge.streamingByTitle(reactApplicationContext)
|
|
275
169
|
|
|
276
170
|
override fun errorRetryNowButton(): String =
|
|
277
|
-
|
|
171
|
+
LiveVoiceWrapperBridge.errorRetryNowButton(reactApplicationContext)
|
|
278
172
|
|
|
279
173
|
override fun accessibilityChannelPlay(): String =
|
|
280
|
-
|
|
174
|
+
LiveVoiceWrapperBridge.accessibilityChannelPlay(reactApplicationContext)
|
|
281
175
|
|
|
282
176
|
override fun accessibilityChannelStatusMuted(): String =
|
|
283
|
-
|
|
177
|
+
LiveVoiceWrapperBridge.accessibilityChannelStatusMuted(reactApplicationContext)
|
|
284
178
|
|
|
285
179
|
override fun accessibilityChannelStop(): String =
|
|
286
|
-
|
|
180
|
+
LiveVoiceWrapperBridge.accessibilityChannelStop(reactApplicationContext)
|
|
287
181
|
|
|
182
|
+
override fun passwordPromptTitle(): String = LiveVoiceWrapperBridge.passwordPromptTitle(reactApplicationContext)
|
|
288
183
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
LiveVoice.uiState.value
|
|
292
|
-
} catch (ex: SdkUninitializedException) {
|
|
293
|
-
timber.e(ex, "Tried accessing state without prior initialization")
|
|
294
|
-
null
|
|
295
|
-
}
|
|
184
|
+
override fun passwordPromptChannelMessage(): String =
|
|
185
|
+
LiveVoiceWrapperBridge.passwordPromptChannelMessage(reactApplicationContext)
|
|
296
186
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
187
|
+
override fun passwordPromptEventMessage(): String =
|
|
188
|
+
LiveVoiceWrapperBridge.passwordPromptEventMessage(reactApplicationContext)
|
|
189
|
+
|
|
190
|
+
override fun passwordPromptWrongPassword(): String =
|
|
191
|
+
LiveVoiceWrapperBridge.passwordPromptWrongPassword(reactApplicationContext)
|
|
192
|
+
|
|
193
|
+
override fun passwordPromptField(): String = LiveVoiceWrapperBridge.passwordPromptField(reactApplicationContext)
|
|
194
|
+
|
|
195
|
+
override fun passwordPromptCancelButton(): String =
|
|
196
|
+
LiveVoiceWrapperBridge.passwordPromptCancelButton(reactApplicationContext)
|
|
197
|
+
|
|
198
|
+
override fun passwordPromptChannelConfirmButton(): String =
|
|
199
|
+
LiveVoiceWrapperBridge.passwordPromptChannelConfirmButton(reactApplicationContext)
|
|
200
|
+
|
|
201
|
+
override fun passwordPromptEventConfirmButton(): String =
|
|
202
|
+
LiveVoiceWrapperBridge.passwordPromptEventConfirmButton(reactApplicationContext)
|
|
303
203
|
|
|
304
204
|
companion object {
|
|
305
205
|
const val NAME = "LiveVoiceModule"
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
//
|
|
3
|
+
// This source file is part of the LiveVoice SDK project
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) LiveVoice GmbH
|
|
6
|
+
// Licensed under the MIT license
|
|
7
|
+
//
|
|
8
|
+
// See LICENSE for license information
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
13
|
+
|
|
14
|
+
// GENERATED CODE - DO NOT MODIFY BY HAND.
|
|
15
|
+
// Generated by tool/generate-native-versions.mjs from package.json.
|
|
2
16
|
package io.livevoice.react
|
|
3
17
|
|
|
4
|
-
object Version {
|
|
5
|
-
const val SDK_VERSION = "
|
|
18
|
+
internal object Version {
|
|
19
|
+
const val SDK_VERSION = "3.0.0"
|
|
6
20
|
}
|