From bbbc22f30f8bafa556a71c1f5058de407408b179 Mon Sep 17 00:00:00 2001 From: tapframe Date: Tue, 30 Sep 2025 01:39:00 +0530 Subject: [PATCH] Pluginscreen UI changes --- src/hooks/useSettings.ts | 4 ++++ src/navigation/AppNavigator.tsx | 25 ++++++++++++--------- src/screens/PluginsScreen.tsx | 39 +++++++++++++++++++++------------ src/screens/SettingsScreen.tsx | 28 +++++++++++++++++++++++ src/screens/StreamsScreen.tsx | 26 ++++++++++++---------- 5 files changed, 87 insertions(+), 35 deletions(-) diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.ts index 524f60e..00cd796 100644 --- a/src/hooks/useSettings.ts +++ b/src/hooks/useSettings.ts @@ -57,6 +57,8 @@ export interface AppSettings { excludedQualities: string[]; // Array of quality strings to exclude (e.g., ['2160p', '4K', '1080p', '720p']) // Playback behavior alwaysResume: boolean; // If true, resume automatically without prompt when progress < 85% + // Downloads + enableDownloads: boolean; // Show Downloads tab and enable saving streams // Theme settings themeId: string; customThemes: CustomThemeDef[]; @@ -105,6 +107,8 @@ export const DEFAULT_SETTINGS: AppSettings = { excludedQualities: [], // No qualities excluded by default // Playback behavior defaults alwaysResume: true, + // Downloads + enableDownloads: false, // Theme defaults themeId: 'default', customThemes: [], diff --git a/src/navigation/AppNavigator.tsx b/src/navigation/AppNavigator.tsx index 3823110..2592477 100644 --- a/src/navigation/AppNavigator.tsx +++ b/src/navigation/AppNavigator.tsx @@ -458,6 +458,9 @@ const WrappedScreen: React.FC<{Screen: React.ComponentType}> = ({ Screen }) // Tab Navigator const MainTabs = () => { const { currentTheme } = useTheme(); + const { settings } = require('../hooks/useSettings'); + const { useSettings: useSettingsHook } = require('../hooks/useSettings'); + const { settings: appSettings } = useSettingsHook(); const [hasUpdateBadge, setHasUpdateBadge] = React.useState(false); React.useEffect(() => { if (Platform.OS !== 'android') return; @@ -829,16 +832,18 @@ const MainTabs = () => { ), }} /> - ( - - ), - }} - /> + {appSettings?.enableDownloads !== false && ( + ( + + ), + }} + /> + )} StyleSheet.create({ container: { flex: 1, - backgroundColor: colors.background, + backgroundColor: colors.darkBackground, }, header: { flexDirection: 'row', @@ -63,7 +63,7 @@ const createStyles = (colors: any) => StyleSheet.create({ headerTitle: { fontSize: 34, fontWeight: 'bold', - color: colors.white, + color: colors.text, paddingHorizontal: 16, marginBottom: 24, }, @@ -71,7 +71,7 @@ const createStyles = (colors: any) => StyleSheet.create({ flex: 1, }, section: { - backgroundColor: colors.darkBackground, + backgroundColor: colors.elevation1, marginBottom: 16, borderRadius: 12, padding: 16, @@ -852,6 +852,7 @@ const PluginsScreen: React.FC = () => { const [showboxUiToken, setShowboxUiToken] = useState(''); const [showboxSavedToken, setShowboxSavedToken] = useState(''); const [showboxScraperId, setShowboxScraperId] = useState(null); + const [showboxTokenVisible, setShowboxTokenVisible] = useState(false); // Multiple repositories state const [repositories, setRepositories] = useState([]); @@ -1084,10 +1085,12 @@ const PluginsScreen: React.FC = () => { const s = await localScraperService.getScraperSettings(sb.id); setShowboxUiToken(s.uiToken || ''); setShowboxSavedToken(s.uiToken || ''); + setShowboxTokenVisible(false); } else { setShowboxScraperId(null); setShowboxUiToken(''); setShowboxSavedToken(''); + setShowboxTokenVisible(false); } } catch (error) { logger.error('[ScraperSettings] Failed to load scrapers:', error); @@ -1630,17 +1633,25 @@ const PluginsScreen: React.FC = () => { {showboxScraperId && scraper.id === showboxScraperId && settings.enableLocalScrapers && ( ShowBox UI Token - + + 0 && !showboxTokenVisible} + multiline={false} + numberOfLines={1} + /> + {showboxSavedToken.length > 0 && ( + setShowboxTokenVisible(v => !v)} accessibilityRole="button" accessibilityLabel={showboxTokenVisible ? 'Hide token' : 'Show token'} style={{ marginLeft: 10 }}> + + + )} + {showboxUiToken !== showboxSavedToken && ( { // Tablet-specific state const [selectedCategory, setSelectedCategory] = useState('account'); + const [downloadsDevUnlocked, setDownloadsDevUnlocked] = useState(false); + const [versionTapCount, setVersionTapCount] = useState(0); // States for dynamic content const [addonCount, setAddonCount] = useState(0); @@ -613,6 +615,22 @@ const SettingsScreen: React.FC = () => { )} isTablet={isTablet} /> + {downloadsDevUnlocked && ( + ( + updateSetting('enableDownloads', value)} + trackColor={{ false: 'rgba(255,255,255,0.2)', true: currentTheme.colors.primary }} + thumbColor={settings?.enableDownloads ? '#fff' : '#f4f3f4'} + /> + )} + isTablet={isTablet} + /> + )} { title="Version" description={getDisplayedAppVersion()} icon="info-outline" + onPress={() => { + if (downloadsDevUnlocked) return; + const next = versionTapCount + 1; + setVersionTapCount(next); + if (next >= 5) { + setDownloadsDevUnlocked(true); + setVersionTapCount(0); + openAlert('Developer option unlocked', 'Downloads toggle is now visible in Playback settings.'); + } + }} isLast={true} isTablet={isTablet} /> diff --git a/src/screens/StreamsScreen.tsx b/src/screens/StreamsScreen.tsx index 9758e71..550db7b 100644 --- a/src/screens/StreamsScreen.tsx +++ b/src/screens/StreamsScreen.tsx @@ -221,6 +221,8 @@ const StreamCard = memo(({ stream, onPress, index, isLoading, statusMessage, the parentPosterUrl?: string | null; providerName?: string; }) => { + const { useSettings } = require('../hooks/useSettings'); + const { settings } = useSettings(); const { startDownload } = useDownloads(); // Handle long press to copy stream URL to clipboard @@ -398,17 +400,19 @@ const StreamCard = memo(({ stream, onPress, index, isLoading, statusMessage, the color={theme.colors.white} /> - - - + {settings?.enableDownloads !== false && ( + + + + )} ); });