livevoice-sdk-react-native 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +119 -7
- package/android/build.gradle +14 -3
- package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +89 -123
- package/android/src/main/java/io/livevoice/react/__SDK.kt +16 -2
- package/ios/LiveVoiceSdkReactNative.mm +110 -37
- package/ios/__SDK.h +16 -2
- package/lib/module/components/AudioOutputSwitchView.js +13 -13
- package/lib/module/components/AudioOutputSwitchView.js.map +1 -1
- package/lib/module/components/BrandingView.js +13 -11
- package/lib/module/components/BrandingView.js.map +1 -1
- package/lib/module/components/ChannelView.js +14 -11
- package/lib/module/components/ChannelView.js.map +1 -1
- package/lib/module/components/ErrorView.js +12 -10
- package/lib/module/components/ErrorView.js.map +1 -1
- package/lib/module/components/LiveVoiceView.js +141 -72
- package/lib/module/components/LiveVoiceView.js.map +1 -1
- package/lib/module/components/PlayButtonView.js +12 -10
- package/lib/module/components/PlayButtonView.js.map +1 -1
- package/lib/module/components/ReconnectingView.js +16 -13
- 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/components/index.js +12 -10
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/index.js +14 -220
- package/lib/module/index.js.map +1 -1
- package/lib/module/sdk/LiveVoiceSdk.js +371 -0
- package/lib/module/sdk/LiveVoiceSdk.js.map +1 -0
- package/lib/module/sdk/LiveVoiceState.js +66 -0
- package/lib/module/sdk/LiveVoiceState.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 +12 -10
- package/lib/module/util/Colors.js.map +1 -1
- package/lib/module/util/ForegroundServiceConfig.js +21 -11
- package/lib/module/util/ForegroundServiceConfig.js.map +1 -1
- package/lib/module/util/PlayingState.js +12 -10
- package/lib/module/util/PlayingState.js.map +1 -1
- package/lib/module/util/Translations.js +12 -10
- package/lib/module/util/Translations.js.map +1 -1
- package/lib/module/util/logger.js +76 -0
- package/lib/module/util/logger.js.map +1 -0
- package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +1 -1
- package/lib/typescript/src/components/BrandingView.d.ts.map +1 -1
- package/lib/typescript/src/components/ChannelView.d.ts.map +1 -1
- package/lib/typescript/src/components/ErrorView.d.ts.map +1 -1
- package/lib/typescript/src/components/LiveVoiceView.d.ts +22 -0
- package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -1
- package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -1
- 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/components/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +6 -144
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts +210 -0
- package/lib/typescript/src/sdk/LiveVoiceSdk.d.ts.map +1 -0
- package/lib/typescript/src/sdk/LiveVoiceState.d.ts +12 -0
- package/lib/typescript/src/sdk/LiveVoiceState.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts +3 -0
- 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/ForegroundServiceConfig.d.ts +7 -0
- package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +1 -1
- package/lib/typescript/src/util/PlayingState.d.ts.map +1 -1
- package/lib/typescript/src/util/Translations.d.ts.map +1 -1
- package/lib/typescript/src/util/UIState.d.ts +22 -2
- package/lib/typescript/src/util/UIState.d.ts.map +1 -1
- package/lib/typescript/src/util/logger.d.ts +23 -0
- package/lib/typescript/src/util/logger.d.ts.map +1 -0
- package/livevoice-sdk-react-native.podspec +14 -14
- package/package.json +16 -7
- package/src/components/AudioOutputSwitchView.tsx +13 -13
- package/src/components/BrandingView.tsx +13 -11
- package/src/components/ChannelView.tsx +14 -11
- package/src/components/ErrorView.tsx +12 -10
- package/src/components/LiveVoiceView.tsx +183 -92
- package/src/components/PlayButtonView.tsx +12 -10
- package/src/components/ReconnectingView.tsx +20 -13
- package/src/components/WarningView.tsx +12 -10
- package/src/components/index.tsx +12 -10
- package/src/index.tsx +19 -252
- package/src/sdk/LiveVoiceSdk.ts +408 -0
- package/src/sdk/LiveVoiceState.ts +89 -0
- package/src/specs/NativeLiveVoiceSdk.ts +16 -10
- package/src/util/Colors.ts +12 -10
- package/src/util/ForegroundServiceConfig.tsx +21 -11
- package/src/util/PlayingState.ts +12 -10
- package/src/util/Translations.ts +12 -10
- package/src/util/UIState.ts +30 -13
- package/src/util/logger.ts +92 -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
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
// Internal state accessors used by LiveVoiceView. These are intentionally NOT re-exported from
|
|
15
|
+
// the package entry point (`src/index.tsx`); the public, app-facing way to consume state is the
|
|
16
|
+
// `renderChannel` prop on `LiveVoiceView`. The deprecated public wrappers in `LiveVoiceSdk.ts`
|
|
17
|
+
// delegate here, which keeps the SDK's own usage free of deprecation warnings.
|
|
18
|
+
|
|
19
|
+
import LiveVoiceSdkReactNative from '../specs/NativeLiveVoiceSdk';
|
|
20
|
+
import { type UiState, type Channel } from '../util/UIState';
|
|
21
|
+
import { logUiState } from '../util/logger';
|
|
22
|
+
|
|
23
|
+
/** Authorization features for the joined event. Internal: the view uses it for branding/gating. */
|
|
24
|
+
export type Claims = { hideBranding: boolean; customUiAllowed: boolean };
|
|
25
|
+
|
|
26
|
+
type UiStateWire = {
|
|
27
|
+
type: 'loading';
|
|
28
|
+
} | {
|
|
29
|
+
type: 'ready';
|
|
30
|
+
channels: Channel[];
|
|
31
|
+
isHeadphonesOnly: boolean;
|
|
32
|
+
outputMode: string;
|
|
33
|
+
} | {
|
|
34
|
+
type: 'error';
|
|
35
|
+
message: string;
|
|
36
|
+
canBeRetried: boolean;
|
|
37
|
+
} | {
|
|
38
|
+
type: 'reconnecting';
|
|
39
|
+
state:
|
|
40
|
+
| { type: 'inProgress' }
|
|
41
|
+
| { type: 'awaitingRetry'; atTimestamp: number };
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export function getCurrentClaims(): Claims | null {
|
|
45
|
+
const claims = LiveVoiceSdkReactNative.getCurrentClaims();
|
|
46
|
+
if (claims == null) return null;
|
|
47
|
+
return JSON.parse(claims);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function getCurrentUiState(): UiState {
|
|
51
|
+
return parseUiState(LiveVoiceSdkReactNative.getCurrentUiState());
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function onUiStateChanged(handler: (arg: UiState) => void): {
|
|
55
|
+
remove: () => void;
|
|
56
|
+
} {
|
|
57
|
+
return LiveVoiceSdkReactNative.onUiStateChanged((data: string) => {
|
|
58
|
+
const state = parseUiState(data);
|
|
59
|
+
logUiState(state);
|
|
60
|
+
handler(state);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function parseUiState(data: string): UiState {
|
|
65
|
+
return hydrateUiState(JSON.parse(data) as UiStateWire);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function hydrateUiState(state: UiStateWire): UiState {
|
|
69
|
+
if (state.type === 'ready') {
|
|
70
|
+
const { isHeadphonesOnly: _ignored, ...publicState } = state;
|
|
71
|
+
return publicState;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (state.type !== 'reconnecting') {
|
|
75
|
+
return state as UiState;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (state.state.type !== 'awaitingRetry') {
|
|
79
|
+
return state as UiState;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
...state,
|
|
84
|
+
state: {
|
|
85
|
+
...state.state,
|
|
86
|
+
retryAt: new Date(state.state.atTimestamp * 1000),
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
//
|
|
3
|
+
// This source file is part of the LiveVoice SDK project
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) LiveVoice GmbH
|
|
6
|
+
// Licensed under the MIT license
|
|
7
|
+
//
|
|
8
|
+
// See LICENSE for license information
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
11
13
|
|
|
12
14
|
import { TurboModuleRegistry, type TurboModule, type CodegenTypes } from 'react-native';
|
|
13
15
|
|
|
@@ -27,6 +29,7 @@ export interface Spec extends TurboModule {
|
|
|
27
29
|
getCurrentUiState(): string;
|
|
28
30
|
getCurrentAudioState(): boolean; //true=speaker, false=headphones
|
|
29
31
|
getCurrentSubtitles(): string;
|
|
32
|
+
getCurrentSubtitleState(): string;
|
|
30
33
|
getCurrentAvailableSubtitleConfigs(): string;
|
|
31
34
|
|
|
32
35
|
// applicable for 'ready' state
|
|
@@ -43,12 +46,15 @@ export interface Spec extends TurboModule {
|
|
|
43
46
|
|
|
44
47
|
openLiveVoiceWebsite(): void
|
|
45
48
|
|
|
49
|
+
getSdkVersion(): string
|
|
50
|
+
|
|
46
51
|
// Events
|
|
47
52
|
|
|
48
53
|
readonly onUiStateChanged: EventEmitter<string>
|
|
49
54
|
readonly onAudioOutputChanged: EventEmitter<boolean>
|
|
50
55
|
readonly onAvailableSubtitleConfigsChanged: EventEmitter<string>
|
|
51
56
|
readonly onSubtitlesChanged: EventEmitter<string>
|
|
57
|
+
readonly onSubtitleStateChanged: EventEmitter<string>
|
|
52
58
|
|
|
53
59
|
// Translations
|
|
54
60
|
|
package/src/util/Colors.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
//
|
|
3
|
+
// This source file is part of the LiveVoice SDK project
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) LiveVoice GmbH
|
|
6
|
+
// Licensed under the MIT license
|
|
7
|
+
//
|
|
8
|
+
// See LICENSE for license information
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
11
13
|
|
|
12
14
|
export const COLORS = {
|
|
13
15
|
primary: '#F1521B',
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
//
|
|
3
|
+
// This source file is part of the LiveVoice SDK project
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) LiveVoice GmbH
|
|
6
|
+
// Licensed under the MIT license
|
|
7
|
+
//
|
|
8
|
+
// See LICENSE for license information
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
11
13
|
|
|
12
14
|
// Define the union type and interfaces
|
|
13
15
|
export type ForegroundServiceConfig = Disabled | Enabled;
|
|
@@ -21,10 +23,18 @@ export interface Enabled {
|
|
|
21
23
|
message: string | null;
|
|
22
24
|
}
|
|
23
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Sentinel sent to the native module to request the SDK's built-in default notification
|
|
28
|
+
* message. The Android native module recognizes this exact string (see
|
|
29
|
+
* `DEFAULT_MESSAGE_SENTINEL` in `LiveVoiceModule.kt`) and substitutes the real default — the
|
|
30
|
+
* two must stay in sync. iOS ignores the foreground-service config entirely.
|
|
31
|
+
*/
|
|
32
|
+
export const DEFAULT_MESSAGE_SENTINEL = 'LV_NOTIFICATION_DEFAULT_MESSAGE';
|
|
33
|
+
|
|
24
34
|
// Named exports for the constants and function
|
|
25
35
|
export const serviceDisabled: Disabled = { type: 'Disabled' };
|
|
26
36
|
|
|
27
|
-
export const serviceEnabledWithDefaultMessage: Enabled = { type: 'Enabled', message:
|
|
37
|
+
export const serviceEnabledWithDefaultMessage: Enabled = { type: 'Enabled', message: DEFAULT_MESSAGE_SENTINEL };
|
|
28
38
|
|
|
29
39
|
export const serviceEnabledWithMessage = (message: string | null): Enabled => ({
|
|
30
40
|
type: 'Enabled',
|
package/src/util/PlayingState.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
//
|
|
3
|
+
// This source file is part of the LiveVoice SDK project
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) LiveVoice GmbH
|
|
6
|
+
// Licensed under the MIT license
|
|
7
|
+
//
|
|
8
|
+
// See LICENSE for license information
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
11
13
|
|
|
12
14
|
export enum PlayingState {
|
|
13
15
|
STOPPED = 'STOPPED',
|
package/src/util/Translations.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
//
|
|
3
|
+
// This source file is part of the LiveVoice SDK project
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) LiveVoice GmbH
|
|
6
|
+
// Licensed under the MIT license
|
|
7
|
+
//
|
|
8
|
+
// See LICENSE for license information
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* @fileoverview Translated strings for the React Native SDK.
|
package/src/util/UIState.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
//
|
|
3
|
+
// This source file is part of the LiveVoice SDK project
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) LiveVoice GmbH
|
|
6
|
+
// Licensed under the MIT license
|
|
7
|
+
//
|
|
8
|
+
// See LICENSE for license information
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
11
13
|
|
|
12
14
|
import { type PlayingState } from './PlayingState';
|
|
13
15
|
|
|
@@ -19,7 +21,6 @@ export type UiState = Ready | ErrorState | Loading | Reconnecting
|
|
|
19
21
|
export interface Ready {
|
|
20
22
|
type: 'ready';
|
|
21
23
|
channels: Channel[];
|
|
22
|
-
isHeadphonesOnly: boolean;
|
|
23
24
|
outputMode: string;
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -39,6 +40,10 @@ export interface RetryInProgress {
|
|
|
39
40
|
|
|
40
41
|
export interface AwaitingRetry {
|
|
41
42
|
type: 'awaitingRetry';
|
|
43
|
+
retryAt: Date;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated Use retryAt instead. This is a Unix timestamp in seconds.
|
|
46
|
+
*/
|
|
42
47
|
atTimestamp: number;
|
|
43
48
|
}
|
|
44
49
|
|
|
@@ -63,7 +68,7 @@ export interface Channel {
|
|
|
63
68
|
hasSubtitles: boolean;
|
|
64
69
|
isAudioMuted: boolean;
|
|
65
70
|
aiTranslationInfo: AITranslationInfo | null;
|
|
66
|
-
|
|
71
|
+
dependentChannels: DependentChannel[];
|
|
67
72
|
playingState: PlayingState;
|
|
68
73
|
}
|
|
69
74
|
|
|
@@ -86,4 +91,16 @@ export interface AvailableSubtitle {
|
|
|
86
91
|
name: string;
|
|
87
92
|
language: string | null;
|
|
88
93
|
parent: number | null;
|
|
89
|
-
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The current subtitle state.
|
|
98
|
+
*
|
|
99
|
+
* - `disabled`: no subtitles are being received.
|
|
100
|
+
* - `automatic`: subtitles follow the currently playing channel.
|
|
101
|
+
* - `specific`: subtitles for an explicitly chosen channel.
|
|
102
|
+
*/
|
|
103
|
+
export type SubtitleState =
|
|
104
|
+
| { type: 'disabled' }
|
|
105
|
+
| { type: 'automatic'; fragments: string[] }
|
|
106
|
+
| { type: 'specific'; channelId: number; fragments: string[] };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
//===----------------------------------------------------------------------===//
|
|
2
|
+
//
|
|
3
|
+
// This source file is part of the LiveVoice SDK project
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) LiveVoice GmbH
|
|
6
|
+
// Licensed under the MIT license
|
|
7
|
+
//
|
|
8
|
+
// See LICENSE for license information
|
|
9
|
+
//
|
|
10
|
+
// SPDX-License-Identifier: MIT
|
|
11
|
+
//
|
|
12
|
+
//===----------------------------------------------------------------------===//
|
|
13
|
+
|
|
14
|
+
import { type ForegroundServiceConfig } from "./ForegroundServiceConfig";
|
|
15
|
+
import { type UiState, type RetryState } from "./UIState";
|
|
16
|
+
|
|
17
|
+
type LogFields = Record<string, string | number | boolean | null | undefined>;
|
|
18
|
+
|
|
19
|
+
export const LiveVoiceLogEvent = {
|
|
20
|
+
init: "LV_INIT",
|
|
21
|
+
joinRequest: "LV_JOIN_REQUEST",
|
|
22
|
+
leave: "LV_LEAVE",
|
|
23
|
+
reconnectRequest: "LV_RECONNECT_REQUEST",
|
|
24
|
+
uiState: "LV_UI_STATE",
|
|
25
|
+
audioOutputSet: "LV_AUDIO_OUTPUT_SET",
|
|
26
|
+
audioOutputChanged: "LV_AUDIO_OUTPUT_CHANGED",
|
|
27
|
+
channelStart: "LV_CHANNEL_START",
|
|
28
|
+
channelStop: "LV_CHANNEL_STOP",
|
|
29
|
+
subtitlesStart: "LV_SUBTITLES_START",
|
|
30
|
+
subtitlesStop: "LV_SUBTITLES_STOP",
|
|
31
|
+
openWebsite: "LV_OPEN_WEBSITE",
|
|
32
|
+
} as const;
|
|
33
|
+
|
|
34
|
+
export function logInfo(event: string, fields?: LogFields): void {
|
|
35
|
+
console.info(formatMessage("INFO", event, fields));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function logUiState(state: UiState): void {
|
|
39
|
+
logInfo(LiveVoiceLogEvent.uiState, describeUiState(state));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function logAudioOutputChanged(useSpeaker: boolean): void {
|
|
43
|
+
logInfo(LiveVoiceLogEvent.audioOutputChanged, {
|
|
44
|
+
mode: useSpeaker ? "speaker" : "receiver",
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function describeForegroundServiceConfig(
|
|
49
|
+
serviceConfig: ForegroundServiceConfig,
|
|
50
|
+
): string {
|
|
51
|
+
if (serviceConfig.type === "Disabled") return "disabled";
|
|
52
|
+
return serviceConfig.message == null ? "default" : "custom";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function describeUiState(state: UiState): LogFields {
|
|
56
|
+
switch (state.type) {
|
|
57
|
+
case "loading":
|
|
58
|
+
return { type: "loading" };
|
|
59
|
+
case "ready":
|
|
60
|
+
return {
|
|
61
|
+
channelCount: state.channels.length,
|
|
62
|
+
outputMode: state.outputMode,
|
|
63
|
+
type: "ready",
|
|
64
|
+
};
|
|
65
|
+
case "error":
|
|
66
|
+
return {
|
|
67
|
+
canBeRetried: state.canBeRetried,
|
|
68
|
+
type: "error",
|
|
69
|
+
};
|
|
70
|
+
case "reconnecting":
|
|
71
|
+
return {
|
|
72
|
+
retryState: describeRetryState(state.state),
|
|
73
|
+
type: "reconnecting",
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function describeRetryState(state: RetryState): string {
|
|
79
|
+
return state.type;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function formatMessage(level: string, event: string, fields?: LogFields): string {
|
|
83
|
+
const fieldText = fields == null ? "" : Object.entries(fields)
|
|
84
|
+
.filter(([, value]) => value != null)
|
|
85
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
86
|
+
.map(([key, value]) => `${key}=${value}`)
|
|
87
|
+
.join(" ");
|
|
88
|
+
|
|
89
|
+
return ["[LiveVoiceSDK]", level, event, fieldText]
|
|
90
|
+
.filter((part) => part.length > 0)
|
|
91
|
+
.join(" ");
|
|
92
|
+
}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
-
*
|
|
5
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
-
* once the code is regenerated.
|
|
7
|
-
*
|
|
8
|
-
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
-
*
|
|
10
|
-
* @nolint
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
package com.facebook.fbreact.specs;
|
|
14
|
-
|
|
15
|
-
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
18
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
19
|
-
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
20
|
-
import javax.annotation.Nonnull;
|
|
21
|
-
import javax.annotation.Nullable;
|
|
22
|
-
|
|
23
|
-
public abstract class NativeLiveVoiceSdkSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
24
|
-
public static final String NAME = "LiveVoiceModule";
|
|
25
|
-
|
|
26
|
-
public NativeLiveVoiceSdkSpec(ReactApplicationContext reactContext) {
|
|
27
|
-
super(reactContext);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
@Override
|
|
31
|
-
public @Nonnull String getName() {
|
|
32
|
-
return NAME;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
protected final void emitOnUiStateChanged(String value) {
|
|
36
|
-
mEventEmitterCallback.invoke("onUiStateChanged", value);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
protected final void emitOnAudioOutputChanged(boolean value) {
|
|
40
|
-
mEventEmitterCallback.invoke("onAudioOutputChanged", value);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
protected final void emitOnAvailableSubtitleConfigsChanged(String value) {
|
|
44
|
-
mEventEmitterCallback.invoke("onAvailableSubtitleConfigsChanged", value);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
protected final void emitOnSubtitlesChanged(String value) {
|
|
48
|
-
mEventEmitterCallback.invoke("onSubtitlesChanged", value);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
@ReactMethod
|
|
52
|
-
@DoNotStrip
|
|
53
|
-
public abstract void initialize(@Nullable String androidServiceConfig);
|
|
54
|
-
|
|
55
|
-
@ReactMethod
|
|
56
|
-
@DoNotStrip
|
|
57
|
-
public abstract void joinEvent(String joinCode, @Nullable String password, String apiKey);
|
|
58
|
-
|
|
59
|
-
@ReactMethod
|
|
60
|
-
@DoNotStrip
|
|
61
|
-
public abstract void leaveEvent();
|
|
62
|
-
|
|
63
|
-
@ReactMethod
|
|
64
|
-
@DoNotStrip
|
|
65
|
-
public abstract void reconnect();
|
|
66
|
-
|
|
67
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
68
|
-
@DoNotStrip
|
|
69
|
-
public abstract @Nullable String getCurrentClaims();
|
|
70
|
-
|
|
71
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
72
|
-
@DoNotStrip
|
|
73
|
-
public abstract String getCurrentUiState();
|
|
74
|
-
|
|
75
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
76
|
-
@DoNotStrip
|
|
77
|
-
public abstract boolean getCurrentAudioState();
|
|
78
|
-
|
|
79
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
80
|
-
@DoNotStrip
|
|
81
|
-
public abstract String getCurrentSubtitles();
|
|
82
|
-
|
|
83
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
84
|
-
@DoNotStrip
|
|
85
|
-
public abstract String getCurrentAvailableSubtitleConfigs();
|
|
86
|
-
|
|
87
|
-
@ReactMethod
|
|
88
|
-
@DoNotStrip
|
|
89
|
-
public abstract void setLiveVoiceUseSpeaker(boolean value);
|
|
90
|
-
|
|
91
|
-
@ReactMethod
|
|
92
|
-
@DoNotStrip
|
|
93
|
-
public abstract void startChannel(double id);
|
|
94
|
-
|
|
95
|
-
@ReactMethod
|
|
96
|
-
@DoNotStrip
|
|
97
|
-
public abstract void stopChannel();
|
|
98
|
-
|
|
99
|
-
@ReactMethod
|
|
100
|
-
@DoNotStrip
|
|
101
|
-
public abstract void startSubtitles(double channelId);
|
|
102
|
-
|
|
103
|
-
@ReactMethod
|
|
104
|
-
@DoNotStrip
|
|
105
|
-
public abstract void stopSubtitles();
|
|
106
|
-
|
|
107
|
-
@ReactMethod
|
|
108
|
-
@DoNotStrip
|
|
109
|
-
public abstract void openLiveVoiceWebsite();
|
|
110
|
-
|
|
111
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
112
|
-
@DoNotStrip
|
|
113
|
-
public abstract String channelStatusOffline();
|
|
114
|
-
|
|
115
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
116
|
-
@DoNotStrip
|
|
117
|
-
public abstract String noChannels();
|
|
118
|
-
|
|
119
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
120
|
-
@DoNotStrip
|
|
121
|
-
public abstract String isAiChannelStatusMessage();
|
|
122
|
-
|
|
123
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
124
|
-
@DoNotStrip
|
|
125
|
-
public abstract String sdkNoMatchingChannels();
|
|
126
|
-
|
|
127
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
128
|
-
@DoNotStrip
|
|
129
|
-
public abstract String errorScreenRetrying();
|
|
130
|
-
|
|
131
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
132
|
-
@DoNotStrip
|
|
133
|
-
public abstract String errorScreenRetryingIn(double seconds);
|
|
134
|
-
|
|
135
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
136
|
-
@DoNotStrip
|
|
137
|
-
public abstract String sdkErrorGeneric();
|
|
138
|
-
|
|
139
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
140
|
-
@DoNotStrip
|
|
141
|
-
public abstract String sdkErrorInactive();
|
|
142
|
-
|
|
143
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
144
|
-
@DoNotStrip
|
|
145
|
-
public abstract String sdkErrorInvalidApiKey();
|
|
146
|
-
|
|
147
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
148
|
-
@DoNotStrip
|
|
149
|
-
public abstract String sdkErrorListenerLimitReached();
|
|
150
|
-
|
|
151
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
152
|
-
@DoNotStrip
|
|
153
|
-
public abstract String sdkErrorNoNetwork();
|
|
154
|
-
|
|
155
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
156
|
-
@DoNotStrip
|
|
157
|
-
public abstract String sdkErrorNotFound();
|
|
158
|
-
|
|
159
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
160
|
-
@DoNotStrip
|
|
161
|
-
public abstract String sdkErrorRequestFailed(double errorCode);
|
|
162
|
-
|
|
163
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
164
|
-
@DoNotStrip
|
|
165
|
-
public abstract String sdkErrorWrongPassword();
|
|
166
|
-
|
|
167
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
168
|
-
@DoNotStrip
|
|
169
|
-
public abstract String streamingByTitle();
|
|
170
|
-
|
|
171
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
172
|
-
@DoNotStrip
|
|
173
|
-
public abstract String errorRetryNowButton();
|
|
174
|
-
|
|
175
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
176
|
-
@DoNotStrip
|
|
177
|
-
public abstract String accessibilityChannelPlay();
|
|
178
|
-
|
|
179
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
180
|
-
@DoNotStrip
|
|
181
|
-
public abstract String accessibilityChannelStatusMuted();
|
|
182
|
-
|
|
183
|
-
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
184
|
-
@DoNotStrip
|
|
185
|
-
public abstract String accessibilityChannelStop();
|
|
186
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
#
|
|
3
|
-
# This source code is licensed under the MIT license found in the
|
|
4
|
-
# LICENSE file in the root directory of this source tree.
|
|
5
|
-
|
|
6
|
-
cmake_minimum_required(VERSION 3.13)
|
|
7
|
-
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
-
|
|
9
|
-
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNLiveVoiceSpec/*.cpp)
|
|
10
|
-
|
|
11
|
-
add_library(
|
|
12
|
-
react_codegen_RNLiveVoiceSpec
|
|
13
|
-
OBJECT
|
|
14
|
-
${react_codegen_SRCS}
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
target_include_directories(react_codegen_RNLiveVoiceSpec PUBLIC . react/renderer/components/RNLiveVoiceSpec)
|
|
18
|
-
|
|
19
|
-
target_link_libraries(
|
|
20
|
-
react_codegen_RNLiveVoiceSpec
|
|
21
|
-
fbjni
|
|
22
|
-
jsi
|
|
23
|
-
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
-
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
-
reactnative
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
target_compile_reactnative_options(react_codegen_RNLiveVoiceSpec PRIVATE)
|