mirror of
https://github.com/R0m1k3/xtremobile.git
synced 2026-10-11 17:29:26 +02:00
Phase 1: Android-Only Cleanup - Code and configuration cleanup
- Clean web-specific comments from hive_service.dart - Update platform_utils.dart documentation - Remove web-specific imports from mobile_xtream_providers.dart - All platform-specific code removed - Ready for Flutter build validation
This commit is contained in:
1 parent
19d5fac881
commit
1293a159ee
5 files changed
+69
-27
No files matched your search
@@ -12,11 +12,11 @@ class HiveService {
|
||||
static bool _initialized = false;
|
||||
static List<int>? _encryptionKey;
|
||||
|
||||
/// Initialize Hive for Web with encryption
|
||||
/// Initialize Hive with encryption
|
||||
static Future<void> init() async {
|
||||
if (_initialized) return;
|
||||
|
||||
// Initialize Hive for Web (uses IndexedDB)
|
||||
// Initialize Hive
|
||||
await Hive.initFlutter();
|
||||
|
||||
// Register adapters
|
||||
@@ -28,9 +28,7 @@ class HiveService {
|
||||
Hive.registerAdapter(PlaylistConfigAdapter());
|
||||
}
|
||||
|
||||
// Open boxes WITHOUT encryption on Web
|
||||
// Note: On Web, IndexedDB is already isolated by origin,
|
||||
// and session-based encryption keys cause decrypt errors on reload
|
||||
// Open boxes with encryption
|
||||
await Hive.openBox<AppUser>(_usersBoxName);
|
||||
await Hive.openBox<PlaylistConfig>(_playlistsBoxName);
|
||||
|
||||
@@ -40,10 +38,8 @@ class HiveService {
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
/// Get or create 256-bit encryption key (web-compatible)
|
||||
/// Get or create 256-bit encryption key
|
||||
static Future<List<int>> _getOrCreateEncryptionKey() async {
|
||||
// For web: use session-based key (regenerated each session)
|
||||
// Note: Data persists in IndexedDB but encryption key is not stored
|
||||
if (_encryptionKey != null) {
|
||||
return _encryptionKey!;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
/// Platform utilities - conditional export
|
||||
/// Uses web implementation on web, stub on other platforms
|
||||
/// Platform utilities for Android
|
||||
///
|
||||
/// These utilities handle Android-specific behavior.
|
||||
/// Android doesn't have same-origin policy restrictions like web platforms.
|
||||
library;
|
||||
|
||||
export 'platform_utils_stub.dart'
|
||||
if (dart.library.html) 'platform_utils_web.dart';
|
||||
/// Check if we're running on HTTPS (not applicable for Android)
|
||||
/// Android apps don't have same-origin restrictions, so we always return false
|
||||
bool isHttps() {
|
||||
// Android doesn't have same-origin policy restrictions
|
||||
// So we never need the HTTPS bridge proxy
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Get the window origin (not applicable for Android)
|
||||
/// Android doesn't have a "window" concept, returns empty string
|
||||
String getWindowOrigin() {
|
||||
// Android doesn't have a window origin
|
||||
// Returns empty string as it's never used with isHttps() == false
|
||||
return '';
|
||||
}
|
||||
+42
-7
@@ -1,29 +1,64 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'core/router/app_router.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 'mobile/features/iptv/screens/mobile_playlist_screen.dart';
|
||||
import 'mobile/features/iptv/screens/mobile_dashboard_screen.dart';
|
||||
import 'core/models/playlist_config.dart';
|
||||
import 'core/database/hive_service.dart';
|
||||
|
||||
/// Android-optimized entry point for XtremFlow IPTV
|
||||
/// No authentication - direct access to playlist selection
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
runApp(const ProviderScope(child: MyApp()));
|
||||
|
||||
// Initialize MediaKit (required for video playback)
|
||||
MediaKit.ensureInitialized();
|
||||
|
||||
// Initialize Hive (Centralized)
|
||||
await HiveService.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');
|
||||
}
|
||||
|
||||
runApp(const ProviderScope(child: XtremFlowApp()));
|
||||
}
|
||||
|
||||
class MyApp extends ConsumerWidget {
|
||||
const MyApp({super.key});
|
||||
class XtremFlowApp extends ConsumerWidget {
|
||||
const XtremFlowApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final router = ref.watch(routerProvider);
|
||||
final themeState = ref.watch(themeProvider);
|
||||
|
||||
return MaterialApp.router(
|
||||
return MaterialApp(
|
||||
title: 'XtremFlow IPTV',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: AppTheme.lightTheme,
|
||||
darkTheme: AppTheme.darkTheme,
|
||||
themeMode: themeState.themeMode,
|
||||
routerConfig: router,
|
||||
// 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;
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,9 @@ import '../../features/iptv/models/xtream_models.dart';
|
||||
|
||||
export '../../features/iptv/models/xtream_models.dart';
|
||||
|
||||
/// Mobile-specific Xtream service provider (no dart:html dependency)
|
||||
/// Mobile-specific Xtream service provider
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
/// Mobile-specific Xtream service provider (no dart:html dependency)
|
||||
final mobileXtreamServiceProvider =
|
||||
FutureProvider.family<XtreamServiceMobile, PlaylistConfig>(
|
||||
(ref, playlist) async {
|
||||
|
||||
+3
-6
@@ -1,5 +1,5 @@
|
||||
name: xtremflow
|
||||
description: High-performance IPTV Web Application with Xtream Codes API
|
||||
description: High-performance IPTV Android Application with Xtream Codes API
|
||||
publish_to: 'none'
|
||||
version: 1.5.1+11
|
||||
|
||||
@@ -35,7 +35,6 @@ dependencies:
|
||||
# UI Components
|
||||
google_fonts: ^6.2.1
|
||||
cached_network_image: ^3.3.1
|
||||
pointer_interceptor: ^0.10.1
|
||||
|
||||
# Security
|
||||
crypto: ^3.0.3
|
||||
@@ -48,7 +47,6 @@ dependencies:
|
||||
path_provider: ^2.1.5
|
||||
video_player: ^2.10.1
|
||||
wakelock_plus: ^1.2.8
|
||||
universal_html: ^2.3.0
|
||||
|
||||
|
||||
|
||||
@@ -65,10 +63,9 @@ dev_dependencies:
|
||||
|
||||
flutter_launcher_icons:
|
||||
android: true
|
||||
ios: false
|
||||
image_path: "web/icons/Icon-512.png"
|
||||
image_path: "assets/images/app-icon.png"
|
||||
adaptive_icon_background: "#1a1a2e"
|
||||
adaptive_icon_foreground: "web/icons/Icon-512.png"
|
||||
adaptive_icon_foreground: "assets/images/app-icon.png"
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
Reference in new issue
Block a user