import React from 'react'; import { View, Text, StyleSheet, ScrollView, SafeAreaView, Platform, TouchableOpacity, StatusBar, Switch, } from 'react-native'; import { useNavigation } from '@react-navigation/native'; import { useSettings, AppSettings } from '../hooks/useSettings'; import MaterialIcons from 'react-native-vector-icons/MaterialIcons'; import { useTheme } from '../contexts/ThemeContext'; const ANDROID_STATUSBAR_HEIGHT = StatusBar.currentHeight || 0; interface SettingItemProps { title: string; description?: string; icon: string; isSelected: boolean; onPress: () => void; isLast?: boolean; } const SettingItem: React.FC = ({ title, description, icon, isSelected, onPress, isLast, }) => { const { currentTheme } = useTheme(); return ( {title} {description && ( {description} )} {isSelected && ( )} ); }; const PlayerSettingsScreen: React.FC = () => { const { settings, updateSetting } = useSettings(); const { currentTheme } = useTheme(); const navigation = useNavigation(); const playerOptions = [ { id: 'internal', title: 'Built-in Player', description: 'Use the app\'s default video player', icon: 'play-circle-outline', }, ...(Platform.OS === 'ios' ? [ { id: 'vlc', title: 'VLC', description: 'Open streams in VLC media player', icon: 'video-library', }, { id: 'infuse', title: 'Infuse', description: 'Open streams in Infuse player', icon: 'smart-display', }, { id: 'outplayer', title: 'OutPlayer', description: 'Open streams in OutPlayer', icon: 'slideshow', }, { id: 'vidhub', title: 'VidHub', description: 'Open streams in VidHub player', icon: 'ondemand-video', }, ] : [ { id: 'external', title: 'External Player', description: 'Open streams in your preferred video player', icon: 'open-in-new', }, ]), ]; const handleBack = () => { navigation.goBack(); }; return ( Settings {/* Empty for now, but ready for future actions */} Video Player PLAYER SELECTION {playerOptions.map((option, index) => ( { if (Platform.OS === 'ios') { updateSetting('preferredPlayer', option.id as AppSettings['preferredPlayer']); } else { updateSetting('useExternalPlayer', option.id === 'external'); } }} isLast={index === playerOptions.length - 1} /> ))} PLAYBACK OPTIONS Auto-play Best Stream Automatically start the highest quality stream available. updateSetting('autoplayBestStream', value)} thumbColor={settings.autoplayBestStream ? currentTheme.colors.primary : undefined} /> Always Resume Skip the resume prompt and automatically continue where you left off (if less than 85% watched). updateSetting('alwaysResume', value)} thumbColor={settings.alwaysResume ? currentTheme.colors.primary : undefined} /> ); }; const styles = StyleSheet.create({ container: { flex: 1, }, header: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 16, paddingTop: Platform.OS === 'android' ? ANDROID_STATUSBAR_HEIGHT + 8 : 8, }, backButton: { flexDirection: 'row', alignItems: 'center', padding: 8, }, backText: { fontSize: 17, marginLeft: 8, }, headerActions: { flexDirection: 'row', alignItems: 'center', }, headerButton: { padding: 8, marginLeft: 8, }, headerTitle: { fontSize: 34, fontWeight: 'bold', paddingHorizontal: 16, marginBottom: 24, }, scrollView: { flex: 1, }, scrollContent: { paddingBottom: 24, }, section: { paddingHorizontal: 16, paddingTop: 24, }, sectionTitle: { fontSize: 13, fontWeight: '600', marginBottom: 8, paddingHorizontal: 4, letterSpacing: 0.5, }, card: { borderRadius: 12, overflow: 'hidden', marginBottom: 24, shadowColor: 'rgba(0,0,0,0.1)', shadowOffset: { width: 0, height: 2 }, shadowOpacity: 0.5, shadowRadius: 4, elevation: 3, }, settingItem: { paddingVertical: 16, paddingHorizontal: 16, }, settingItemBorder: { borderBottomWidth: 1, }, settingContent: { flexDirection: 'row', alignItems: 'center', }, settingIconContainer: { width: 36, height: 36, borderRadius: 10, alignItems: 'center', justifyContent: 'center', marginRight: 16, }, settingText: { flex: 1, }, settingTitle: { fontSize: 16, fontWeight: '500', marginBottom: 2, }, settingDescription: { fontSize: 14, marginTop: 2, }, checkIcon: { marginLeft: 16, }, }); export default PlayerSettingsScreen;