mirror of
https://github.com/R0m1k3/xtremobile.git
synced 2026-10-11 17:29:26 +02:00
- Consolidate lib/mobile/features/iptv → lib/features/iptv * Move all IPTV screens, models, services, widgets to unified location * Update imports in main.dart and affected files * Remove old mobile/features/iptv directory - Create lib/core/patterns/ for reusable implementations * HiveServiceBase: Template for Hive-based persistent storage * VideoPlayerWrapper: Abstraction for video player selection * StreamResolverPattern: IPTV stream resolution and validation - Router already simplified (no kIsWeb checks, Android-only) All changes maintain Android-only architecture and improve maintainability. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
75 lines
2.3 KiB
Dart
75 lines
2.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:hive_flutter/hive_flutter.dart';
|
|
import 'package:media_kit/media_kit.dart';
|
|
import 'core/theme/app_theme.dart';
|
|
import 'core/providers/theme_provider.dart';
|
|
import 'features/iptv/screens/mobile_playlist_screen.dart';
|
|
import 'features/iptv/screens/mobile_dashboard_screen.dart';
|
|
import 'core/models/playlist_config.dart';
|
|
import 'core/database/hive_service.dart';
|
|
import 'core/utils/startup_profiler.dart';
|
|
|
|
/// Android-optimized entry point for XtremFlow IPTV
|
|
/// No authentication - direct access to playlist selection
|
|
void main() async {
|
|
StartupProfiler.start('app_init');
|
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
StartupProfiler.mark('flutter_binding_init');
|
|
|
|
// Initialize MediaKit (required for video playback)
|
|
MediaKit.ensureInitialized();
|
|
StartupProfiler.mark('media_kit_init');
|
|
|
|
// Initialize Hive (Centralized)
|
|
await HiveService.init();
|
|
StartupProfiler.mark('hive_init');
|
|
|
|
// CLEAR CACHE ON STARTUP (Requested by User)
|
|
try {
|
|
// Clear API/EPG Cache (using default box name 'dio_cache')
|
|
await Hive.deleteBoxFromDisk('dio_cache');
|
|
debugPrint('XtremFlow: API Cache cleared');
|
|
} catch (e) {
|
|
debugPrint('XtremFlow: Failed to clear cache: $e');
|
|
}
|
|
StartupProfiler.mark('cache_clear');
|
|
|
|
await StartupProfiler.reportAll();
|
|
|
|
runApp(const ProviderScope(child: XtremFlowApp()));
|
|
}
|
|
|
|
class XtremFlowApp extends ConsumerWidget {
|
|
const XtremFlowApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final themeState = ref.watch(themeProvider);
|
|
|
|
return MaterialApp(
|
|
title: 'XtremFlow IPTV',
|
|
debugShowCheckedModeBanner: false,
|
|
theme: AppTheme.lightTheme,
|
|
darkTheme: AppTheme.darkTheme,
|
|
themeMode: themeState.themeMode,
|
|
// Start directly at playlist selection (no auth)
|
|
home: const MobilePlaylistScreen(),
|
|
onGenerateRoute: (settings) {
|
|
// Handle navigation to dashboard with playlist
|
|
if (settings.name == '/dashboard') {
|
|
final playlist = settings.arguments as PlaylistConfig?;
|
|
if (playlist != null) {
|
|
return MaterialPageRoute(
|
|
builder: (context) => MobileDashboardScreen(playlist: playlist),
|
|
);
|
|
}
|
|
}
|
|
return null;
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|