Releases: fidesosu/Materialdrain
Releases · fidesosu/Materialdrain
v1.2.0
v1.1.1
feat: Integrate ExoPlayer caching and event logging
This commit introduces caching for media streamed via ExoPlayer and adds event logging for better debugging and analytics.
Key changes:
- **`ExoPlayerCache.kt` (New File):**
- Implemented a singleton `ExoPlayerCache` object to manage a `SimpleCache` instance for ExoPlayer.
- The cache has a maximum size of 100MB and uses a `LeastRecentlyUsedCacheEvictor`.
- It utilizes `StandaloneDatabaseProvider` for the cache index.
- The cache directory is created at `context.cacheDir/media_cache`.
- **`MediaPreviewComposables.kt`:**
- **Video Player (`VideoPlayerDialogContent`):**
- Modified `ExoPlayer` initialization to use the new `ExoPlayerCache`.
- A `CacheDataSource.Factory` is configured to use the `SimpleCache` and `DefaultHttpDataSource` as the upstream factory.
- `ProgressiveMediaSource.Factory` is now used with the `cacheDataSourceFactory` to build media sources.
- An `EventLogger` is added as an analytics listener to the `ExoPlayer` instance to log player events.
- **Dependencies & Imports:**
- Relevant `androidx.media3` imports for caching (`CacheDataSource`, `SimpleCache`, `LeastRecentlyUsedCacheEvictor`, `StandaloneDatabaseProvider`) and `DefaultHttpDataSource` were added.
- Imported `androidx.media3.exoplayer.util.EventLogger`.
v1.1.0
docs: Update README with detailed features and tech stack
This commit significantly expands the README.md to provide a more comprehensive overview of Materialdrain's features and the technologies used.
Key changes:
- **Features Section:**
- **File Uploads:** Detailed enhancements, including comprehensive previews for images, GIFs, videos (with playback), audio (with playback controls), text files, APK icons, and PDF icons. Added mention of metadata display during selection.
- **File Management:** More detail on viewing files (with thumbnails), sorting, filtering, detailed file info, full-screen interactive previews (images, GIFs, videos), text file content previews, download progress, and deletion permissions.
- **User Interface:** Refined descriptions of Material 3 usage, dynamic color, tab navigation, responsive layouts, and dialogs.
- **Settings:** Clarified API key usage for authenticated account access.
- **Tech Stack & Key Libraries Section:**
- Rephrased for better flow and added context.
- Specifically highlighted Ktor Client's features (content negotiation, streaming).
- Emphasized Coil for "optimized" image loading.
- **Setup Section:**
- Minor wording adjustments for clarity (e.g., "current stable version recommended").
- **Future Work Section:**
- Renamed from "Future Work (Potential)" to "Future Work".
- Clarified "Enhance error handling and user feedback mechanisms."
- **General Wording:**
- Improved clarity and flow throughout the document.
- Ensured more descriptive language for existing features.
v1.0.1
Refactor: Enhance Audio Playback and API Key Handling
This commit introduces several improvements to audio playback in the Upload screen and refines API key loading and error handling logic.
**Audio Playback Enhancements (`UploadScreen.kt`):**
- **MediaPlayer Lifecycle & Error Handling:**
- Ensured `mediaPlayer?.release()` is called before creating a new instance to prevent resource leaks.
- Improved error handling in `setOnErrorListener`:
- Sets `isPlaying` to `false`.
- Clears the `mediaPlayer` state variable if the error originated from the current instance.
- In `setOnCompletionListener`:
- Logs playback completion and sets `currentPlaybackTimeMillis` to the audio duration.
- Cleared `mediaPlayer` state and reset `isPlaying` to `false` on errors during `MediaPlayer` setup.
- Ensured `mediaPlayer` is released and state reset when the selected file is not audio or the tab changes.
- Added `mediaPlayer?.release()` in `onDispose` to catch any lingering instances.
- **Playback Time Updates (`LaunchedEffect` for `currentPlaybackTimeMillis`):**
- Refined the loop condition to ensure it breaks correctly if `isPlaying` becomes false, `mediaPlayer` is no longer playing, or the user is scrubbing.
- Added `awaitFrame()` to ensure smooth UI updates and timely checks of loop conditions.
- Catches `IllegalStateException` during `mediaPlayer.currentPosition` access and sets `isPlaying` to false, logging a warning.
- **Seekbar and Play/Pause Logic:**
- When toggling play/pause and the audio is near the end, it now seeks to the beginning (`0L`) and resets `currentPlaybackTimeMillis`.
- **Progress Indicator:**
- `LinearProgressIndicator` now uses a lambda for its `progress` parameter (`progress = { progressValue }`) for proper recomposition.
- The `progress` calculation is now `remember`ed based on relevant state changes (`isUserScrubbing`, `userSeekPositionMillis`, `currentPlaybackTimeMillis`, `totalDuration`).
**API Key and File Fetching Logic (`FileInfoViewModel.kt`):**
- **Initialization & `loadApiKey()`:**
- `loadApiKey()` is now called during `ViewModel` `init`.
- Added extensive logging throughout `loadApiKey` to trace API key status, UI state updates, and conditions for fetching files.
- Refined logic in `loadApiKey()`:
- If the API key is present and previous errors related to a missing key existed, these errors are cleared from the UI state.
- After clearing errors, or if no errors were present, `fetchUserFiles()` is called if the user file list is empty and no fetch is currently in progress. This ensures files are loaded on startup if an API key is present.
- **`fetchUserFiles()`:**
- Added logging for fetch attempts and results (success with file count, or error messages).
**General Changes:**
- **`MaterialDrainScreen.kt`:**
- Removed the explicit `fileInfoViewModel.loadApiKey()` call from `LaunchedEffect(Unit)` as the `ViewModel`'s `init` block now handles this initial load.
- Removed a redundant `fileInfoViewModel.loadApiKey()` call when navigating to the `Screen.Files`.
- **`app/build.gradle.kts`:**
- Added `signingConfig = signingConfigs.getByName("debug")` to the release build type. This is likely a placeholder or for specific debug-related release builds and might need review for actual release configurations.
v1.0.0
Full Changelog: https://github.com/fidesosu/Materialdrain/commits/release