From 3816435e0176c1cd84d17960f5e8c8ffc122cf52 Mon Sep 17 00:00:00 2001 From: tapframe Date: Fri, 20 Jun 2025 02:01:31 +0530 Subject: [PATCH] Refactor ContinueWatchingSection and remove debug buttons from HomeScreen This update simplifies the ContinueWatchingSection by removing the loading condition for rendering when there are no continue watching items. Additionally, debug buttons for managing watch progress have been removed from the HomeScreen, streamlining the UI and enhancing user experience. --- .../home/ContinueWatchingSection.tsx | 2 +- src/screens/HomeScreen.tsx | 95 ------------------- 2 files changed, 1 insertion(+), 96 deletions(-) diff --git a/src/components/home/ContinueWatchingSection.tsx b/src/components/home/ContinueWatchingSection.tsx index 2539ed5..2872d41 100644 --- a/src/components/home/ContinueWatchingSection.tsx +++ b/src/components/home/ContinueWatchingSection.tsx @@ -322,7 +322,7 @@ const ContinueWatchingSection = React.forwardRef((props, re }, [navigation]); // If no continue watching items, don't render anything - if (continueWatchingItems.length === 0 && !loading) { + if (continueWatchingItems.length === 0) { return null; } diff --git a/src/screens/HomeScreen.tsx b/src/screens/HomeScreen.tsx index 9a248ee..9eb77a5 100644 --- a/src/screens/HomeScreen.tsx +++ b/src/screens/HomeScreen.tsx @@ -624,49 +624,6 @@ const HomeScreen = () => { - {/* Debug buttons for Continue Watching */} - - - - Add Test Progress - - - - - Clear All Progress - - - - - Refresh - - - - {catalogs.length > 0 ? ( @@ -709,58 +666,6 @@ const HomeScreen = () => { featuredContentSource ]); - // Debug function to add test watch progress - const addTestWatchProgress = useCallback(async () => { - console.log('[HomeScreen] Adding test watch progress data...'); - try { - // Add a test movie with 50% progress - await storageService.setWatchProgress( - 'tt1375666', // Inception IMDB ID - 'movie', - { - currentTime: 3600, // 1 hour - duration: 7200, // 2 hours (50% progress) - lastUpdated: Date.now() - } - ); - - // Add a test series episode with 30% progress - await storageService.setWatchProgress( - 'tt0944947', // Game of Thrones IMDB ID - 'series', - { - currentTime: 1800, // 30 minutes - duration: 6000, // 100 minutes (30% progress) - lastUpdated: Date.now() - 86400000 // 1 day ago - }, - 'tt0944947:1:1' // Season 1, Episode 1 - ); - - console.log('[HomeScreen] Test watch progress added successfully'); - - // Refresh the continue watching section - await refreshContinueWatching(); - } catch (error) { - console.error('[HomeScreen] Error adding test watch progress:', error); - } - }, [refreshContinueWatching]); - - // Debug function to clear all watch progress - const clearAllWatchProgress = useCallback(async () => { - console.log('[HomeScreen] Clearing all watch progress...'); - try { - const allProgress = await storageService.getAllWatchProgress(); - for (const key of Object.keys(allProgress)) { - const [type, id, episodeId] = key.split(':'); - await storageService.removeWatchProgress(id, type, episodeId); - } - console.log('[HomeScreen] All watch progress cleared'); - await refreshContinueWatching(); - } catch (error) { - console.error('[HomeScreen] Error clearing watch progress:', error); - } - }, [refreshContinueWatching]); - return isLoading ? renderLoadingScreen : renderMainContent; };