From 8453619067d103da10b249c70712b5462d2ed630 Mon Sep 17 00:00:00 2001 From: tapframe Date: Mon, 22 Sep 2025 23:34:15 +0530 Subject: [PATCH] some changes --- .gitignore | 3 +- src/screens/PluginsScreen.tsx | 34 --------- src/screens/ThemeScreen.tsx | 32 ++++++-- src/services/localScraperService.ts | 109 +--------------------------- 4 files changed, 29 insertions(+), 149 deletions(-) diff --git a/.gitignore b/.gitignore index 00eadd274..c3be47b30 100644 --- a/.gitignore +++ b/.gitignore @@ -53,4 +53,5 @@ hackintosh-emulator-fix.sh /ota-builds src/screens/xavio.md /nuvio-providers -/KSPlayer \ No newline at end of file +/KSPlayer +/exobase \ No newline at end of file diff --git a/src/screens/PluginsScreen.tsx b/src/screens/PluginsScreen.tsx index a1f92eb7c..841cd557a 100644 --- a/src/screens/PluginsScreen.tsx +++ b/src/screens/PluginsScreen.tsx @@ -1449,30 +1449,6 @@ const PluginsScreen: React.FC = () => { )} - {/* Add Official Repository Button */} - {!localScraperService.hasTapframeRepository() && ( - { - try { - setIsLoading(true); - const tapframeInfo = localScraperService.getTapframeRepositoryInfo(); - const repoId = await localScraperService.addRepository(tapframeInfo); - await loadRepositories(); - openAlert('Success', 'Official repository added successfully!'); - } catch (error) { - logger.error('[PluginsScreen] Failed to add tapframe repository:', error); - openAlert('Error', 'Failed to add official repository'); - } finally { - setIsLoading(false); - } - }} - disabled={!settings.enableLocalScrapers || isLoading} - > - - Add Official Repository - - )} {/* Add Repository Button */} { numberOfLines={1} /> - {/* Quick Example */} - - setNewRepositoryUrl('https://raw.githubusercontent.com/tapframe/nuvio-providers/refs/heads/main')} - > - - Official - - {/* Format Hint */} diff --git a/src/screens/ThemeScreen.tsx b/src/screens/ThemeScreen.tsx index 7cfacf9ce..d9608d95e 100644 --- a/src/screens/ThemeScreen.tsx +++ b/src/screens/ThemeScreen.tsx @@ -12,6 +12,7 @@ import { StatusBar, FlatList, SafeAreaView, + BackHandler, } from 'react-native'; import { useNavigation } from '@react-navigation/native'; import { NavigationProp } from '@react-navigation/native'; @@ -26,6 +27,8 @@ import CustomAlert from '../components/CustomAlert'; const { width } = Dimensions.get('window'); +const ANDROID_STATUSBAR_HEIGHT = StatusBar.currentHeight || 0; + // Theme categories for organization const THEME_CATEGORIES = [ { id: 'all', name: 'All Themes' }, @@ -316,9 +319,9 @@ const ThemeColorEditor: React.FC { - const { - currentTheme, - availableThemes, + const { + currentTheme, + availableThemes, setCurrentTheme, addCustomTheme, updateCustomTheme, @@ -327,6 +330,11 @@ const ThemeScreen: React.FC = () => { const navigation = useNavigation>(); const insets = useSafeAreaInsets(); const { settings, updateSetting } = useSettings(); + + // Calculate proper header top padding (only needed on Android since iOS uses SafeAreaView) + const headerTopPadding = Platform.OS === 'android' + ? ANDROID_STATUSBAR_HEIGHT + 8 + : 8; const [isEditMode, setIsEditMode] = useState(false); const [editingTheme, setEditingTheme] = useState(null); @@ -443,6 +451,18 @@ const ThemeScreen: React.FC = () => { setEditingTheme(null); }, []); + // Handle system back button when in edit mode + useEffect(() => { + if (isEditMode) { + const backHandler = BackHandler.addEventListener('hardwareBackPress', () => { + handleCancelEdit(); + return true; // Prevent default behavior + }); + + return () => backHandler.remove(); + } + }, [isEditMode, handleCancelEdit]); + // Pass alert state to ThemeColorEditor const ThemeColorEditorWithAlert = (props: any) => { const handleSave = (themeName: string, themeColors: any, onSave: any) => { @@ -514,7 +534,7 @@ const ThemeScreen: React.FC = () => { ]}> - + navigation.goBack()} @@ -624,7 +644,6 @@ const styles = StyleSheet.create({ alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 16, - paddingTop: Platform.OS === 'android' ? StatusBar.currentHeight || 0 + 8 : 8, }, backButton: { flexDirection: 'row', @@ -792,7 +811,8 @@ const styles = StyleSheet.create({ alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: 10, - paddingVertical: 8, + paddingTop: Platform.OS === 'android' ? ANDROID_STATUSBAR_HEIGHT + 8 : 16, + paddingBottom: 8, borderBottomWidth: 1, borderBottomColor: 'rgba(255, 255, 255, 0.1)', }, diff --git a/src/services/localScraperService.ts b/src/services/localScraperService.ts index 729082cc0..0c5cbe43e 100644 --- a/src/services/localScraperService.ts +++ b/src/services/localScraperService.ts @@ -119,25 +119,10 @@ class LocalScraperService { this.currentRepositoryId = 'default'; await this.saveRepositories(); } else { - // Create default tapframe repository for new users - const tapframeRepo: RepositoryInfo = { - id: 'tapframe-nuvio-providers', - name: 'Tapframe\'s Repo', - url: 'https://raw.githubusercontent.com/tapframe/nuvio-providers/refs/heads/main', - description: 'Official Nuvio streaming plugins repository by Tapframe', - isDefault: true, - enabled: true, - lastUpdated: Date.now() - }; - this.repositories.set('tapframe-nuvio-providers', tapframeRepo); - this.currentRepositoryId = 'tapframe-nuvio-providers'; - await this.saveRepositories(); + // No default repository for new users - they must add their own } } - // Ensure tapframe repository is available for all users - await this.ensureTapframeRepository(); - // Load current repository const currentRepoId = await AsyncStorage.getItem('current-repository-id'); if (currentRepoId && this.repositories.has(currentRepoId)) { @@ -252,98 +237,6 @@ class LocalScraperService { } } - /** - * Ensure the tapframe repository is available for all users - */ - public async ensureTapframeRepository(): Promise { - const tapframeRepoId = 'tapframe-nuvio-providers'; - const tapframeRepoUrl = 'https://raw.githubusercontent.com/tapframe/nuvio-providers/refs/heads/main'; - - // Check if tapframe repository already exists - if (this.repositories.has(tapframeRepoId)) { - const existingRepo = this.repositories.get(tapframeRepoId)!; - // Update URL if it changed - if (existingRepo.url !== tapframeRepoUrl) { - existingRepo.url = tapframeRepoUrl; - existingRepo.name = 'Tapframe\'s Repo'; - existingRepo.description = 'Official Nuvio streaming plugins repository by Tapframe'; - await this.saveRepositories(); - } - return; - } - - // Check if any repository with the same URL already exists - for (const [id, repo] of this.repositories) { - if (repo.url === tapframeRepoUrl) { - // If this is already a tapframe repository (by name or description), just update its ID - if (repo.name === 'Tapframe\'s Repo' || repo.description?.includes('Tapframe')) { - repo.id = tapframeRepoId; - repo.name = 'Tapframe\'s Repo'; - repo.description = 'Official Nuvio streaming plugins repository by Tapframe'; - repo.isDefault = true; - this.repositories.delete(id); - this.repositories.set(tapframeRepoId, repo); - await this.saveRepositories(); - return; - } - // If this is a user's repository with the same URL, don't overwrite it - // Just create a new tapframe repository with a different ID - logger.log('[LocalScraperService] User repository with tapframe URL found, creating separate tapframe repository'); - break; - } - } - - // Create new tapframe repository - const tapframeRepo: RepositoryInfo = { - id: tapframeRepoId, - name: 'Tapframe\'s Repo', - url: tapframeRepoUrl, - description: 'Official Nuvio streaming plugins repository by Tapframe', - isDefault: true, - enabled: true, - lastUpdated: Date.now() - }; - - this.repositories.set(tapframeRepoId, tapframeRepo); - await this.saveRepositories(); - } - - /** - * Get the official tapframe repository info - */ - public getTapframeRepositoryInfo(): RepositoryInfo { - return { - id: 'tapframe-nuvio-providers', - name: 'Tapframe\'s Repo', - url: 'https://raw.githubusercontent.com/tapframe/nuvio-providers/refs/heads/main', - description: 'Official Nuvio streaming plugins repository by Tapframe', - isDefault: true, - enabled: true, - lastUpdated: Date.now() - }; - } - - /** - * Check if the tapframe repository is available - */ - public hasTapframeRepository(): boolean { - const tapframeRepoId = 'tapframe-nuvio-providers'; - const tapframeRepoUrl = 'https://raw.githubusercontent.com/tapframe/nuvio-providers/refs/heads/main'; - - // Check if tapframe repository exists by ID - if (this.repositories.has(tapframeRepoId)) { - return true; - } - - // Check if any repository has the tapframe URL - for (const repo of this.repositories.values()) { - if (repo.url === tapframeRepoUrl) { - return true; - } - } - - return false; - } // Set repository URL async setRepositoryUrl(url: string): Promise {