From ab7f008bbb372cc4be13b7f79954005c21b9739a Mon Sep 17 00:00:00 2001 From: tapframe Date: Mon, 5 Jan 2026 13:39:02 +0530 Subject: [PATCH] added toggle to control this week sections --- src/hooks/useSettings.ts | 2 + src/screens/HomeScreen.tsx | 6 ++- src/screens/HomeScreenSettings.tsx | 69 ++++++++++++++++++------------ 3 files changed, 47 insertions(+), 30 deletions(-) diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.ts index 4165cc4..fd58bca 100644 --- a/src/hooks/useSettings.ts +++ b/src/hooks/useSettings.ts @@ -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 diff --git a/src/screens/HomeScreen.tsx b/src/screens/HomeScreen.tsx index 026ae69..364ccc1 100644 --- a/src/screens/HomeScreen.tsx +++ b/src/screens/HomeScreen.tsx @@ -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)); diff --git a/src/screens/HomeScreenSettings.tsx b/src/screens/HomeScreenSettings.tsx index ea31486..6979bff 100644 --- a/src/screens/HomeScreenSettings.tsx +++ b/src/screens/HomeScreenSettings.tsx @@ -64,11 +64,11 @@ const SettingItem: React.FC = ({ const isTabletDevice = Platform.OS !== 'web' && (Dimensions.get('window').width >= 768); return ( - { 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 }) => ( - {selected && } {label} @@ -254,9 +254,9 @@ const HomeScreenSettings: React.FC = () => { }, [settings.selectedHeroCatalogs]); const ChevronRight = () => ( - ); @@ -269,30 +269,30 @@ const HomeScreenSettings: React.FC = () => { - Settings - + {/* Empty for now, but ready for future actions */} - + Home Screen Settings {/* Saved indicator */} - { Changes Applied - { isDarkMode={isDarkMode} colors={colors} renderControl={() => ( - handleUpdateSetting('showHeroSection', value)} + handleUpdateSetting('showHeroSection', value)} + /> + )} + /> + ( + handleUpdateSetting('showThisWeekSection', value)} /> )} /> @@ -344,7 +357,7 @@ const HomeScreenSettings: React.FC = () => { Hero Layout { isDarkMode={isDarkMode} colors={colors} renderControl={() => ( - handleUpdateSetting('enableHomeHeroBackground', value)} /> @@ -393,7 +406,7 @@ const HomeScreenSettings: React.FC = () => { Posters Show Titles - handleUpdateSetting('showPosterTitles', value)} />