livevoice-sdk-react-native 1.0.3 → 2.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/LICENSE +1 -1
- package/README.md +5 -5
- package/android/{generated/java/io/livevoice/react → app/build/generated/source/codegen/java/com/facebook/fbreact/specs}/NativeLiveVoiceSdkSpec.java +2 -2
- package/android/{generated → app/build/generated/source/codegen}/jni/CMakeLists.txt +1 -9
- package/android/{generated → app/build/generated/source/codegen}/jni/RNLiveVoiceSpec-generated.cpp +3 -3
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI.h +341 -0
- package/android/build.gradle +41 -84
- package/android/gradle.properties +10 -6
- package/android/src/main/java/io/livevoice/react/LiveVoiceModule.kt +17 -16
- package/android/src/main/java/io/livevoice/react/LiveVoiceSdkReactNativePackage.kt +12 -13
- package/android/src/main/java/io/livevoice/react/Mappings.kt +36 -5
- package/android/src/main/java/io/livevoice/react/NativeModels.kt +2 -0
- package/android/src/main/java/io/livevoice/react/__SDK.kt +1 -1
- package/ios/LiveVoiceSdkReactNative.h +5 -5
- package/ios/{LivevoiceSdkReactNative.mm → LiveVoiceSdkReactNative.mm} +59 -74
- package/ios/__SDK.h +1 -1
- package/lib/module/components/ChannelView.js +14 -38
- package/lib/module/components/ChannelView.js.map +1 -1
- package/lib/module/components/LiveVoiceView.js +46 -23
- package/lib/module/components/LiveVoiceView.js.map +1 -1
- package/lib/module/components/PlayButtonView.js +243 -84
- package/lib/module/components/PlayButtonView.js.map +1 -1
- package/lib/module/icons/captions@1x.png +0 -0
- package/lib/module/icons/captions@2x.png +0 -0
- package/lib/module/icons/pause@1x.png +0 -0
- package/lib/module/icons/pause@2x.png +0 -0
- package/lib/module/icons/play@1x.png +0 -0
- package/lib/module/icons/play@2x.png +0 -0
- package/lib/module/index.js +19 -21
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeLiveVoiceSdk.js +4 -0
- package/lib/module/specs/NativeLiveVoiceSdk.js.map +1 -1
- package/lib/module/util/Colors.js +2 -1
- package/lib/module/util/Colors.js.map +1 -1
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/components/AudioOutputSwitchView.d.ts.map +1 -0
- package/lib/typescript/src/components/BrandingView.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src → src}/components/ChannelView.d.ts +4 -2
- package/lib/typescript/src/components/ChannelView.d.ts.map +1 -0
- package/lib/typescript/src/components/ErrorView.d.ts.map +1 -0
- package/lib/typescript/src/components/LiveVoiceView.d.ts.map +1 -0
- package/lib/typescript/src/components/PlayButtonView.d.ts +341 -0
- package/lib/typescript/src/components/PlayButtonView.d.ts.map +1 -0
- package/lib/typescript/src/components/ReconnectingView.d.ts.map +1 -0
- package/lib/typescript/src/components/WarningView.d.ts.map +1 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src → src}/index.d.ts +11 -15
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src → src}/specs/NativeLiveVoiceSdk.d.ts +3 -3
- package/lib/typescript/src/specs/NativeLiveVoiceSdk.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src → src}/util/Colors.d.ts +2 -1
- package/lib/typescript/src/util/Colors.d.ts.map +1 -0
- package/lib/typescript/src/util/ForegroundServiceConfig.d.ts.map +1 -0
- package/lib/typescript/src/util/PlayingState.d.ts.map +1 -0
- package/lib/typescript/src/util/Translations.d.ts.map +1 -0
- package/lib/typescript/{module/src → src}/util/UIState.d.ts +22 -1
- package/lib/typescript/src/util/UIState.d.ts.map +1 -0
- package/livevoice-sdk-react-native.podspec +6 -27
- package/package.json +33 -123
- package/src/components/ChannelView.tsx +18 -25
- package/src/components/LiveVoiceView.tsx +110 -59
- package/src/components/PlayButtonView.tsx +280 -87
- package/src/icons/captions@1x.png +0 -0
- package/src/icons/captions@2x.png +0 -0
- package/src/icons/pause@1x.png +0 -0
- package/src/icons/pause@2x.png +0 -0
- package/src/icons/play@1x.png +0 -0
- package/src/icons/play@2x.png +0 -0
- package/src/index.tsx +95 -79
- package/src/specs/NativeLiveVoiceSdk.ts +7 -5
- package/src/util/Colors.ts +3 -1
- package/src/util/UIState.ts +25 -1
- package/android/generated/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI-generated.cpp +0 -245
- package/android/generated/jni/react/renderer/components/RNLiveVoiceSpec/RNLiveVoiceSpecJSI.h +0 -398
- package/android/src/main/AndroidManifest.xml +0 -3
- package/ios/generated/RNLiveVoiceSpec/RNLiveVoiceSpec-generated.mm +0 -292
- package/ios/generated/RNLiveVoiceSpec/RNLiveVoiceSpec.h +0 -101
- package/ios/generated/RNLiveVoiceSpecJSI-generated.cpp +0 -245
- package/ios/generated/RNLiveVoiceSpecJSI.h +0 -398
- package/lib/commonjs/components/AudioOutputSwitchView.js +0 -144
- package/lib/commonjs/components/AudioOutputSwitchView.js.map +0 -1
- package/lib/commonjs/components/BrandingView.js +0 -78
- package/lib/commonjs/components/BrandingView.js.map +0 -1
- package/lib/commonjs/components/ChannelView.js +0 -117
- package/lib/commonjs/components/ChannelView.js.map +0 -1
- package/lib/commonjs/components/ErrorView.js +0 -88
- package/lib/commonjs/components/ErrorView.js.map +0 -1
- package/lib/commonjs/components/LiveVoiceView.js +0 -107
- package/lib/commonjs/components/LiveVoiceView.js.map +0 -1
- package/lib/commonjs/components/PlayButtonView.js +0 -161
- package/lib/commonjs/components/PlayButtonView.js.map +0 -1
- package/lib/commonjs/components/ReconnectingView.js +0 -109
- package/lib/commonjs/components/ReconnectingView.js.map +0 -1
- package/lib/commonjs/components/WarningView.js +0 -58
- package/lib/commonjs/components/WarningView.js.map +0 -1
- package/lib/commonjs/components/index.js +0 -94
- package/lib/commonjs/components/index.js.map +0 -1
- package/lib/commonjs/icons/branding.png +0 -0
- package/lib/commonjs/icons/cpu.png +0 -0
- package/lib/commonjs/icons/headphones.png +0 -0
- package/lib/commonjs/icons/mic.png +0 -0
- package/lib/commonjs/icons/pause.png +0 -0
- package/lib/commonjs/icons/play.png +0 -0
- package/lib/commonjs/icons/speaker.png +0 -0
- package/lib/commonjs/index.js +0 -327
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/specs/NativeLiveVoiceSdk.js +0 -19
- package/lib/commonjs/specs/NativeLiveVoiceSdk.js.map +0 -1
- package/lib/commonjs/util/Colors.js +0 -30
- package/lib/commonjs/util/Colors.js.map +0 -1
- package/lib/commonjs/util/ForegroundServiceConfig.js +0 -33
- package/lib/commonjs/util/ForegroundServiceConfig.js.map +0 -1
- package/lib/commonjs/util/PlayingState.js +0 -24
- package/lib/commonjs/util/PlayingState.js.map +0 -1
- package/lib/commonjs/util/Translations.js +0 -47
- package/lib/commonjs/util/Translations.js.map +0 -1
- package/lib/commonjs/util/UIState.js +0 -6
- package/lib/commonjs/util/UIState.js.map +0 -1
- package/lib/module/icons/pause.png +0 -0
- package/lib/module/icons/play.png +0 -0
- package/lib/typescript/commonjs/package.json +0 -1
- package/lib/typescript/commonjs/src/components/AudioOutputSwitchView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/BrandingView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/ChannelView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/ErrorView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/LiveVoiceView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/PlayButtonView.d.ts +0 -146
- package/lib/typescript/commonjs/src/components/PlayButtonView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/ReconnectingView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/WarningView.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/components/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/specs/NativeLiveVoiceSdk.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/Colors.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/ForegroundServiceConfig.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/PlayingState.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/Translations.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/util/UIState.d.ts +0 -45
- package/lib/typescript/commonjs/src/util/UIState.d.ts.map +0 -1
- package/lib/typescript/module/src/components/AudioOutputSwitchView.d.ts +0 -6
- package/lib/typescript/module/src/components/AudioOutputSwitchView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/BrandingView.d.ts +0 -6
- package/lib/typescript/module/src/components/BrandingView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/ChannelView.d.ts +0 -13
- package/lib/typescript/module/src/components/ChannelView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/ErrorView.d.ts +0 -9
- package/lib/typescript/module/src/components/ErrorView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/LiveVoiceView.d.ts +0 -6
- package/lib/typescript/module/src/components/LiveVoiceView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/PlayButtonView.d.ts +0 -146
- package/lib/typescript/module/src/components/PlayButtonView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/ReconnectingView.d.ts +0 -9
- package/lib/typescript/module/src/components/ReconnectingView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/WarningView.d.ts +0 -8
- package/lib/typescript/module/src/components/WarningView.d.ts.map +0 -1
- package/lib/typescript/module/src/components/index.d.ts +0 -9
- package/lib/typescript/module/src/components/index.d.ts.map +0 -1
- package/lib/typescript/module/src/index.d.ts +0 -149
- package/lib/typescript/module/src/index.d.ts.map +0 -1
- package/lib/typescript/module/src/specs/NativeLiveVoiceSdk.d.ts +0 -48
- package/lib/typescript/module/src/specs/NativeLiveVoiceSdk.d.ts.map +0 -1
- package/lib/typescript/module/src/util/Colors.d.ts +0 -13
- package/lib/typescript/module/src/util/Colors.d.ts.map +0 -1
- package/lib/typescript/module/src/util/ForegroundServiceConfig.d.ts +0 -12
- package/lib/typescript/module/src/util/ForegroundServiceConfig.d.ts.map +0 -1
- package/lib/typescript/module/src/util/PlayingState.d.ts +0 -7
- package/lib/typescript/module/src/util/PlayingState.d.ts.map +0 -1
- package/lib/typescript/module/src/util/Translations.d.ts +0 -22
- package/lib/typescript/module/src/util/Translations.d.ts.map +0 -1
- package/lib/typescript/module/src/util/UIState.d.ts.map +0 -1
- package/react-native.config.js +0 -12
- package/src/icons/pause.png +0 -0
- package/src/icons/play.png +0 -0
- /package/android/{generated → app/build/generated/source/codegen}/jni/RNLiveVoiceSpec.h +0 -0
- /package/lib/{typescript/module → module}/package.json +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/AudioOutputSwitchView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/BrandingView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/ErrorView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/LiveVoiceView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/ReconnectingView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/WarningView.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/components/index.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/util/ForegroundServiceConfig.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/util/PlayingState.d.ts +0 -0
- /package/lib/typescript/{commonjs/src → src}/util/Translations.d.ts +0 -0
|
@@ -9,171 +9,364 @@
|
|
|
9
9
|
* SPDX-License-Identifier: MIT
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { COLORS } from
|
|
13
|
-
import {
|
|
14
|
-
|
|
12
|
+
import { COLORS } from "../util/Colors";
|
|
13
|
+
import {
|
|
14
|
+
ActivityIndicator,
|
|
15
|
+
Image,
|
|
16
|
+
TouchableOpacity,
|
|
17
|
+
useColorScheme,
|
|
18
|
+
View,
|
|
19
|
+
} from "react-native";
|
|
20
|
+
import { PlayingState } from "../util/PlayingState";
|
|
15
21
|
|
|
16
22
|
export interface PlayButtonProps {
|
|
17
23
|
playingState: PlayingState;
|
|
18
24
|
isChannelOnline: boolean;
|
|
25
|
+
hasAudio?: boolean;
|
|
26
|
+
hasSubtitles?: boolean;
|
|
19
27
|
isDarkMode?: boolean;
|
|
20
|
-
|
|
28
|
+
onAudioPress?: () => void;
|
|
29
|
+
onSubtitlesPress?: () => void;
|
|
30
|
+
onPress?: () => void;
|
|
21
31
|
}
|
|
22
32
|
|
|
23
33
|
const PlayButtonView: React.FC<PlayButtonProps> = ({
|
|
24
34
|
playingState,
|
|
25
35
|
isChannelOnline,
|
|
26
|
-
|
|
36
|
+
hasAudio = true,
|
|
37
|
+
hasSubtitles = false,
|
|
38
|
+
isDarkMode = useColorScheme() === "dark",
|
|
39
|
+
onAudioPress,
|
|
40
|
+
onSubtitlesPress,
|
|
27
41
|
onPress,
|
|
28
|
-
|
|
29
42
|
}) => {
|
|
30
43
|
const isPlaying = playingState === PlayingState.PLAYING;
|
|
31
44
|
const isTransitioning = playingState === PlayingState.TRANSITIONING;
|
|
32
45
|
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
const getAudioIconColor = () => {
|
|
47
|
+
if (!isChannelOnline) {
|
|
48
|
+
return isDarkMode ? "#5a5a60" : "#d1d1d6";
|
|
49
|
+
}
|
|
50
|
+
return COLORS.white;
|
|
51
|
+
};
|
|
38
52
|
|
|
39
|
-
const
|
|
53
|
+
const getSubtitlesIconColor = () => {
|
|
54
|
+
if (!isChannelOnline) {
|
|
55
|
+
return isDarkMode ? "#ffffff" : "#000000";
|
|
56
|
+
}
|
|
57
|
+
return COLORS.white;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const audioIconColor = getAudioIconColor();
|
|
61
|
+
const subtitlesIconColor = getSubtitlesIconColor();
|
|
40
62
|
|
|
41
|
-
const
|
|
63
|
+
const getAudioIcon = () => {
|
|
42
64
|
if (isTransitioning) {
|
|
43
|
-
return <ActivityIndicator size={20} color={
|
|
65
|
+
return <ActivityIndicator size={20} color={audioIconColor} style={{}} />;
|
|
44
66
|
}
|
|
45
67
|
return isPlaying ? (
|
|
46
68
|
<Image
|
|
47
|
-
source={require(
|
|
48
|
-
style={[{tintColor:
|
|
49
|
-
/>
|
|
69
|
+
source={require("../icons/pause.png")}
|
|
70
|
+
style={[{ tintColor: audioIconColor, width: 30, height: 26 }]}
|
|
71
|
+
/>
|
|
72
|
+
) : (
|
|
73
|
+
<Image
|
|
74
|
+
source={require("../icons/play.png")}
|
|
75
|
+
style={[{ tintColor: audioIconColor, width: 30, height: 26 }]}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const getSubtitlesIcon = () => {
|
|
81
|
+
return (
|
|
50
82
|
<Image
|
|
51
|
-
source={require(
|
|
52
|
-
style={[{tintColor:
|
|
83
|
+
source={require("../icons/captions.png")}
|
|
84
|
+
style={[{ tintColor: subtitlesIconColor, width: 30, height: 26 }]}
|
|
53
85
|
/>
|
|
54
86
|
);
|
|
55
87
|
};
|
|
56
88
|
|
|
57
89
|
const getStyleType = () => {
|
|
58
|
-
if (!isChannelOnline) return
|
|
59
|
-
if (isPlaying) return
|
|
60
|
-
return
|
|
90
|
+
if (!isChannelOnline) return "offline";
|
|
91
|
+
if (isPlaying) return "playing";
|
|
92
|
+
return "paused";
|
|
61
93
|
};
|
|
62
94
|
|
|
95
|
+
// If no audio and no subtitles, render disabled button with dashed border
|
|
96
|
+
if (!hasAudio && !hasSubtitles) {
|
|
97
|
+
const noContentStyle = {
|
|
98
|
+
...baseButtonStyleNoContent,
|
|
99
|
+
backgroundColor: isDarkMode ? "#1c1c1e00" : "#ffffff",
|
|
100
|
+
borderColor: isDarkMode
|
|
101
|
+
? COLORS_SCHEME.borderGrayDark
|
|
102
|
+
: COLORS_SCHEME.borderGrayLight,
|
|
103
|
+
borderStyle: "dashed" as const,
|
|
104
|
+
};
|
|
105
|
+
return (
|
|
106
|
+
<TouchableOpacity
|
|
107
|
+
style={noContentStyle}
|
|
108
|
+
disabled={true}
|
|
109
|
+
activeOpacity={0.8}
|
|
110
|
+
>
|
|
111
|
+
<View />
|
|
112
|
+
</TouchableOpacity>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// If only audio, render simple button
|
|
117
|
+
if (hasAudio && !hasSubtitles) {
|
|
118
|
+
return (
|
|
119
|
+
<TouchableOpacity
|
|
120
|
+
style={getButtonStyle(getStyleType(), isDarkMode, false)}
|
|
121
|
+
onPress={onAudioPress || onPress}
|
|
122
|
+
activeOpacity={0.8}
|
|
123
|
+
>
|
|
124
|
+
{getAudioIcon()}
|
|
125
|
+
</TouchableOpacity>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// If only subtitles, render subtitles button
|
|
130
|
+
if (!hasAudio && hasSubtitles) {
|
|
131
|
+
return (
|
|
132
|
+
<TouchableOpacity
|
|
133
|
+
style={getButtonStyle(getStyleType(), isDarkMode, false)}
|
|
134
|
+
onPress={onSubtitlesPress || onPress}
|
|
135
|
+
activeOpacity={0.8}
|
|
136
|
+
>
|
|
137
|
+
{getSubtitlesIcon()}
|
|
138
|
+
</TouchableOpacity>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// If both audio and subtitles, render split button
|
|
63
143
|
return (
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
144
|
+
<View style={getSplitButtonContainerStyle(getStyleType(), isDarkMode)}>
|
|
145
|
+
<TouchableOpacity
|
|
146
|
+
style={getSplitButtonAudioStyle(getStyleType(), isDarkMode)}
|
|
147
|
+
onPress={onAudioPress || onPress}
|
|
148
|
+
activeOpacity={0.8}
|
|
149
|
+
>
|
|
150
|
+
{getAudioIcon()}
|
|
151
|
+
</TouchableOpacity>
|
|
152
|
+
<View style={getDividerStyle(getStyleType(), isDarkMode)} />
|
|
153
|
+
<TouchableOpacity
|
|
154
|
+
style={getSplitButtonSubtitlesStyle(getStyleType(), isDarkMode)}
|
|
155
|
+
onPress={onSubtitlesPress || onPress}
|
|
156
|
+
activeOpacity={0.8}
|
|
157
|
+
>
|
|
158
|
+
{getSubtitlesIcon()}
|
|
159
|
+
</TouchableOpacity>
|
|
160
|
+
</View>
|
|
71
161
|
);
|
|
72
162
|
};
|
|
73
163
|
|
|
74
|
-
type ButtonStyleType =
|
|
164
|
+
type ButtonStyleType = "paused" | "playing" | "offline";
|
|
75
165
|
|
|
76
166
|
export const getButtonStyle = (
|
|
77
167
|
type: ButtonStyleType,
|
|
78
|
-
isDarkMode: boolean
|
|
168
|
+
isDarkMode: boolean,
|
|
169
|
+
isSplit: boolean = false,
|
|
79
170
|
) => {
|
|
80
|
-
|
|
171
|
+
if (isSplit) {
|
|
172
|
+
return SplitButtonStyles[type][isDarkMode ? "dark" : "light"].container;
|
|
173
|
+
}
|
|
174
|
+
return ButtonStyles[type][isDarkMode ? "dark" : "light"];
|
|
81
175
|
};
|
|
82
176
|
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
outlineStyle: 'solid' as const,
|
|
89
|
-
outlineWidth: 3,
|
|
177
|
+
export const getSplitButtonContainerStyle = (
|
|
178
|
+
type: ButtonStyleType,
|
|
179
|
+
isDarkMode: boolean,
|
|
180
|
+
) => {
|
|
181
|
+
return SplitButtonStyles[type][isDarkMode ? "dark" : "light"].container;
|
|
90
182
|
};
|
|
91
183
|
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
184
|
+
export const getSplitButtonAudioStyle = (
|
|
185
|
+
type: ButtonStyleType,
|
|
186
|
+
isDarkMode: boolean,
|
|
187
|
+
) => {
|
|
188
|
+
return SplitButtonStyles[type][isDarkMode ? "dark" : "light"].audio;
|
|
189
|
+
};
|
|
96
190
|
|
|
97
|
-
|
|
191
|
+
export const getSplitButtonSubtitlesStyle = (
|
|
192
|
+
type: ButtonStyleType,
|
|
193
|
+
isDarkMode: boolean,
|
|
194
|
+
) => {
|
|
195
|
+
return SplitButtonStyles[type][isDarkMode ? "dark" : "light"].subtitles;
|
|
196
|
+
};
|
|
98
197
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
198
|
+
export const getDividerStyle = (type: ButtonStyleType, isDarkMode: boolean) => {
|
|
199
|
+
// When button is online (orange background), divider is light orange
|
|
200
|
+
if (type === "paused" || type === "playing") {
|
|
201
|
+
return {
|
|
202
|
+
width: 1,
|
|
203
|
+
height: 24,
|
|
204
|
+
backgroundColor: COLORS_SCHEME.dividerOnOrange,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
102
207
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
208
|
+
// When button is offline, divider is gray (same as border)
|
|
209
|
+
return {
|
|
210
|
+
width: 1,
|
|
211
|
+
height: 24,
|
|
212
|
+
backgroundColor: isDarkMode
|
|
213
|
+
? COLORS_SCHEME.borderGrayDark
|
|
214
|
+
: COLORS_SCHEME.borderGrayLight,
|
|
215
|
+
};
|
|
216
|
+
};
|
|
106
217
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
218
|
+
const baseButtonStyle = {
|
|
219
|
+
width: 96,
|
|
220
|
+
height: 44,
|
|
221
|
+
borderRadius: 22,
|
|
222
|
+
borderWidth: 1,
|
|
223
|
+
alignItems: "center" as const,
|
|
224
|
+
justifyContent: "center" as const,
|
|
111
225
|
};
|
|
112
226
|
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
227
|
+
const baseButtonStyleNoContent = {
|
|
228
|
+
width: 96,
|
|
229
|
+
height: 44,
|
|
230
|
+
borderRadius: 22,
|
|
231
|
+
borderWidth: 1,
|
|
232
|
+
alignItems: "center" as const,
|
|
233
|
+
justifyContent: "center" as const,
|
|
234
|
+
};
|
|
117
235
|
|
|
118
|
-
|
|
236
|
+
const baseSplitButtonStyle = {
|
|
237
|
+
width: 96,
|
|
238
|
+
height: 44,
|
|
239
|
+
borderRadius: 22,
|
|
240
|
+
borderWidth: 1,
|
|
241
|
+
flexDirection: "row" as const,
|
|
242
|
+
alignItems: "center" as const,
|
|
243
|
+
justifyContent: "center" as const,
|
|
244
|
+
overflow: "hidden" as const,
|
|
245
|
+
};
|
|
119
246
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
247
|
+
const baseSplitAudioStyle = {
|
|
248
|
+
flex: 1,
|
|
249
|
+
height: 44,
|
|
250
|
+
alignItems: "center" as const,
|
|
251
|
+
justifyContent: "center" as const,
|
|
252
|
+
};
|
|
123
253
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
254
|
+
const baseSplitSubtitlesStyle = {
|
|
255
|
+
flex: 1,
|
|
256
|
+
height: 44,
|
|
257
|
+
alignItems: "center" as const,
|
|
258
|
+
justifyContent: "center" as const,
|
|
259
|
+
};
|
|
127
260
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
261
|
+
const COLORS_SCHEME = {
|
|
262
|
+
orange: "#f56230",
|
|
263
|
+
dividerOnOrange: "#ffffff80",
|
|
264
|
+
borderGrayLight: "#d1d1d6",
|
|
265
|
+
borderGrayDark: "#5a5a60",
|
|
132
266
|
};
|
|
133
267
|
|
|
134
268
|
export const ButtonStyles = {
|
|
135
269
|
paused: {
|
|
136
270
|
light: {
|
|
137
271
|
...baseButtonStyle,
|
|
138
|
-
backgroundColor:
|
|
139
|
-
borderColor:
|
|
140
|
-
outlineColor: ButtonColorLight.playButtonBorderThickOnline,
|
|
272
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
273
|
+
borderColor: "transparent",
|
|
141
274
|
},
|
|
142
275
|
dark: {
|
|
143
276
|
...baseButtonStyle,
|
|
144
|
-
backgroundColor:
|
|
145
|
-
borderColor:
|
|
146
|
-
outlineColor: ButtonColorDark.playButtonBorderThickOnline,
|
|
277
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
278
|
+
borderColor: "transparent",
|
|
147
279
|
},
|
|
148
280
|
},
|
|
149
281
|
|
|
150
282
|
playing: {
|
|
151
283
|
light: {
|
|
152
284
|
...baseButtonStyle,
|
|
153
|
-
backgroundColor:
|
|
154
|
-
borderColor:
|
|
155
|
-
outlineColor: ButtonColorLight.playButtonBorderThickPlaying,
|
|
285
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
286
|
+
borderColor: "transparent",
|
|
156
287
|
},
|
|
157
288
|
dark: {
|
|
158
289
|
...baseButtonStyle,
|
|
159
|
-
backgroundColor:
|
|
160
|
-
borderColor:
|
|
161
|
-
outlineColor: ButtonColorDark.playButtonBorderThickPlaying,
|
|
290
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
291
|
+
borderColor: "transparent",
|
|
162
292
|
},
|
|
163
293
|
},
|
|
164
294
|
|
|
165
295
|
offline: {
|
|
166
296
|
light: {
|
|
167
297
|
...baseButtonStyle,
|
|
168
|
-
backgroundColor:
|
|
169
|
-
borderColor:
|
|
170
|
-
outlineColor: ButtonColorLight.playButtonBorderThickOffline,
|
|
298
|
+
backgroundColor: "#ffffff",
|
|
299
|
+
borderColor: COLORS_SCHEME.borderGrayLight,
|
|
171
300
|
},
|
|
172
301
|
dark: {
|
|
173
302
|
...baseButtonStyle,
|
|
174
|
-
backgroundColor:
|
|
175
|
-
borderColor:
|
|
176
|
-
|
|
303
|
+
backgroundColor: "#212429",
|
|
304
|
+
borderColor: COLORS_SCHEME.borderGrayDark,
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
export const SplitButtonStyles = {
|
|
310
|
+
paused: {
|
|
311
|
+
light: {
|
|
312
|
+
container: {
|
|
313
|
+
...baseSplitButtonStyle,
|
|
314
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
315
|
+
borderColor: "transparent",
|
|
316
|
+
},
|
|
317
|
+
audio: baseSplitAudioStyle,
|
|
318
|
+
subtitles: baseSplitSubtitlesStyle,
|
|
319
|
+
},
|
|
320
|
+
dark: {
|
|
321
|
+
container: {
|
|
322
|
+
...baseSplitButtonStyle,
|
|
323
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
324
|
+
borderColor: "transparent",
|
|
325
|
+
},
|
|
326
|
+
audio: baseSplitAudioStyle,
|
|
327
|
+
subtitles: baseSplitSubtitlesStyle,
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
|
|
331
|
+
playing: {
|
|
332
|
+
light: {
|
|
333
|
+
container: {
|
|
334
|
+
...baseSplitButtonStyle,
|
|
335
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
336
|
+
borderColor: "transparent",
|
|
337
|
+
},
|
|
338
|
+
audio: baseSplitAudioStyle,
|
|
339
|
+
subtitles: baseSplitSubtitlesStyle,
|
|
340
|
+
},
|
|
341
|
+
dark: {
|
|
342
|
+
container: {
|
|
343
|
+
...baseSplitButtonStyle,
|
|
344
|
+
backgroundColor: COLORS_SCHEME.orange,
|
|
345
|
+
borderColor: "transparent",
|
|
346
|
+
},
|
|
347
|
+
audio: baseSplitAudioStyle,
|
|
348
|
+
subtitles: baseSplitSubtitlesStyle,
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
|
|
352
|
+
offline: {
|
|
353
|
+
light: {
|
|
354
|
+
container: {
|
|
355
|
+
...baseSplitButtonStyle,
|
|
356
|
+
backgroundColor: "#ffffff",
|
|
357
|
+
borderColor: COLORS_SCHEME.borderGrayLight,
|
|
358
|
+
},
|
|
359
|
+
audio: baseSplitAudioStyle,
|
|
360
|
+
subtitles: baseSplitSubtitlesStyle,
|
|
361
|
+
},
|
|
362
|
+
dark: {
|
|
363
|
+
container: {
|
|
364
|
+
...baseSplitButtonStyle,
|
|
365
|
+
backgroundColor: "#212429",
|
|
366
|
+
borderColor: COLORS_SCHEME.borderGrayDark,
|
|
367
|
+
},
|
|
368
|
+
audio: baseSplitAudioStyle,
|
|
369
|
+
subtitles: baseSplitSubtitlesStyle,
|
|
177
370
|
},
|
|
178
371
|
},
|
|
179
372
|
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|