Skip to content

Commit 879c044

Browse files
committed
chore: code cleanup
1 parent 3e5bdaf commit 879c044

22 files changed

+34
-404
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@
4545
},
4646
"homepage": "https://github.com/r3tr0c0d3r/react-native-nexen-player#readme",
4747
"publishConfig": {
48-
"zzz": "https://registry.npmjs.org/",
49-
"registry": "http://localhost:4873/"
48+
"registry": "https://registry.npmjs.org/"
5049
},
5150
"devDependencies": {
5251
"@arkweid/lefthook": "^0.7.7",

src/components/DropDown.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ const DropDown = (props: DropDownProps) => {
4343
theme,
4444
onItemSelect,
4545
} = props;
46-
// console.log(`DropDown:: height:${height}`);
4746
const dropdownRef = React.useRef<TouchableOpacity>(null);
4847
const containerHeight = React.useRef(new Animated.Value(0)).current;
4948
const opacityAnim = containerHeight.interpolate({
@@ -217,7 +216,7 @@ const styles = StyleSheet.create({
217216
color: '#fafafa',
218217
},
219218
icon: {
220-
// margin: 10,
219+
221220
},
222221
dropdown: {
223222
...StyleSheet.absoluteFillObject,

src/components/ErrorView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React from 'react';
2-
import { StyleProp, StyleSheet, Text, View, ViewStyle } from 'react-native';
2+
import { StyleProp, StyleSheet, Text, ViewStyle } from 'react-native';
33
import { IconXCircle } from '../assets/icons';
44
import ModalView from './ModalView';
55
import type { TipViewTheme } from './TipView';
66

77
export interface ErrorViewTheme extends TipViewTheme {
8-
// font?: string;
8+
99
}
1010
type ErrorViewProps = {
1111
theme?: ErrorViewTheme;

src/components/FooterControl.tsx

Lines changed: 10 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
Animated,
44
I18nManager,
55
StyleSheet,
6-
Text,
76
TouchableHighlight,
87
View,
98
} from 'react-native';
@@ -31,16 +30,15 @@ import { formatTime } from '../utils/StringUtil';
3130
import SeekBar, { SeekBarTheme } from './SeekBar';
3231
import SlideButton, { SlideButtonTheme } from './SlideButton';
3332
import GradientView from './GradientView';
34-
import IconTagView, {
33+
import {
3534
IconTagViewRef,
3635
IconTagViewState,
37-
IconTagViewTheme,
3836
} from './IconTagView';
3937
import { getAlphaColor } from '../utils/ColorUtil';
4038
import TimeTagView, { TimeTagViewTheme } from './TimeTagView';
4139
import VolumeTagView, { VolumeTagViewTheme } from './VolumeTagView';
4240
import type { NexenTheme } from '../utils/Theme';
43-
import type { EdgeInsets, LayoutMode, NexenConfig } from './NexenPlayer';
41+
import type { EdgeInsets, NexenConfig } from './NexenPlayer';
4442

4543
type FooterControlProps = {
4644
opacity: Animated.Value;
@@ -49,24 +47,14 @@ type FooterControlProps = {
4947
isSeekable?: React.MutableRefObject<boolean>;
5048
isVolumeSeekable?: React.MutableRefObject<boolean>;
5149
fullScreen?: boolean;
52-
muted: boolean;
5350
locked: boolean;
5451
trackTime: number;
5552
cachedTrackTime: number;
5653
totalTrackTime: number;
57-
volume: number;
5854
totalVolume: number;
5955
insets?: EdgeInsets;
6056
playerConfig?: NexenConfig;
6157
nexenTheme?: NexenTheme;
62-
// layoutMode?: LayoutMode;
63-
// disableSkip?: boolean;
64-
// disableStop?: boolean;
65-
// disableRatio?: boolean;
66-
// disableVolume?: boolean;
67-
// disableSubtitle?: boolean;
68-
// disableFullscreen?: boolean;
69-
// disablePlaylist?: boolean;
7058
disablePlaylistAndSkip?: boolean;
7159
onPlayPress?: () => void;
7260
onFullScreenPress?: () => void;
@@ -114,28 +102,16 @@ const FooterControl = React.forwardRef<FooterControlRef, FooterControlProps>(
114102
marginBottom,
115103
paused,
116104
fullScreen,
117-
muted,
118105
locked,
119106
insets,
120107
playerConfig,
121108
nexenTheme,
122-
// layoutMode,
123-
124109
trackTime,
125110
cachedTrackTime,
126111
totalTrackTime,
127-
volume,
128112
totalVolume,
129113
isSeekable,
130114
isVolumeSeekable,
131-
// disableStop,
132-
// disableVolume,
133-
// disableSkip,
134-
// disableRatio,
135-
// disableSubtitle,
136-
// disableFullscreen,
137-
// disablePlaylist,
138-
// disableLargeMode,
139115
disablePlaylistAndSkip,
140116
onPlayPress,
141117
onCcPress,
@@ -158,10 +134,7 @@ const FooterControl = React.forwardRef<FooterControlRef, FooterControlProps>(
158134
onSkipNext,
159135
onSkipBack,
160136
onAspectRatioPress,
161-
// progress,
162-
// duration,
163137
} = props;
164-
// console.log(`FooterControl:: renders : isSeekable: ${isSeekable?.current}`);
165138
const isRTL = I18nManager.isRTL;
166139
const iconTagViewRef = React.useRef<IconTagViewRef>(null);
167140

@@ -193,8 +166,6 @@ const FooterControl = React.forwardRef<FooterControlRef, FooterControlProps>(
193166
TAG_VIEW_HEIGHT! +
194167
CONTAINER_VERTICAL_PADDING!;
195168

196-
// console.log(`FOOTER: HP: ${CONTAINER_HORIZONTAL_PADDING} VP: ${CONTAINER_VERTICAL_PADDING}`);
197-
// console.log(`FOOTER: CONTAINER_HEIGHT: ${CONTAINER_HEIGHT} VP: ${CONTAINER_VERTICAL_PADDING}`);
198169
useImperativeHandle(ref, () => ({
199170
updateIconTagView: (newState: IconTagViewState) => {
200171
iconTagViewRef.current?.updateState(newState);
@@ -231,15 +202,15 @@ const FooterControl = React.forwardRef<FooterControlRef, FooterControlProps>(
231202

232203
const volumeSeekBarTheme = React.useMemo((): VolumeTagViewTheme => {
233204
return {
234-
barColor: muted
205+
barColor: playerConfig?.muted
235206
? '#414141'
236207
: nexenTheme?.miniSeekBar?.barColor ||
237208
getAlphaColor(nexenTheme?.colors?.secondaryColor!, 0.7),
238-
underlayColor: muted
209+
underlayColor: playerConfig?.muted
239210
? '#919191'
240211
: nexenTheme?.miniSeekBar?.underlayColor ||
241212
getAlphaColor(nexenTheme?.colors?.primaryColor!, 0.3),
242-
thumbColor: muted
213+
thumbColor: playerConfig?.muted
243214
? '#313131'
244215
: nexenTheme?.miniSeekBar?.thumbColor ||
245216
nexenTheme?.colors?.accentColor,
@@ -258,7 +229,7 @@ const FooterControl = React.forwardRef<FooterControlRef, FooterControlProps>(
258229
thumbSize: nexenTheme?.miniSeekBar?.thumbSize,
259230
thumbCornerRadius: nexenTheme?.miniSeekBar?.thumbCornerRadius,
260231
};
261-
}, [nexenTheme, fullScreen, muted]);
232+
}, [nexenTheme, fullScreen, playerConfig]);
262233

263234
const timeTagViewTheme = React.useMemo((): TimeTagViewTheme => {
264235
return {
@@ -280,33 +251,6 @@ const FooterControl = React.forwardRef<FooterControlRef, FooterControlProps>(
280251
};
281252
}, [nexenTheme, fullScreen]);
282253

283-
/* const iconTagViewTheme = React.useMemo((): IconTagViewTheme => {
284-
return {
285-
height: nexenTheme?.tagView?.height,
286-
cornerRadius: nexenTheme?.tagView?.cornerRadius,
287-
borderWidth: nexenTheme?.tagView?.borderWidth,
288-
iconSize: nexenTheme?.tagView?.iconSize!,
289-
textSize: nexenTheme?.tagView?.textSize,
290-
textLineHeight: nexenTheme?.tagView?.textLineHeight,
291-
iconColor:
292-
nexenTheme?.tagView?.iconColor || nexenTheme?.colors?.primaryColor,
293-
activeIconColor:
294-
nexenTheme?.tagView?.activeIconColor ||
295-
getAlphaColor(nexenTheme?.colors?.accentColor!, 0.7),
296-
inactiveIconColor:
297-
nexenTheme?.tagView?.inactiveIconColor ||
298-
getAlphaColor(nexenTheme?.colors?.primaryColor!, 0.5),
299-
textColor:
300-
nexenTheme?.tagView?.textColor ||
301-
nexenTheme?.colors?.secondaryTextColor,
302-
borderColor:
303-
nexenTheme?.tagView?.borderColor ||
304-
getAlphaColor(nexenTheme?.colors?.accentColor!, 0.7),
305-
};
306-
}, [nexenTheme, fullScreen]); */
307-
308-
// console.log(`iconTagViewTheme:: ${JSON.stringify(iconTagViewTheme)}`);
309-
310254
const slideButtonTheme = React.useMemo((): SlideButtonTheme => {
311255

312256
return {
@@ -359,7 +303,7 @@ const FooterControl = React.forwardRef<FooterControlRef, FooterControlProps>(
359303
<View style={styles.iconButtonContainer}>
360304
{!playerConfig?.disableVolume && (
361305
<IconButton onPress={onVolumePress}>
362-
{muted ? (
306+
{playerConfig?.muted ? (
363307
<IconVolume size={ICON_SIZE} color={ICON_COLOR} />
364308
) : (
365309
<IconVolume2 size={ICON_SIZE} color={ICON_COLOR} />
@@ -420,9 +364,9 @@ const FooterControl = React.forwardRef<FooterControlRef, FooterControlProps>(
420364
<View style={styles.iconButtonContainer}>
421365
{!playerConfig?.disableVolume && (
422366
<VolumeTagView
423-
volume={volume}
367+
volume={playerConfig?.volume}
424368
totalVolume={totalVolume}
425-
muted={muted}
369+
muted={playerConfig?.muted!}
426370
isSeekable={isVolumeSeekable}
427371
theme={volumeSeekBarTheme}
428372
onVolumeSeekStart={onVolumeSeekStart}
@@ -456,11 +400,6 @@ const FooterControl = React.forwardRef<FooterControlRef, FooterControlProps>(
456400
alignItems: 'center',
457401
}}
458402
>
459-
{/* <IconTagView
460-
ref={iconTagViewRef}
461-
style={{ marginLeft: 12 }}
462-
theme={iconTagViewTheme}
463-
/> */}
464403
{!playerConfig?.disableResizeMode && !locked && (
465404
<IconButton onPress={onAspectRatioPress}>
466405
<IconAspectRatio size={ICON_SIZE} color={ICON_COLOR} />
@@ -475,12 +414,6 @@ const FooterControl = React.forwardRef<FooterControlRef, FooterControlProps>(
475414

476415
<View
477416
style={{
478-
// position: 'absolute',
479-
// left: 0,
480-
// right: 0,
481-
// bottom: 0,
482-
// backgroundColor: 'blue',
483-
// zIndex: 200,
484417
flex: 1,
485418
flexDirection: 'row',
486419
justifyContent: 'center',
@@ -631,7 +564,7 @@ const FooterControl = React.forwardRef<FooterControlRef, FooterControlProps>(
631564
export default React.memo(FooterControl);
632565

633566
FooterControl.defaultProps = {
634-
// disableLargeMode: false,
567+
635568
};
636569

637570
const styles = StyleSheet.create({
@@ -643,7 +576,6 @@ const styles = StyleSheet.create({
643576
height: 68,
644577
minHeight: 68,
645578
zIndex: 100,
646-
// backgroundColor: 'pink'
647579
},
648580
innerContainer: {
649581
position: 'absolute',
@@ -652,14 +584,10 @@ const styles = StyleSheet.create({
652584
right: 0,
653585
bottom: 0,
654586
flexDirection: 'row',
655-
// paddingBottom: 8,
656-
// backgroundColor: 'red',
657587
},
658588
iconButtonContainer: {
659589
flexDirection: 'row',
660590
alignItems: 'center',
661-
// flexShrink: 1,
662-
// backgroundColor: 'green',
663591
},
664592
lockedViewContainer: {
665593
flexDirection: 'row',
@@ -682,19 +610,6 @@ const styles = StyleSheet.create({
682610
trackSeekbar: {
683611
marginHorizontal: 4,
684612
},
685-
// textContainer: {
686-
// height: 18,
687-
// borderRadius: 9,
688-
// borderWidth: 2,
689-
// justifyContent: 'center',
690-
// alignItems: 'center',
691-
// },
692-
// timeText: {
693-
// fontSize: 11,
694-
// opacity: 0.8,
695-
// marginHorizontal: 6,
696-
// lineHeight: 13,
697-
// },
698613
slideButtonContainer: {
699614
flex: 1,
700615
padding: 8,

0 commit comments

Comments
 (0)