added toggle to control this week sections

This commit is contained in:
tapframe 2026-01-05 13:39:02 +05:30
parent 4dd1fca0a7
commit ab7f008bbb
3 changed files with 47 additions and 30 deletions

View file

@ -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

View file

@ -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));

View file

@ -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 }) => (
@ -323,6 +323,19 @@ const HomeScreenSettings: React.FC = () => {
/>
)}
/>
<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)}
/>
)}
/>
{settings.showHeroSection && (
<SettingItem
title="Select Catalogs"