Tracking & Synchronization
ShonenX keeps a user's library synchronized across devices by integrating with major tracking services (AniList, MyAnimeList, Simkl, Kitsu).
Tracker Abstraction
The tracking engine is decoupled from the UI. Features request tracking updates through a unified interface.
BaseTracker: Defines the contract (fetchList,updateProgress,updateScore).RemoteTracker: ExtendsBaseTrackerfor API-based services.- Implementations: Code specific to a service's API quirks (REST vs GraphQL) lives in
lib/features/tracking/engine/trackers/.
Synchronization Engine
The SyncEngine is the critical bridge reconciling remote APIs with the local database.
- Local State: Progress is stored in Isar (
WatchHistoryEntryorReadHistoryEntry). - Trigger: Upon finishing a chapter/episode, the player/reader notifies the
SyncEngine. - Resolution: The
SyncEnginequeries the Matchmaker to translate the source's local ID into the global tracker ID (e.g., AniList ID). - Dispatch: An API request is fired to the active trackers. If the network fails, the request is queued.
Authentication
Tracking services require OAuth 2.0 authentication.
- Flows are handled in
lib/features/auth/utilizingflutter_web_auth_2. - Tokens are persisted to the keystore using
flutter_secure_storage.