From 704c642a8fff9c70d4e575e1658e0f81f0333b6a Mon Sep 17 00:00:00 2001 From: tapframe Date: Thu, 9 Oct 2025 16:16:26 +0530 Subject: [PATCH] tablet padding changes --- ios/Podfile.lock | 4 ++-- src/components/home/ContentItem.tsx | 27 +++++++++++++++------------ src/screens/SearchScreen.tsx | 4 +++- src/screens/SettingsScreen.tsx | 22 ++++++++++++++++++---- 4 files changed, 38 insertions(+), 19 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 1bc56a1..c5a07f8 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -248,7 +248,7 @@ PODS: - SDWebImageSVGCoder (~> 1.7.0) - ExpoKeepAwake (14.0.3): - ExpoModulesCore - - ExpoLibVlcPlayer (2.2.1): + - ExpoLibVlcPlayer (2.1.7): - ExpoModulesCore - MobileVLCKit (= 3.6.1b1) - ExpoLinearGradient (14.0.2): @@ -2914,7 +2914,7 @@ SPEC CHECKSUMS: ExpoHaptics: 8d199b2f33245ea85289ff6c954c7ee7c00a5b5d ExpoImage: d840b256050f4428d2942bc2b6e9251f9e0d7021 ExpoKeepAwake: b0171a73665bfcefcfcc311742a72a956e6aa680 - ExpoLibVlcPlayer: dce3d0b5847838cd5f8c5f3c3aa1bc55c92e911d + ExpoLibVlcPlayer: 027c16c178364a133f6ee10fc7a7d8636f92dbe8 ExpoLinearGradient: 35ebd83b16f80b3add053a2fd68cc328ed927f60 ExpoLinking: 8d12bee174ba0cdf31239706578e29e74a417402 ExpoLocalization: 7776ea3bdb112125390745bbaf919b734b2ad1c7 diff --git a/src/components/home/ContentItem.tsx b/src/components/home/ContentItem.tsx index c82092f..77c2af1 100644 --- a/src/components/home/ContentItem.tsx +++ b/src/components/home/ContentItem.tsx @@ -192,10 +192,14 @@ const ContentItem = ({ item, onPress, shouldLoadImage: shouldLoadImageProp, defe return 'https://via.placeholder.com/154x231/333/666?text=No+Image'; } - // If we've had an error, try metahub fallback - // Use addon poster if available, otherwise use placeholder - if (retryCount > 0 && !item.poster) { - return 'https://via.placeholder.com/300x450/cccccc/666666?text=No+Image'; + // Retry 1: cache-busting query to avoid stale memory artifacts + if (retryCount === 1) { + const bust = item.poster.includes('?') ? `&r=${Date.now()}` : `?r=${Date.now()}`; + return item.poster + bust; + } + // Retry 2+: hard fallback placeholder + if (retryCount >= 2) { + return 'https://via.placeholder.com/154x231/333/666?text=No+Image'; } // For TMDB images, use smaller sizes @@ -268,16 +272,15 @@ const ContentItem = ({ item, onPress, shouldLoadImage: shouldLoadImageProp, defe }} onError={(error) => { if (__DEV__) console.warn('Image load error for:', item.poster, error); - // Try fallback URL on first error - if (retryCount === 0 && item.poster && !item.poster.includes('placeholder')) { - setRetryCount(1); - // Don't set error state yet, let it try the fallback - return; + // Increment retry; 0 -> 1 (cache-bust), 1 -> 2 (placeholder) + setRetryCount((prev) => prev + 1); + // Only show broken state after final retry + if (retryCount >= 1) { + setImageError(true); + setImageLoaded(false); } - setImageError(true); - setImageLoaded(false); }} - recyclingKey={item.id} // Add recycling key for better performance + recyclingKey={`${item.id}-${optimizedPosterUrl}`} // Tie texture reuse to URL to avoid stale reuse placeholder={PLACEHOLDER_BLURHASH} /> ) : ( diff --git a/src/screens/SearchScreen.tsx b/src/screens/SearchScreen.tsx index 6dedac0..95942f5 100644 --- a/src/screens/SearchScreen.tsx +++ b/src/screens/SearchScreen.tsx @@ -736,7 +736,9 @@ const SearchScreen = () => { }); const headerBaseHeight = Platform.OS === 'android' ? 80 : 60; - const topSpacing = Platform.OS === 'android' ? (StatusBar.currentHeight || 0) : insets.top; + // Keep header below floating top navigator on tablets by adding extra offset + const tabletNavOffset = isTablet ? 64 : 0; + const topSpacing = (Platform.OS === 'android' ? (StatusBar.currentHeight || 0) : insets.top) + tabletNavOffset; const headerHeight = headerBaseHeight + topSpacing + 60; // Set up listeners for watched status and library updates diff --git a/src/screens/SettingsScreen.tsx b/src/screens/SettingsScreen.tsx index 8154296..1995e2a 100644 --- a/src/screens/SettingsScreen.tsx +++ b/src/screens/SettingsScreen.tsx @@ -186,12 +186,18 @@ interface SidebarProps { onCategorySelect: (category: string) => void; currentTheme: any; categories: typeof SETTINGS_CATEGORIES; + extraTopPadding?: number; } -const Sidebar: React.FC = ({ selectedCategory, onCategorySelect, currentTheme, categories }) => { +const Sidebar: React.FC = ({ selectedCategory, onCategorySelect, currentTheme, categories, extraTopPadding = 0 }) => { return ( - + Settings @@ -750,7 +756,9 @@ const SettingsScreen: React.FC = () => { }; const headerBaseHeight = Platform.OS === 'android' ? 80 : 60; - const topSpacing = Platform.OS === 'android' ? (StatusBar.currentHeight || 0) : insets.top; + // Keep headers below floating top navigator on tablets by adding extra offset + const tabletNavOffset = isTablet ? 64 : 0; + const topSpacing = (Platform.OS === 'android' ? (StatusBar.currentHeight || 0) : insets.top) + tabletNavOffset; const headerHeight = headerBaseHeight + topSpacing; if (isTablet) { @@ -766,9 +774,15 @@ const SettingsScreen: React.FC = () => { onCategorySelect={setSelectedCategory} currentTheme={currentTheme} categories={visibleCategories} + extraTopPadding={tabletNavOffset} /> - +