21 lines
3.7 KiB
Markdown
21 lines
3.7 KiB
Markdown
# Architecture
|
|
|
|
The application has one Android app module and no backend service.
|
|
|
|
- `MainActivity` renders Compose, collects lifecycle-aware state and coordinates overlay focus restoration.
|
|
- `AppViewModel` owns feed pagination/cache, cancellable detail/playback requests, visible-screen QR polling and serialized account transitions.
|
|
- `AuthRepository` uses the official web QR flow with an isolated in-memory attempt. Only a verified active attempt can atomically replace the durable account session.
|
|
- `BiliHttpClient` validates official HTTPS API destinations, scopes cookies per network hop, bounds response sizes and propagates coroutine cancellation to OkHttp calls.
|
|
- `SessionStore` encrypts cookies with an Android Keystore AES-GCM key and writes an atomic file in `noBackupFilesDir`.
|
|
- `ContentRepository` retrieves official catalogue/details/playback responses; `WbiSigner` caches official signing material; pure `ContentJson` parsing separates format and entitlement checks from transport.
|
|
- `SearchRepository` uses official category search and the shared first-party session; pure `SearchJson` parses highlights, content identifiers, rights badges and bounded pagination. `SearchController` owns draft/submitted queries, category, deduplicated pages and cancellable requests. A generation guard also rejects non-cooperative late responses after a new query, category, clear, close or logout. It keeps no durable history.
|
|
- `FavoriteRepository` reads official account folders, archive memberships and paginated resources, and submits explicit membership diffs. Account-bound requests capture a cookie epoch, require matching UID/SESSDATA and API-scoped CSRF for writes, and disable redirects and connection retries. `FavoriteJson` validates membership completeness and filters invalid or unsupported resources.
|
|
- `FavoriteLibraryController` owns the selected folder and deduplicated pagination. `FavoriteActionController` separates the player's draft selections from confirmed server membership; only Save writes. Both cancel and reject late results after account/folder/video changes. Uncertain writes require an authoritative reload before retry. Logout clears the library; it has no durable cache.
|
|
- `BulubuluHome`, dialogs and `TvAction` own TV layout/focus. Home stays composed beneath overlays, with focus/clicks disabled while inactive.
|
|
- `SearchScreen` uses the device IME and the existing card components. It stays composed beneath details/player and restores result focus independently of Home.
|
|
- `PlayerScreen` creates and releases Media3 with the composable lifecycle, merges separate AVC/AAC tracks and handles D-pad/media keys. CDN requests never receive account cookies.
|
|
- `PlaybackQualitySwitcher` owns manual quality changes and commits the selected label only when the replacement source is ready. It preserves position/play intent, rejects overlapping requests and attempts the original source once after failure. `playbackMediaSource` shares HTTP identity, backup CDN handling and track merging between initial playback and changes. `QualityDialog` scrolls to and focuses the current actual track; one ExoPlayer is retained throughout the screen lifecycle.
|
|
- `FavoriteDialog` provides multiple folder choices and explicit Save/Close actions. `PlayerScreen` restores its favorite action after the dialog regains the parent window's focus; opening or saving favorites does not recreate the player or media source.
|
|
|
|
There is no analytics, self-update service, local media scanning or private server. Login credentials and signed playback URLs must never appear in application logs or raw error messages. Account entitlements and region/DRM restrictions remain server-controlled. Tests use fake sessions in isolated storage and do not require a real account.
|