All checks were successful
ci/woodpecker/tag/release Pipeline was successful
Add Android foreground service support for downloads to prevent OS process killing during long operations. Fix multiple error handling issues: foreground service leak on exceptions, polling stuck forever on failure, double-counting chapters on retry, silent retry failures without user feedback, and app crash if background service init fails. Replace inaccurate failed chapter count heuristic with actual data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
32 lines
905 B
Dart
32 lines
905 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:worldhopper/app.dart';
|
|
import 'package:worldhopper/services/background_download_service.dart';
|
|
|
|
void main() async {
|
|
// Ensure Flutter bindings are initialized
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
// Set preferred orientations (portrait for now, can be changed later)
|
|
SystemChrome.setPreferredOrientations([
|
|
DeviceOrientation.portraitUp,
|
|
DeviceOrientation.portraitDown,
|
|
DeviceOrientation.landscapeLeft,
|
|
DeviceOrientation.landscapeRight,
|
|
]);
|
|
|
|
// Initialize background download service
|
|
try {
|
|
await initializeBackgroundService();
|
|
} catch (e) {
|
|
debugPrint('Background service initialization failed: $e');
|
|
}
|
|
|
|
// Run the app with Riverpod
|
|
runApp(
|
|
const ProviderScope(
|
|
child: App(),
|
|
),
|
|
);
|
|
}
|