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
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
//===----------------------------------------------------------------------===//
|
|
4
|
+
//
|
|
5
|
+
// This source file is part of the LiveVoice SDK project
|
|
6
|
+
//
|
|
7
|
+
// Copyright (c) LiveVoice GmbH
|
|
8
|
+
// Licensed under the MIT license
|
|
9
|
+
//
|
|
10
|
+
// See LICENSE for license information
|
|
11
|
+
//
|
|
12
|
+
// SPDX-License-Identifier: MIT
|
|
13
|
+
//
|
|
14
|
+
//===----------------------------------------------------------------------===//
|
|
15
|
+
|
|
16
|
+
import { useEffect, useState } from 'react';
|
|
17
|
+
import { Modal, StyleSheet, Text, TextInput, TouchableOpacity, View } from 'react-native';
|
|
18
|
+
import { COLORS } from "../util/Colors.js";
|
|
19
|
+
import { PasswordPromptTexts } from "../util/Translations.js";
|
|
20
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
/**
|
|
22
|
+
* The built-in password prompt, for channels and events alike. Its texts come from the native SDK;
|
|
23
|
+
* the title is the channel's or event's name, or "Password required" for a join.
|
|
24
|
+
*/
|
|
25
|
+
export const PasswordPrompt = ({
|
|
26
|
+
request,
|
|
27
|
+
isDarkMode,
|
|
28
|
+
onAnswer
|
|
29
|
+
}) => {
|
|
30
|
+
const [password, setPassword] = useState('');
|
|
31
|
+
// A new request starts empty.
|
|
32
|
+
useEffect(() => setPassword(''), [request.requestId]);
|
|
33
|
+
const isChannel = request.subject.kind === 'channel';
|
|
34
|
+
const text = isDarkMode ? COLORS.white : COLORS.black;
|
|
35
|
+
const confirm = () => {
|
|
36
|
+
if (password.length > 0) onAnswer(password);
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/_jsx(Modal, {
|
|
39
|
+
transparent: true,
|
|
40
|
+
animationType: "fade",
|
|
41
|
+
visible: true,
|
|
42
|
+
onRequestClose: () => onAnswer(null),
|
|
43
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
44
|
+
style: styles.backdrop,
|
|
45
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
46
|
+
style: [styles.card, {
|
|
47
|
+
backgroundColor: isDarkMode ? COLORS.cardBgDark : COLORS.cardBg
|
|
48
|
+
}],
|
|
49
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
50
|
+
accessibilityRole: "header",
|
|
51
|
+
style: [styles.title, {
|
|
52
|
+
color: text
|
|
53
|
+
}],
|
|
54
|
+
children: request.name ?? PasswordPromptTexts.title()
|
|
55
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
56
|
+
style: [styles.message, {
|
|
57
|
+
color: text
|
|
58
|
+
}],
|
|
59
|
+
children: isChannel ? PasswordPromptTexts.channelMessage() : PasswordPromptTexts.eventMessage()
|
|
60
|
+
}), request.isRetry && /*#__PURE__*/_jsx(Text, {
|
|
61
|
+
accessibilityLiveRegion: "polite",
|
|
62
|
+
style: [styles.message, styles.wrong],
|
|
63
|
+
children: PasswordPromptTexts.wrongPassword()
|
|
64
|
+
}), /*#__PURE__*/_jsx(TextInput, {
|
|
65
|
+
value: password,
|
|
66
|
+
onChangeText: setPassword,
|
|
67
|
+
onSubmitEditing: confirm,
|
|
68
|
+
placeholder: PasswordPromptTexts.field(),
|
|
69
|
+
accessibilityLabel: PasswordPromptTexts.field(),
|
|
70
|
+
placeholderTextColor: isDarkMode ? '#8e8e93' : '#a0a0a5',
|
|
71
|
+
secureTextEntry: true,
|
|
72
|
+
autoFocus: true,
|
|
73
|
+
autoCapitalize: "none",
|
|
74
|
+
autoCorrect: false,
|
|
75
|
+
returnKeyType: "go",
|
|
76
|
+
style: [styles.field, {
|
|
77
|
+
color: text,
|
|
78
|
+
borderColor: isDarkMode ? COLORS.dividerDark : COLORS.divider
|
|
79
|
+
}]
|
|
80
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
81
|
+
style: styles.buttons,
|
|
82
|
+
children: [/*#__PURE__*/_jsx(TouchableOpacity, {
|
|
83
|
+
accessibilityRole: "button",
|
|
84
|
+
onPress: () => onAnswer(null),
|
|
85
|
+
style: styles.button,
|
|
86
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
87
|
+
style: [styles.buttonText, {
|
|
88
|
+
color: text
|
|
89
|
+
}],
|
|
90
|
+
children: PasswordPromptTexts.cancelButton()
|
|
91
|
+
})
|
|
92
|
+
}), /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
93
|
+
accessibilityRole: "button",
|
|
94
|
+
accessibilityState: {
|
|
95
|
+
disabled: password.length === 0
|
|
96
|
+
},
|
|
97
|
+
disabled: password.length === 0,
|
|
98
|
+
onPress: confirm,
|
|
99
|
+
style: styles.button,
|
|
100
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
101
|
+
style: [styles.buttonText, styles.confirm, {
|
|
102
|
+
opacity: password.length === 0 ? 0.4 : 1
|
|
103
|
+
}],
|
|
104
|
+
children: isChannel ? PasswordPromptTexts.channelConfirmButton() : PasswordPromptTexts.eventConfirmButton()
|
|
105
|
+
})
|
|
106
|
+
})]
|
|
107
|
+
})]
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
const styles = StyleSheet.create({
|
|
113
|
+
backdrop: {
|
|
114
|
+
flex: 1,
|
|
115
|
+
justifyContent: 'center',
|
|
116
|
+
alignItems: 'center',
|
|
117
|
+
padding: 24,
|
|
118
|
+
backgroundColor: 'rgba(0, 0, 0, 0.4)'
|
|
119
|
+
},
|
|
120
|
+
card: {
|
|
121
|
+
width: '100%',
|
|
122
|
+
maxWidth: 360,
|
|
123
|
+
borderRadius: 14,
|
|
124
|
+
padding: 20
|
|
125
|
+
},
|
|
126
|
+
title: {
|
|
127
|
+
fontSize: 17,
|
|
128
|
+
fontWeight: '600',
|
|
129
|
+
textAlign: 'center'
|
|
130
|
+
},
|
|
131
|
+
message: {
|
|
132
|
+
fontSize: 14,
|
|
133
|
+
textAlign: 'center',
|
|
134
|
+
marginTop: 8
|
|
135
|
+
},
|
|
136
|
+
wrong: {
|
|
137
|
+
color: '#F1521B'
|
|
138
|
+
},
|
|
139
|
+
field: {
|
|
140
|
+
borderWidth: 1,
|
|
141
|
+
borderRadius: 8,
|
|
142
|
+
paddingHorizontal: 12,
|
|
143
|
+
paddingVertical: 10,
|
|
144
|
+
marginTop: 16,
|
|
145
|
+
fontSize: 16
|
|
146
|
+
},
|
|
147
|
+
buttons: {
|
|
148
|
+
flexDirection: 'row',
|
|
149
|
+
justifyContent: 'flex-end',
|
|
150
|
+
marginTop: 16
|
|
151
|
+
},
|
|
152
|
+
button: {
|
|
153
|
+
paddingHorizontal: 12,
|
|
154
|
+
paddingVertical: 8,
|
|
155
|
+
marginLeft: 8
|
|
156
|
+
},
|
|
157
|
+
buttonText: {
|
|
158
|
+
fontSize: 16,
|
|
159
|
+
fontWeight: '500'
|
|
160
|
+
},
|
|
161
|
+
confirm: {
|
|
162
|
+
color: COLORS.primary
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
//# sourceMappingURL=PasswordPrompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useState","Modal","StyleSheet","Text","TextInput","TouchableOpacity","View","COLORS","PasswordPromptTexts","jsx","_jsx","jsxs","_jsxs","PasswordPrompt","request","isDarkMode","onAnswer","password","setPassword","requestId","isChannel","subject","kind","text","white","black","confirm","length","transparent","animationType","visible","onRequestClose","children","style","styles","backdrop","card","backgroundColor","cardBgDark","cardBg","accessibilityRole","title","color","name","message","channelMessage","eventMessage","isRetry","accessibilityLiveRegion","wrong","wrongPassword","value","onChangeText","onSubmitEditing","placeholder","field","accessibilityLabel","placeholderTextColor","secureTextEntry","autoFocus","autoCapitalize","autoCorrect","returnKeyType","borderColor","dividerDark","divider","buttons","onPress","button","buttonText","cancelButton","accessibilityState","disabled","opacity","channelConfirmButton","eventConfirmButton","create","flex","justifyContent","alignItems","padding","width","maxWidth","borderRadius","fontSize","fontWeight","textAlign","marginTop","borderWidth","paddingHorizontal","paddingVertical","flexDirection","marginLeft","primary"],"sourceRoot":"../../../src","sources":["components/PasswordPrompt.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3C,SAASC,KAAK,EAAEC,UAAU,EAAEC,IAAI,EAAEC,SAAS,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AAGzF,SAASC,MAAM,QAAQ,mBAAgB;AACvC,SAASC,mBAAmB,QAAQ,yBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAS3D;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAA6C,GAAGA,CAAC;EAAEC,OAAO;EAAEC,UAAU;EAAEC;AAAS,CAAC,KAAK;EAClG,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGlB,QAAQ,CAAC,EAAE,CAAC;EAC5C;EACAD,SAAS,CAAC,MAAMmB,WAAW,CAAC,EAAE,CAAC,EAAE,CAACJ,OAAO,CAACK,SAAS,CAAC,CAAC;EAErD,MAAMC,SAAS,GAAGN,OAAO,CAACO,OAAO,CAACC,IAAI,KAAK,SAAS;EACpD,MAAMC,IAAI,GAAGR,UAAU,GAAGR,MAAM,CAACiB,KAAK,GAAGjB,MAAM,CAACkB,KAAK;EACrD,MAAMC,OAAO,GAAGA,CAAA,KAAM;IAAE,IAAIT,QAAQ,CAACU,MAAM,GAAG,CAAC,EAAEX,QAAQ,CAACC,QAAQ,CAAC;EAAE,CAAC;EAEtE,oBACEP,IAAA,CAACT,KAAK;IAAC2B,WAAW;IAACC,aAAa,EAAC,MAAM;IAACC,OAAO;IAACC,cAAc,EAAEA,CAAA,KAAMf,QAAQ,CAAC,IAAI,CAAE;IAAAgB,QAAA,eACnFtB,IAAA,CAACJ,IAAI;MAAC2B,KAAK,EAAEC,MAAM,CAACC,QAAS;MAAAH,QAAA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sF;EAChB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
//===----------------------------------------------------------------------===//
|
|
4
|
+
//
|
|
5
|
+
// This source file is part of the LiveVoice SDK project
|
|
6
|
+
//
|
|
7
|
+
// Copyright (c) LiveVoice GmbH
|
|
8
|
+
// Licensed under the MIT license
|
|
9
|
+
//
|
|
10
|
+
// See LICENSE for license information
|
|
11
|
+
//
|
|
12
|
+
// SPDX-License-Identifier: MIT
|
|
13
|
+
//
|
|
14
|
+
//===----------------------------------------------------------------------===//
|
|
13
15
|
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { PlayingState } from "../util/PlayingState.js";
|
|
16
|
+
import { Image, Platform, TouchableOpacity, useColorScheme, View } from "react-native";
|
|
17
|
+
import { LiveVoiceSpinner } from "./LiveVoiceSpinner.js";
|
|
17
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
/**
|
|
20
|
+
* The default cell's play button, drawn as the native SDK of the platform draws it: iOS
|
|
21
|
+
* `ChannelPlayButton` in its `.sdk` style, Android `PlayButton` in the SDK cell's Listener style.
|
|
22
|
+
* Change them together. Geometry is the same on both; the colours are each platform's own
|
|
23
|
+
* (`buttonColors`).
|
|
24
|
+
*/
|
|
18
25
|
const PlayButtonView = ({
|
|
19
26
|
playingState,
|
|
20
27
|
isChannelOnline,
|
|
@@ -23,293 +30,224 @@ const PlayButtonView = ({
|
|
|
23
30
|
isDarkMode = useColorScheme() === "dark",
|
|
24
31
|
onAudioPress,
|
|
25
32
|
onSubtitlesPress,
|
|
26
|
-
onPress
|
|
33
|
+
onPress,
|
|
34
|
+
brandColor = null,
|
|
35
|
+
subtitlesOpen = false
|
|
27
36
|
}) => {
|
|
28
|
-
const isPlaying = playingState ===
|
|
29
|
-
const isTransitioning = playingState ===
|
|
30
|
-
const
|
|
31
|
-
if (!isChannelOnline) {
|
|
32
|
-
return isDarkMode ? "#5a5a60" : "#d1d1d6";
|
|
33
|
-
}
|
|
34
|
-
return COLORS.white;
|
|
35
|
-
};
|
|
36
|
-
const getSubtitlesIconColor = () => {
|
|
37
|
-
if (!isChannelOnline) {
|
|
38
|
-
return isDarkMode ? "#ffffff" : "#000000";
|
|
39
|
-
}
|
|
40
|
-
return COLORS.white;
|
|
41
|
-
};
|
|
42
|
-
const audioIconColor = getAudioIconColor();
|
|
43
|
-
const subtitlesIconColor = getSubtitlesIconColor();
|
|
44
|
-
const getAudioIcon = () => {
|
|
45
|
-
if (isTransitioning) {
|
|
46
|
-
return /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
47
|
-
size: 20,
|
|
48
|
-
color: audioIconColor,
|
|
49
|
-
style: {}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
return isPlaying ? /*#__PURE__*/_jsx(Image, {
|
|
53
|
-
source: require("../icons/pause.png"),
|
|
54
|
-
style: [{
|
|
55
|
-
tintColor: audioIconColor,
|
|
56
|
-
width: 30,
|
|
57
|
-
height: 26
|
|
58
|
-
}]
|
|
59
|
-
}) : /*#__PURE__*/_jsx(Image, {
|
|
60
|
-
source: require("../icons/play.png"),
|
|
61
|
-
style: [{
|
|
62
|
-
tintColor: audioIconColor,
|
|
63
|
-
width: 30,
|
|
64
|
-
height: 26
|
|
65
|
-
}]
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
const getSubtitlesIcon = () => {
|
|
69
|
-
return /*#__PURE__*/_jsx(Image, {
|
|
70
|
-
source: require("../icons/captions.png"),
|
|
71
|
-
style: [{
|
|
72
|
-
tintColor: subtitlesIconColor,
|
|
73
|
-
width: 30,
|
|
74
|
-
height: 26
|
|
75
|
-
}]
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
const getStyleType = () => {
|
|
79
|
-
if (!isChannelOnline) return "offline";
|
|
80
|
-
if (isPlaying) return "playing";
|
|
81
|
-
return "paused";
|
|
82
|
-
};
|
|
37
|
+
const isPlaying = playingState === "playing";
|
|
38
|
+
const isTransitioning = playingState === "transitioning";
|
|
39
|
+
const colors = buttonColors(isDarkMode);
|
|
83
40
|
|
|
84
|
-
//
|
|
41
|
+
// Play, pause and the spinner share one colour by state, as both native glyphs do.
|
|
42
|
+
const glyphColor = isChannelOnline ? colors.onlineGlyph : colors.offlineGlyph;
|
|
43
|
+
const captionsColor = isChannelOnline ? colors.onlineGlyph : colors.offlineCaptions;
|
|
44
|
+
// The event's brand colour replaces the orange of an online button.
|
|
45
|
+
const fill = isChannelOnline ? brandColor ?? colors.onlineFill : colors.offlineFill;
|
|
46
|
+
const audioIcon = isTransitioning ? /*#__PURE__*/_jsx(LiveVoiceSpinner, {
|
|
47
|
+
size: 22,
|
|
48
|
+
color: glyphColor
|
|
49
|
+
}) : /*#__PURE__*/_jsx(Image, {
|
|
50
|
+
source: isPlaying ? require("../icons/pause.png") : require("../icons/play.png"),
|
|
51
|
+
style: [{
|
|
52
|
+
tintColor: glyphColor,
|
|
53
|
+
width: 30,
|
|
54
|
+
height: 26
|
|
55
|
+
}]
|
|
56
|
+
});
|
|
57
|
+
const subtitlesIcon = /*#__PURE__*/_jsx(Image, {
|
|
58
|
+
source: require("../icons/captions.png"),
|
|
59
|
+
style: [{
|
|
60
|
+
tintColor: captionsColor,
|
|
61
|
+
width: 30,
|
|
62
|
+
height: 26
|
|
63
|
+
}]
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Open subtitles mark the subtitle half with a capsule, as both native SDKs do.
|
|
67
|
+
const marker = inset => subtitlesOpen && /*#__PURE__*/_jsx(SubtitlesMarker, {
|
|
68
|
+
inset: inset,
|
|
69
|
+
color: isChannelOnline ? colors.onlineMarker : colors.offlineMarker
|
|
70
|
+
});
|
|
71
|
+
// The offline outline, over the button without taking any of its room.
|
|
72
|
+
const border = !isChannelOnline && /*#__PURE__*/_jsx(ButtonBorder, {
|
|
73
|
+
color: colors.outline
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// Neither audio nor subtitles: a dashed outline and nothing to press.
|
|
85
77
|
if (!hasAudio && !hasSubtitles) {
|
|
86
|
-
const noContentStyle = {
|
|
87
|
-
...baseButtonStyleNoContent,
|
|
88
|
-
backgroundColor: isDarkMode ? "#1c1c1e00" : "#ffffff",
|
|
89
|
-
borderColor: isDarkMode ? COLORS_SCHEME.borderGrayDark : COLORS_SCHEME.borderGrayLight,
|
|
90
|
-
borderStyle: "dashed"
|
|
91
|
-
};
|
|
92
78
|
return /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
93
|
-
style:
|
|
79
|
+
style: {
|
|
80
|
+
...buttonFrame,
|
|
81
|
+
borderWidth: colors.noInputBorderWidth,
|
|
82
|
+
borderColor: colors.outline,
|
|
83
|
+
borderStyle: "dashed",
|
|
84
|
+
backgroundColor: isChannelOnline && colors.noInputFillsWhenOnline ? fill : colors.noInputFill
|
|
85
|
+
},
|
|
94
86
|
disabled: true,
|
|
95
87
|
activeOpacity: 0.8,
|
|
96
88
|
children: /*#__PURE__*/_jsx(View, {})
|
|
97
89
|
});
|
|
98
90
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
91
|
+
if (!hasSubtitles) {
|
|
92
|
+
return /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
93
|
+
style: [buttonFrame, {
|
|
94
|
+
backgroundColor: fill
|
|
95
|
+
}],
|
|
104
96
|
onPress: onAudioPress || onPress,
|
|
105
97
|
activeOpacity: 0.8,
|
|
106
|
-
children:
|
|
98
|
+
children: [audioIcon, border]
|
|
107
99
|
});
|
|
108
100
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
101
|
+
if (!hasAudio) {
|
|
102
|
+
return /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
103
|
+
style: [buttonFrame, {
|
|
104
|
+
backgroundColor: fill
|
|
105
|
+
}],
|
|
114
106
|
onPress: onSubtitlesPress || onPress,
|
|
115
107
|
activeOpacity: 0.8,
|
|
116
|
-
children:
|
|
108
|
+
children: [marker(3), subtitlesIcon, border]
|
|
117
109
|
});
|
|
118
110
|
}
|
|
119
111
|
|
|
120
|
-
//
|
|
112
|
+
// The divider keeps its slot but is clear while the channel plays or its subtitles are open.
|
|
113
|
+
const dividerColor = isPlaying || subtitlesOpen ? "transparent" : isChannelOnline ? colors.onlineDivider : colors.offlineDivider;
|
|
121
114
|
return /*#__PURE__*/_jsxs(View, {
|
|
122
|
-
style:
|
|
115
|
+
style: [splitFrame, {
|
|
116
|
+
backgroundColor: fill
|
|
117
|
+
}],
|
|
123
118
|
children: [/*#__PURE__*/_jsx(TouchableOpacity, {
|
|
124
|
-
style:
|
|
119
|
+
style: halfFrame,
|
|
125
120
|
onPress: onAudioPress || onPress,
|
|
126
121
|
activeOpacity: 0.8,
|
|
127
|
-
children:
|
|
122
|
+
children: audioIcon
|
|
128
123
|
}), /*#__PURE__*/_jsx(View, {
|
|
129
|
-
style:
|
|
130
|
-
|
|
131
|
-
|
|
124
|
+
style: [dividerFrame, {
|
|
125
|
+
backgroundColor: dividerColor
|
|
126
|
+
}]
|
|
127
|
+
}), /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
128
|
+
style: halfFrame,
|
|
132
129
|
onPress: onSubtitlesPress || onPress,
|
|
133
130
|
activeOpacity: 0.8,
|
|
134
|
-
children:
|
|
135
|
-
})]
|
|
131
|
+
children: [marker(4), subtitlesIcon]
|
|
132
|
+
}), border]
|
|
136
133
|
});
|
|
137
134
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Every colour of the button, light or dark, as the native SDK of this platform has it.
|
|
138
|
+
*
|
|
139
|
+
* Both: LiveVoice orange online (iOS `.lvOrange`, Android `orange`); white glyphs online; the
|
|
140
|
+
* outline and the offline divider `#A0A0A0` / `#E0E0E0` at 50 % (iOS `.lightGrey.opacity(0.5)`,
|
|
141
|
+
* Android `playButtonOutline`); the online divider white at 30 %; the marker white at 25 % online,
|
|
142
|
+
* `#EAEAEF` / `#4E4E4E` offline (iOS `.outlineButtonBorder`, Android
|
|
143
|
+
* `selectedCaptionsBackgroundOffline`).
|
|
144
|
+
*
|
|
145
|
+
* - iOS (`ChannelPlayButton`, `.sdk`): offline fill `.clear`; offline play glyph, pause and spinner
|
|
146
|
+
* `.lightGrey.opacity(0.5)`; offline captions `.primary`.
|
|
147
|
+
* - Android (`PlayButton`, Listener, in `LvAppTheme`): offline fill `background` (`white`,
|
|
148
|
+
* `veryDarkGray`); offline play glyph, pause and spinner `buttonIconInactive` (`veryLightGray`,
|
|
149
|
+
* `darkGray`); offline captions `onBackground` (`lightBlack`, `white`).
|
|
150
|
+
* - The button without input follows iOS on both: filled as an online button when its channel is
|
|
151
|
+
* online, clear otherwise, with a 1 pt dashed outline (Android is changing to match).
|
|
152
|
+
*/
|
|
153
|
+
function buttonColors(isDarkMode) {
|
|
154
|
+
const outline = isDarkMode ? "rgba(224, 224, 224, 0.5)" : "rgba(160, 160, 160, 0.5)";
|
|
155
|
+
const shared = {
|
|
156
|
+
onlineFill: "#F56230",
|
|
157
|
+
onlineGlyph: "#FFFFFF",
|
|
158
|
+
outline,
|
|
159
|
+
onlineDivider: "rgba(255, 255, 255, 0.3)",
|
|
160
|
+
offlineDivider: outline,
|
|
161
|
+
onlineMarker: "rgba(255, 255, 255, 0.25)",
|
|
162
|
+
offlineMarker: isDarkMode ? "#4E4E4E" : "#EAEAEF",
|
|
163
|
+
// Without audio or subtitles, both as iOS: filled as an online button when the channel is
|
|
164
|
+
// online, clear otherwise, and always the 1 pt dashed outline.
|
|
165
|
+
noInputFill: "transparent",
|
|
166
|
+
noInputFillsWhenOnline: true,
|
|
167
|
+
noInputBorderWidth: 1
|
|
168
|
+
};
|
|
169
|
+
if (Platform.OS === "ios") {
|
|
156
170
|
return {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
171
|
+
...shared,
|
|
172
|
+
offlineFill: "transparent",
|
|
173
|
+
offlineGlyph: outline,
|
|
174
|
+
offlineCaptions: isDarkMode ? "#FFFFFF" : "#000000"
|
|
160
175
|
};
|
|
161
176
|
}
|
|
162
|
-
|
|
163
|
-
// When button is offline, divider is gray (same as border)
|
|
177
|
+
const background = isDarkMode ? "#212529" : "#FFFFFF";
|
|
164
178
|
return {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
179
|
+
...shared,
|
|
180
|
+
offlineFill: background,
|
|
181
|
+
offlineGlyph: isDarkMode ? "#343A40" : "#E7E7E7",
|
|
182
|
+
offlineCaptions: isDarkMode ? "#FFFFFF" : "#191919"
|
|
168
183
|
};
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* The open-subtitles marker, drawn as the native SDKs draw it: a capsule inset `inset` from the
|
|
188
|
+
* subtitle half's own bounds, 4 beside the play half and 3 on a subtitles-only button.
|
|
189
|
+
*/
|
|
190
|
+
const SubtitlesMarker = ({
|
|
191
|
+
inset,
|
|
192
|
+
color
|
|
193
|
+
}) => /*#__PURE__*/_jsx(View, {
|
|
194
|
+
style: {
|
|
195
|
+
position: "absolute",
|
|
196
|
+
top: inset,
|
|
197
|
+
bottom: inset,
|
|
198
|
+
left: inset,
|
|
199
|
+
right: inset,
|
|
200
|
+
borderRadius: (buttonFrame.height - 2 * inset) / 2,
|
|
201
|
+
backgroundColor: color
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* The offline button's 1 pt outline, drawn over the button as both native SDKs stroke it (iOS
|
|
207
|
+
* `strokeBorder` in the button's background, Android `Modifier.border`), so it insets nothing: the
|
|
208
|
+
* halves fill the whole 96 × 44 button and the glyphs sit where native puts them. Online, iOS draws
|
|
209
|
+
* none and Android strokes it in the fill's own colour, so none is drawn here.
|
|
210
|
+
*/
|
|
211
|
+
const ButtonBorder = ({
|
|
212
|
+
color
|
|
213
|
+
}) => /*#__PURE__*/_jsx(View, {
|
|
214
|
+
pointerEvents: "none",
|
|
215
|
+
style: {
|
|
216
|
+
position: "absolute",
|
|
217
|
+
top: 0,
|
|
218
|
+
bottom: 0,
|
|
219
|
+
left: 0,
|
|
220
|
+
right: 0,
|
|
221
|
+
borderRadius: buttonFrame.borderRadius,
|
|
222
|
+
borderWidth: 1,
|
|
223
|
+
borderColor: color
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
// No border of their own: an offline outline is `ButtonBorder`, which takes no room.
|
|
228
|
+
const buttonFrame = {
|
|
179
229
|
width: 96,
|
|
180
230
|
height: 44,
|
|
181
231
|
borderRadius: 22,
|
|
182
|
-
borderWidth: 1,
|
|
183
232
|
alignItems: "center",
|
|
184
233
|
justifyContent: "center"
|
|
185
234
|
};
|
|
186
|
-
const
|
|
187
|
-
|
|
188
|
-
height: 44,
|
|
189
|
-
borderRadius: 22,
|
|
190
|
-
borderWidth: 1,
|
|
235
|
+
const splitFrame = {
|
|
236
|
+
...buttonFrame,
|
|
191
237
|
flexDirection: "row",
|
|
192
|
-
alignItems: "center",
|
|
193
|
-
justifyContent: "center",
|
|
194
238
|
overflow: "hidden"
|
|
195
239
|
};
|
|
196
|
-
const
|
|
240
|
+
const halfFrame = {
|
|
197
241
|
flex: 1,
|
|
198
242
|
height: 44,
|
|
199
243
|
alignItems: "center",
|
|
200
244
|
justifyContent: "center"
|
|
201
245
|
};
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
};
|
|
208
|
-
const COLORS_SCHEME = {
|
|
209
|
-
orange: "#f56230",
|
|
210
|
-
dividerOnOrange: "#ffffff80",
|
|
211
|
-
borderGrayLight: "#d1d1d6",
|
|
212
|
-
borderGrayDark: "#5a5a60"
|
|
213
|
-
};
|
|
214
|
-
export const ButtonStyles = {
|
|
215
|
-
paused: {
|
|
216
|
-
light: {
|
|
217
|
-
...baseButtonStyle,
|
|
218
|
-
backgroundColor: COLORS_SCHEME.orange,
|
|
219
|
-
borderColor: "transparent"
|
|
220
|
-
},
|
|
221
|
-
dark: {
|
|
222
|
-
...baseButtonStyle,
|
|
223
|
-
backgroundColor: COLORS_SCHEME.orange,
|
|
224
|
-
borderColor: "transparent"
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
playing: {
|
|
228
|
-
light: {
|
|
229
|
-
...baseButtonStyle,
|
|
230
|
-
backgroundColor: COLORS_SCHEME.orange,
|
|
231
|
-
borderColor: "transparent"
|
|
232
|
-
},
|
|
233
|
-
dark: {
|
|
234
|
-
...baseButtonStyle,
|
|
235
|
-
backgroundColor: COLORS_SCHEME.orange,
|
|
236
|
-
borderColor: "transparent"
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
offline: {
|
|
240
|
-
light: {
|
|
241
|
-
...baseButtonStyle,
|
|
242
|
-
backgroundColor: "#ffffff",
|
|
243
|
-
borderColor: COLORS_SCHEME.borderGrayLight
|
|
244
|
-
},
|
|
245
|
-
dark: {
|
|
246
|
-
...baseButtonStyle,
|
|
247
|
-
backgroundColor: "#212429",
|
|
248
|
-
borderColor: COLORS_SCHEME.borderGrayDark
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
export const SplitButtonStyles = {
|
|
253
|
-
paused: {
|
|
254
|
-
light: {
|
|
255
|
-
container: {
|
|
256
|
-
...baseSplitButtonStyle,
|
|
257
|
-
backgroundColor: COLORS_SCHEME.orange,
|
|
258
|
-
borderColor: "transparent"
|
|
259
|
-
},
|
|
260
|
-
audio: baseSplitAudioStyle,
|
|
261
|
-
subtitles: baseSplitSubtitlesStyle
|
|
262
|
-
},
|
|
263
|
-
dark: {
|
|
264
|
-
container: {
|
|
265
|
-
...baseSplitButtonStyle,
|
|
266
|
-
backgroundColor: COLORS_SCHEME.orange,
|
|
267
|
-
borderColor: "transparent"
|
|
268
|
-
},
|
|
269
|
-
audio: baseSplitAudioStyle,
|
|
270
|
-
subtitles: baseSplitSubtitlesStyle
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
playing: {
|
|
274
|
-
light: {
|
|
275
|
-
container: {
|
|
276
|
-
...baseSplitButtonStyle,
|
|
277
|
-
backgroundColor: COLORS_SCHEME.orange,
|
|
278
|
-
borderColor: "transparent"
|
|
279
|
-
},
|
|
280
|
-
audio: baseSplitAudioStyle,
|
|
281
|
-
subtitles: baseSplitSubtitlesStyle
|
|
282
|
-
},
|
|
283
|
-
dark: {
|
|
284
|
-
container: {
|
|
285
|
-
...baseSplitButtonStyle,
|
|
286
|
-
backgroundColor: COLORS_SCHEME.orange,
|
|
287
|
-
borderColor: "transparent"
|
|
288
|
-
},
|
|
289
|
-
audio: baseSplitAudioStyle,
|
|
290
|
-
subtitles: baseSplitSubtitlesStyle
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
offline: {
|
|
294
|
-
light: {
|
|
295
|
-
container: {
|
|
296
|
-
...baseSplitButtonStyle,
|
|
297
|
-
backgroundColor: "#ffffff",
|
|
298
|
-
borderColor: COLORS_SCHEME.borderGrayLight
|
|
299
|
-
},
|
|
300
|
-
audio: baseSplitAudioStyle,
|
|
301
|
-
subtitles: baseSplitSubtitlesStyle
|
|
302
|
-
},
|
|
303
|
-
dark: {
|
|
304
|
-
container: {
|
|
305
|
-
...baseSplitButtonStyle,
|
|
306
|
-
backgroundColor: "#212429",
|
|
307
|
-
borderColor: COLORS_SCHEME.borderGrayDark
|
|
308
|
-
},
|
|
309
|
-
audio: baseSplitAudioStyle,
|
|
310
|
-
subtitles: baseSplitSubtitlesStyle
|
|
311
|
-
}
|
|
312
|
-
}
|
|
246
|
+
|
|
247
|
+
// 26 tall, 9 from the top and bottom of the 44 button, as in both native SDKs.
|
|
248
|
+
const dividerFrame = {
|
|
249
|
+
width: 1,
|
|
250
|
+
height: 26
|
|
313
251
|
};
|
|
314
252
|
export default PlayButtonView;
|
|
315
253
|
//# sourceMappingURL=PlayButtonView.js.map
|