From 22a118c3830506bfabfff33517b7ab4a64ef2662 Mon Sep 17 00:00:00 2001 From: tapframe Date: Mon, 15 Sep 2025 14:09:26 +0530 Subject: [PATCH] subtitle fix --- local-scrapers-repo | 2 +- src/components/player/AndroidVideoPlayer.tsx | 26 +++++++++++--- src/components/player/VideoPlayer.tsx | 26 +++++++++++--- src/screens/PluginsScreen.tsx | 37 +------------------- 4 files changed, 46 insertions(+), 45 deletions(-) diff --git a/local-scrapers-repo b/local-scrapers-repo index e6c0e8c..c2435eb 160000 --- a/local-scrapers-repo +++ b/local-scrapers-repo @@ -1 +1 @@ -Subproject commit e6c0e8c0d75a8595031fe450e29db0c40969b5b8 +Subproject commit c2435eb4a7467fc13eb232526ab6fea867062c22 diff --git a/src/components/player/AndroidVideoPlayer.tsx b/src/components/player/AndroidVideoPlayer.tsx index 0c5b1e6..03d6e51 100644 --- a/src/components/player/AndroidVideoPlayer.tsx +++ b/src/components/player/AndroidVideoPlayer.tsx @@ -1553,9 +1553,24 @@ const AndroidVideoPlayer: React.FC = () => { const loadSubtitleSize = async () => { try { - const savedSize = await AsyncStorage.getItem(SUBTITLE_SIZE_KEY); - if (savedSize) { - setSubtitleSize(parseInt(savedSize, 10)); + // Prefer scoped subtitle settings + const saved = await storageService.getSubtitleSettings(); + if (saved && typeof saved.subtitleSize === 'number') { + setSubtitleSize(saved.subtitleSize); + return; + } + // One-time migrate legacy key if present + const legacy = await AsyncStorage.getItem(SUBTITLE_SIZE_KEY); + if (legacy) { + const migrated = parseInt(legacy, 10); + if (!Number.isNaN(migrated) && migrated > 0) { + setSubtitleSize(migrated); + try { + const merged = { ...(saved || {}), subtitleSize: migrated }; + await storageService.saveSubtitleSettings(merged); + } catch {} + } + try { await AsyncStorage.removeItem(SUBTITLE_SIZE_KEY); } catch {} } } catch (error) { logger.error('[AndroidVideoPlayer] Error loading subtitle size:', error); @@ -1564,8 +1579,11 @@ const AndroidVideoPlayer: React.FC = () => { const saveSubtitleSize = async (size: number) => { try { - await AsyncStorage.setItem(SUBTITLE_SIZE_KEY, size.toString()); setSubtitleSize(size); + // Persist via scoped subtitle settings so it survives restarts and account switches + const saved = await storageService.getSubtitleSettings(); + const next = { ...(saved || {}), subtitleSize: size }; + await storageService.saveSubtitleSettings(next); } catch (error) { logger.error('[AndroidVideoPlayer] Error saving subtitle size:', error); } diff --git a/src/components/player/VideoPlayer.tsx b/src/components/player/VideoPlayer.tsx index 06063e0..b2d0037 100644 --- a/src/components/player/VideoPlayer.tsx +++ b/src/components/player/VideoPlayer.tsx @@ -1288,9 +1288,24 @@ const VideoPlayer: React.FC = () => { const loadSubtitleSize = async () => { try { - const savedSize = await AsyncStorage.getItem(SUBTITLE_SIZE_KEY); - if (savedSize) { - setSubtitleSize(parseInt(savedSize, 10)); + // Prefer scoped subtitle settings + const saved = await storageService.getSubtitleSettings(); + if (saved && typeof saved.subtitleSize === 'number') { + setSubtitleSize(saved.subtitleSize); + return; + } + // One-time migrate legacy key if present + const legacy = await AsyncStorage.getItem(SUBTITLE_SIZE_KEY); + if (legacy) { + const migrated = parseInt(legacy, 10); + if (!Number.isNaN(migrated) && migrated > 0) { + setSubtitleSize(migrated); + try { + const merged = { ...(saved || {}), subtitleSize: migrated }; + await storageService.saveSubtitleSettings(merged); + } catch {} + } + try { await AsyncStorage.removeItem(SUBTITLE_SIZE_KEY); } catch {} } } catch (error) { logger.error('[VideoPlayer] Error loading subtitle size:', error); @@ -1299,8 +1314,11 @@ const VideoPlayer: React.FC = () => { const saveSubtitleSize = async (size: number) => { try { - await AsyncStorage.setItem(SUBTITLE_SIZE_KEY, size.toString()); setSubtitleSize(size); + // Persist via scoped subtitle settings so it survives restarts and account switches + const saved = await storageService.getSubtitleSettings(); + const next = { ...(saved || {}), subtitleSize: size }; + await storageService.saveSubtitleSettings(next); } catch (error) { logger.error('[VideoPlayer] Error saving subtitle size:', error); } diff --git a/src/screens/PluginsScreen.tsx b/src/screens/PluginsScreen.tsx index fa814fb..f786386 100644 --- a/src/screens/PluginsScreen.tsx +++ b/src/screens/PluginsScreen.tsx @@ -1186,42 +1186,7 @@ const PluginsScreen: React.FC = () => { } > - {/* Quick Setup for New Users */} - {!hasRepository && ( - - 🚀 Quick Start with Official Plugins - - Get instant access to 9+ premium streaming scrapers from Tapframe's official repository. Enable local scrapers and start streaming movies and TV shows immediately. - - { - try { - setIsLoading(true); - // Add the official tapframe repository - const tapframeInfo = localScraperService.getTapframeRepositoryInfo(); - const repoId = await localScraperService.addRepository(tapframeInfo); - - // Switch to the new repository and refresh it - await localScraperService.setCurrentRepository(repoId); - await loadRepositories(); - await loadScrapers(); - - Alert.alert('Success', 'Official repository added! Enable local scrapers above to start using plugins.'); - } catch (error) { - logger.error('[PluginsScreen] Failed to add tapframe repository:', error); - Alert.alert('Error', 'Failed to add official repository'); - } finally { - setIsLoading(false); - } - }} - > - - {isLoading ? 'Adding Repository...' : 'Add Official Repository'} - - - - )} + {/* Quick Setup banner removed */} {/* Enable Local Scrapers */}