Overview
There_ucm_app is the main Flutter application that provides a cross-platform user interface for downloading books from various portals. It integrates re_ucm_core and re_ucm_lib to provide a complete book downloading experience.
Version: 2.4.0+14321
Repository: https://github.com/BooksFine/re_ucm
Homepage: https://reucm.pages.dev
Architecture
The application follows a feature-based architecture with clear separation of concerns:Core infrastructure
Dependency injection
The app usesInheritedWidget for dependency injection:
Navigation
The app usesgo_router for declarative routing with support for:
- Deep linking
- Dialog pages
- Modal bottom sheets
- Predictive back gestures
- Custom page transitions
core/navigation/router.dart.
Theming
The app provides both light and dark themes with Material Design 3 styling. Themes are defined incore/ui/theme.dart.
Logging
Structured logging is initialized at app startup:Features
Book detail and download
The book feature (features/book/) handles displaying book information and managing downloads.
BookPageController manages book state with MobX:
book_page.dart- Main book detail screenbook_page_controller.cg.dart- MobX controller for book statewidgets/book_header.dart- Book metadata displaywidgets/book_actions_bar.dart- Download and share actionswidgets/progress_bar.dart- Download progress indicator
Format converters
The app includes converters for transforming book content into various formats. FB2 Converter (features/converters/fb2/converter.dart):
- HTML to FB2 conversion
- HTML entity replacement
- Cover image embedding
- ZIP compression
- Progress reporting
Recent books
Displays recently viewed books with the ability to quickly reopen them.Settings
Provides UI for configuring:- Download path templates
- Save directory
- Portal authentication
- App preferences
Share receiver
Handles incoming share intents from other apps:OTA updates
Manages over-the-air application updates:In-app browser
Provides a WebView for portal authentication flows that require web-based login.Dependencies
Key Flutter packages
flutter_mobx- Reactive state managementgo_router- Declarative routingcached_network_image- Image cachingshimmer- Loading skeletonsloading_animation_widget- Loading indicatorsshare_plus- Share functionalityurl_launcher- Open external URLsfile_picker- File system accesspath_provider- Platform directories
Book processing
xml- XML parsing and generationhtml- HTML parsingsimple_html_css- HTML renderingdio- HTTP client
Platform integration
flutter_inappwebview- WebView componentshare_handler- Share intent receiverpermission_handler- Runtime permissionsota_update_fork- OTA updates
Main application flow
-
App initialization (
main.dart)- Initialize logger
- Set up system UI (edge-to-edge)
- Initialize dependencies (services, portals)
- Set up share handler
- Check for OTA updates
-
Portal registration (
core/di.dart)- Register all available portals with
PortalFactory - Currently includes: Author.Today
- Register all available portals with
-
Service initialization
- Initialize
SettingsServicewith app support directory - Initialize
RecentBooksServicewith app support directory - Initialize
OTAService
- Initialize
-
Routing setup
- Configure routes for all features
- Set up deep linking
- Handle initial route from share intent
-
Theme application
- Apply dark/light theme based on system preference
- Configure Material Design 3 components
Building and running
Code generation
The app uses code generation for:- MobX -
*.cg.dartfiles with_$mixins - JSON serialization -
fromJson/toJsonmethods - Freezed - Immutable data classes
flutter pub run build_runner build after modifying annotated classes.