mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-01-11 20:10:25 +00:00
some changes
This commit is contained in:
parent
cdec19db1f
commit
8453619067
4 changed files with 29 additions and 149 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -53,4 +53,5 @@ hackintosh-emulator-fix.sh
|
|||
/ota-builds
|
||||
src/screens/xavio.md
|
||||
/nuvio-providers
|
||||
/KSPlayer
|
||||
/KSPlayer
|
||||
/exobase
|
||||
|
|
@ -1449,30 +1449,6 @@ const PluginsScreen: React.FC = () => {
|
|||
</View>
|
||||
)}
|
||||
|
||||
{/* Add Official Repository Button */}
|
||||
{!localScraperService.hasTapframeRepository() && (
|
||||
<TouchableOpacity
|
||||
style={[styles.defaultRepoButton]}
|
||||
onPress={async () => {
|
||||
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}
|
||||
>
|
||||
<Ionicons name="add-circle" size={16} color={colors.primary} />
|
||||
<Text style={styles.defaultRepoButtonText}>Add Official Repository</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
|
||||
{/* Add Repository Button */}
|
||||
<TouchableOpacity
|
||||
|
|
@ -1894,16 +1870,6 @@ const PluginsScreen: React.FC = () => {
|
|||
numberOfLines={1}
|
||||
/>
|
||||
|
||||
{/* Quick Example */}
|
||||
<View style={styles.compactExamples}>
|
||||
<TouchableOpacity
|
||||
style={styles.quickButton}
|
||||
onPress={() => setNewRepositoryUrl('https://raw.githubusercontent.com/tapframe/nuvio-providers/refs/heads/main')}
|
||||
>
|
||||
<Ionicons name="star" size={14} color={colors.primary} />
|
||||
<Text style={styles.quickButtonText}>Official</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
{/* Format Hint */}
|
||||
<Text style={styles.formatHint}>
|
||||
|
|
|
|||
|
|
@ -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<ThemeColorEditorProps & {
|
|||
};
|
||||
|
||||
const ThemeScreen: React.FC = () => {
|
||||
const {
|
||||
currentTheme,
|
||||
availableThemes,
|
||||
const {
|
||||
currentTheme,
|
||||
availableThemes,
|
||||
setCurrentTheme,
|
||||
addCustomTheme,
|
||||
updateCustomTheme,
|
||||
|
|
@ -327,6 +330,11 @@ const ThemeScreen: React.FC = () => {
|
|||
const navigation = useNavigation<NavigationProp<RootStackParamList>>();
|
||||
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<Theme | null>(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 = () => {
|
|||
]}>
|
||||
<StatusBar barStyle="light-content" />
|
||||
|
||||
<View style={styles.header}>
|
||||
<View style={[styles.header, { paddingTop: headerTopPadding }]}>
|
||||
<TouchableOpacity
|
||||
style={styles.backButton}
|
||||
onPress={() => 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)',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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<void> {
|
||||
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<void> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue