mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-01-11 20:10:25 +00:00
added toggle to control this week sections
This commit is contained in:
parent
4dd1fca0a7
commit
ab7f008bbb
3 changed files with 47 additions and 30 deletions
|
|
@ -37,6 +37,7 @@ export interface AppSettings {
|
|||
useExternalPlayer: boolean;
|
||||
preferredPlayer: 'internal' | 'vlc' | 'infuse' | 'outplayer' | 'vidhub' | 'infuse_livecontainer' | 'external';
|
||||
showHeroSection: boolean;
|
||||
showThisWeekSection: boolean; // Toggle "This Week" section
|
||||
featuredContentSource: 'tmdb' | 'catalogs';
|
||||
heroStyle: 'legacy' | 'carousel' | 'appletv';
|
||||
selectedHeroCatalogs: string[]; // Array of catalog IDs to display in hero section
|
||||
|
|
@ -123,6 +124,7 @@ export const DEFAULT_SETTINGS: AppSettings = {
|
|||
useExternalPlayer: false,
|
||||
preferredPlayer: 'internal',
|
||||
showHeroSection: true,
|
||||
showThisWeekSection: true, // Enabled by default
|
||||
featuredContentSource: 'catalogs',
|
||||
heroStyle: 'appletv',
|
||||
selectedHeroCatalogs: [], // Empty array means all catalogs are selected
|
||||
|
|
|
|||
|
|
@ -667,7 +667,9 @@ const HomeScreen = () => {
|
|||
}
|
||||
|
||||
// Normal flow when addons are present (featured moved to ListHeaderComponent)
|
||||
data.push({ type: 'thisWeek', key: 'thisWeek' });
|
||||
if (settings.showThisWeekSection) {
|
||||
data.push({ type: 'thisWeek', key: 'thisWeek' });
|
||||
}
|
||||
|
||||
// Only show a limited number of catalogs initially for performance
|
||||
const catalogsToShow = catalogs.slice(0, visibleCatalogCount);
|
||||
|
|
@ -687,7 +689,7 @@ const HomeScreen = () => {
|
|||
}
|
||||
|
||||
return data;
|
||||
}, [hasAddons, catalogs, visibleCatalogCount]);
|
||||
}, [hasAddons, catalogs, visibleCatalogCount, settings.showThisWeekSection]);
|
||||
|
||||
const handleLoadMoreCatalogs = useCallback(() => {
|
||||
setVisibleCatalogCount(prev => Math.min(prev + 3, catalogs.length));
|
||||
|
|
|
|||
|
|
@ -64,11 +64,11 @@ const SettingItem: React.FC<SettingItemProps> = ({
|
|||
const isTabletDevice = Platform.OS !== 'web' && (Dimensions.get('window').width >= 768);
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
<TouchableOpacity
|
||||
activeOpacity={onPress ? 0.7 : 1}
|
||||
onPress={onPress}
|
||||
style={[
|
||||
styles.settingItem,
|
||||
styles.settingItem,
|
||||
!isLast && styles.settingItemBorder,
|
||||
{ borderBottomColor: isDarkMode ? 'rgba(255,255,255,0.08)' : 'rgba(0,0,0,0.05)' }
|
||||
]}
|
||||
|
|
@ -127,8 +127,8 @@ const HomeScreenSettings: React.FC = () => {
|
|||
if (Platform.OS === 'ios') {
|
||||
StatusBar.setHidden(false);
|
||||
}
|
||||
} catch {}
|
||||
return () => {};
|
||||
} catch { }
|
||||
return () => { };
|
||||
}, [isDarkMode, colors.darkBackground])
|
||||
);
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ const HomeScreenSettings: React.FC = () => {
|
|||
if (isTabletDevice && settings.heroStyle !== 'carousel') {
|
||||
updateSetting('heroStyle', 'carousel' as any);
|
||||
}
|
||||
} catch {}
|
||||
} catch { }
|
||||
}, [isTabletDevice, settings.heroStyle, updateSetting]);
|
||||
|
||||
const CustomSwitch = ({ value, onValueChange }: { value: boolean, onValueChange: (value: boolean) => void }) => (
|
||||
|
|
@ -184,20 +184,20 @@ const HomeScreenSettings: React.FC = () => {
|
|||
|
||||
// Radio button component for content source selection
|
||||
const RadioOption = ({ selected, onPress, label }: { selected: boolean, onPress: () => void, label: string }) => (
|
||||
<TouchableOpacity
|
||||
style={styles.radioOption}
|
||||
<TouchableOpacity
|
||||
style={styles.radioOption}
|
||||
onPress={onPress}
|
||||
activeOpacity={0.7}
|
||||
>
|
||||
<View style={styles.radioContainer}>
|
||||
<View style={[
|
||||
styles.radio,
|
||||
styles.radio,
|
||||
{ borderColor: isDarkMode ? colors.mediumEmphasis : colors.textMutedDark }
|
||||
]}>
|
||||
{selected && <View style={[styles.radioInner, { backgroundColor: colors.primary }]} />}
|
||||
</View>
|
||||
<Text style={[
|
||||
styles.radioLabel,
|
||||
styles.radioLabel,
|
||||
{ color: isDarkMode ? colors.highEmphasis : colors.textDark }
|
||||
]}>
|
||||
{label}
|
||||
|
|
@ -254,9 +254,9 @@ const HomeScreenSettings: React.FC = () => {
|
|||
}, [settings.selectedHeroCatalogs]);
|
||||
|
||||
const ChevronRight = () => (
|
||||
<MaterialIcons
|
||||
name="chevron-right"
|
||||
size={24}
|
||||
<MaterialIcons
|
||||
name="chevron-right"
|
||||
size={24}
|
||||
color={isDarkMode ? 'rgba(255,255,255,0.3)' : 'rgba(0,0,0,0.3)'}
|
||||
/>
|
||||
);
|
||||
|
|
@ -269,30 +269,30 @@ const HomeScreenSettings: React.FC = () => {
|
|||
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
|
||||
<View style={styles.header}>
|
||||
<TouchableOpacity onPress={handleBack} style={styles.backButton}>
|
||||
<MaterialIcons
|
||||
name="arrow-back"
|
||||
size={24}
|
||||
color={isDarkMode ? colors.highEmphasis : colors.textDark}
|
||||
<MaterialIcons
|
||||
name="arrow-back"
|
||||
size={24}
|
||||
color={isDarkMode ? colors.highEmphasis : colors.textDark}
|
||||
/>
|
||||
<Text style={[styles.backText, { color: isDarkMode ? colors.highEmphasis : colors.textDark }]}>
|
||||
Settings
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
|
||||
|
||||
<View style={styles.headerActions}>
|
||||
{/* Empty for now, but ready for future actions */}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
|
||||
<Text style={[styles.headerTitle, { color: isDarkMode ? colors.highEmphasis : colors.textDark }]}>
|
||||
Home Screen Settings
|
||||
</Text>
|
||||
|
||||
{/* Saved indicator */}
|
||||
<Animated.View
|
||||
<Animated.View
|
||||
style={[
|
||||
styles.savedIndicator,
|
||||
{
|
||||
styles.savedIndicator,
|
||||
{
|
||||
opacity: fadeAnim,
|
||||
backgroundColor: isDarkMode ? 'rgba(0, 180, 150, 0.9)' : 'rgba(0, 180, 150, 0.9)'
|
||||
}
|
||||
|
|
@ -303,7 +303,7 @@ const HomeScreenSettings: React.FC = () => {
|
|||
<Text style={styles.savedIndicatorText}>Changes Applied</Text>
|
||||
</Animated.View>
|
||||
|
||||
<ScrollView
|
||||
<ScrollView
|
||||
style={styles.scrollView}
|
||||
showsVerticalScrollIndicator={false}
|
||||
contentContainerStyle={styles.scrollContent}
|
||||
|
|
@ -317,9 +317,22 @@ const HomeScreenSettings: React.FC = () => {
|
|||
isDarkMode={isDarkMode}
|
||||
colors={colors}
|
||||
renderControl={() => (
|
||||
<CustomSwitch
|
||||
value={settings.showHeroSection}
|
||||
onValueChange={(value) => handleUpdateSetting('showHeroSection', value)}
|
||||
<CustomSwitch
|
||||
value={settings.showHeroSection}
|
||||
onValueChange={(value) => handleUpdateSetting('showHeroSection', value)}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
<SettingItem
|
||||
title="Show This Week Section"
|
||||
description="New episodes from current week"
|
||||
icon="date-range"
|
||||
isDarkMode={isDarkMode}
|
||||
colors={colors}
|
||||
renderControl={() => (
|
||||
<CustomSwitch
|
||||
value={settings.showThisWeekSection}
|
||||
onValueChange={(value) => handleUpdateSetting('showThisWeekSection', value)}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
|
@ -344,7 +357,7 @@ const HomeScreenSettings: React.FC = () => {
|
|||
<Text style={[styles.segmentTitle, { color: isDarkMode ? colors.mediumEmphasis : colors.textMutedDark }]}>Hero Layout</Text>
|
||||
<SegmentedControl
|
||||
options={[
|
||||
{ label: 'Legacy', value: 'legacy' },
|
||||
{ label: 'Legacy', value: 'legacy' },
|
||||
{ label: 'Carousel', value: 'carousel' },
|
||||
{ label: 'Apple TV', value: 'appletv' }
|
||||
]}
|
||||
|
|
@ -377,7 +390,7 @@ const HomeScreenSettings: React.FC = () => {
|
|||
isDarkMode={isDarkMode}
|
||||
colors={colors}
|
||||
renderControl={() => (
|
||||
<CustomSwitch
|
||||
<CustomSwitch
|
||||
value={settings.enableHomeHeroBackground}
|
||||
onValueChange={(value) => handleUpdateSetting('enableHomeHeroBackground', value)}
|
||||
/>
|
||||
|
|
@ -393,7 +406,7 @@ const HomeScreenSettings: React.FC = () => {
|
|||
<Text style={[styles.cardHeader, { color: isDarkMode ? colors.mediumEmphasis : colors.textMutedDark }]}>Posters</Text>
|
||||
<View style={styles.settingsRowInline}>
|
||||
<Text style={[styles.rowLabel, { color: isDarkMode ? colors.highEmphasis : colors.textDark }]}>Show Titles</Text>
|
||||
<CustomSwitch
|
||||
<CustomSwitch
|
||||
value={settings.showPosterTitles}
|
||||
onValueChange={(value) => handleUpdateSetting('showPosterTitles', value)}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue