Skip to content

Abs offline support#86

Merged
MakD merged 5 commits intomasterfrom
abs-offline
Apr 8, 2026
Merged

Abs offline support#86
MakD merged 5 commits intomasterfrom
abs-offline

Conversation

@MakD
Copy link
Copy Markdown
Owner

@MakD MakD commented Apr 8, 2026

No description provided.

MakD added 5 commits April 6, 2026 19:08
…onization

This commit introduces a comprehensive download system for Audiobookshelf, allowing users to download audiobooks and podcast episodes for offline playback. It also adds a background synchronization mechanism to ensure progress made while offline is synced back to the server when a connection is re-established.

### Key Changes:

*   **Offline Download System**:
    *   **Data Layer**: Added `AbsDownloadDao` and `AbsDownloadEntity` to track download status, progress, and local file paths.
    *   **Repository**: Implemented `AbsDownloadRepository` to manage the lifecycle of downloads (start, cancel, delete) and storage calculation.
    *   **Worker**: Introduced `AbsMediaDownloadWorker` to handle multi-track file downloads, cover art caching, and local playback session generation using `WorkManager`.
    *   **UI**: Added download actions to the `AudiobookshelfItemScreen` and integrated Audiobookshelf items into the `DownloadSettingsScreen`.

*   **Progress Synchronization**:
    *   **Background Sync**: Added `AbsProgressSyncWorker` and `AbsProgressSyncScheduler` to batch-sync local playback progress to the server using the new `syncAllLocalSessions` API endpoint.
    *   **Offline Playback**: Updated `AudiobookshelfPlayer` and `AudiobookshelfProgressSyncer` to identify local sessions (prefixed with `local_`) and save progress to the local database when offline.

*   **UI/UX Enhancements**:
    *   **Home Screen**: Introduced `DownloadedAudiobooksSection` and `DownloadedPodcastEpisodes` sections that appear specifically when the app is in offline mode.
    *   **Item Details**: Updated `AudiobookshelfItemScreen` to show download status indicators and allow filtering episodes by download status when offline.
    *   **Player Integration**: Refactored `AudiobookshelfPlaybackManager` to support loading cover art from local file URIs for downloaded content.

*   **Database & Infrastructure**:
    *   **Migrations**: Added migrations 36 through 39 to support the `abs_downloads` table and additional metadata columns in `audiobookshelf_items`.
    *   **API Service**: Updated `AudiobookshelfApiService` with endpoints for batch session syncing and improved progress update handling.
    *   **Dependency Injection**: Updated `AudiobookshelfModule` to provide new DAOs and Repositories.
This commit introduces restrictions to the settings and server management screens when the application is in offline mode. By monitoring the offline state, the UI now prevents users from modifying server configurations or switching sessions when a connection is unavailable.

### Key Changes:

*   **Settings Screen**:
    *   **`SettingsScreen.kt`**: Disabled the Jellyseerr and Audiobookshelf integration switches when `effectiveOfflineMode` is active.
    *   **Session Switching**: The "Switch Session" item is now non-clickable when the device is offline.

*   **Server Management**:
    *   **`ServerManagementViewModel.kt`**: Integrated `OfflineModeManager` to expose an `isOffline` StateFlow, allowing the UI to react to connectivity changes.
    *   **`ServerManagementScreen.kt`**: Updated the "Add Server" Floating Action Button (FAB) to be visually disabled and non-functional when offline, using dimmed colors and conditional click logic.
This commit updates several core dependencies and build tools to their latest versions to ensure compatibility and leverage performance improvements.

### Key Changes:

*   **Android Compose & Lifecycle**:
    *   Updated `activityCompose` to `1.13.0` and `composeBom` to `2026.03.01`.
    *   Updated `ui` to `1.10.6`.
*   **Media3**:
    *   Bumped `media3` and its components (`media3ExoplayerHls`, `media3Session`) from `1.9.2` to `1.10.0`.
*   **Data & Storage**:
    *   Updated `datastore` to `1.2.1`.
    *   Updated `paging` to `3.4.2`.
*   **Architecture & Infrastructure**:
    *   Updated `work` (WorkManager) to `2.11.2`.
    *   Updated `tinkAndroid` to `1.21.0`.
    *   Updated `playServicesCastFramework` to `22.3.1`.
*   **Tooling & Libraries**:
    *   Updated `ktfmt` to `0.26.0`.
    *   Updated `aboutlibrariesCore` to `14.0.0-b03`.
    *   Updated `composePagerIndicator` to `0.0.9`.
This commit introduces a new "Spotlight" feature to the home screen, featuring a high-visibility carousel for top-rated movies and series categorized by genre and studio. It also optimizes the home screen's data loading architecture to better handle concurrent resource fetching.

### Key Changes:

*   **Spotlight UI Components**:
    *   **`SpotlightCarousel.kt`**: Created a new carousel component using `HorizontalMultiBrowseCarousel`. It features large backdrop imagery, gradient overlays, and dynamic support for media logos or text titles.
    *   **Interactive Elements**: Added IMDb and Rotten Tomatoes rating indicators and a direct "Play" action button on each spotlight card.
    *   **Responsive Layout**: Implemented orientation-aware sizing, adjusting card width and height for optimal display on both portrait and landscape devices.

*   **Home Screen Integration**:
    *   **`HomeViewModel.kt`**: Added logic to fetch and interleave "Spotlight" sections (e.g., "Top Action Movies", "Best of Marvel Studios") into the home feed.
    *   **Positioning Logic**: Introduced `computeSpotlightPositions` to intelligently distribute spotlight carousels throughout the home feed rather than clustering them.
    *   **State Management**: Updated the `HomeSection` sealed class to include a `Spotlight` type and implemented deduplication logic to ensure items don't repeat across multiple carousels.

*   **Data & Repository**:
    *   **`MediaRepository.kt`**: Added new interface methods `getTopRatedByGenre` and `getTopRatedByStudio`.
    *   **`JellyfinMediaRepository.kt`**: Implemented the new repository methods, querying the Jellyfin API for items filtered by genre or studio, sorted by community rating, and ensuring backdrop images are pre-fetched.

*   **Performance & Lifecycle**:
    *   **Parallel Initialization**: Refactored `HomeViewModel` to use `coroutineScope` and `awaitAll` when loading studios, genres, and spotlights, significantly improving initial load times.
    *   **Session Resilience**: Enhanced the cleanup logic to reset spotlight-specific states when switching users or clearing data.
    *   **Code Quality**: Performed a general cleanup of indentation and formatting across `HomeScreen.kt` and `HomeViewModel.kt`.
…terial theme

This commit updates the base application theme to use the native Android Material light theme instead of the MaterialComponents library.

### Key Changes:

*   **`themes.xml`**:
    *   Changed the parent theme of `Theme.AFinity` from `Theme.MaterialComponents.Light.NoActionBar` to `android:Theme.Material.Light.NoActionBar`.
    *   Updated the `colorPrimary` attribute to use the `android:` namespace.
    *   Removed the `colorBackgroundFloating` item.
@MakD MakD merged commit a4979c9 into master Apr 8, 2026
1 check passed
@MakD MakD deleted the abs-offline branch April 8, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant