Add live upload status tracking to recorder screen - #3
Merged
Conversation
The status line under a saved recording was derived from build config only, so it said "Queued for upload" from the moment the recording was saved until the app restarted — even after the upload had finished or failed. The upload job's real state already lives in WorkManager, so observe it instead of describing intent: - UploadWorker reports why an attempt failed (progress data between retries, output data when it gives up) and flags uploads skipped for lack of credentials. - UploadStatusRepository exposes that job as a Flow, mapped by the pure, unit-tested uploadStatusOf() onto queued / uploading / retrying (with attempt count) / uploaded / kept-on-device / failed. - RecorderScreen renders it with a matching icon, a spinner while uploading, and the failure reason in the error color. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AQtNehwfpS6kw5PqKyRMnj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds live upload status tracking to the recorder screen, allowing users to see real-time progress of their recording uploads (queued → uploading → uploaded/failed) instead of only seeing the initial intent at save time.
Key Changes
New upload status model (
UploadStatus.kt): IntroducedUploadStageenum andUploadStatusdata class to represent the lifecycle of an upload job, along withuploadStatusOf()function to map WorkManager states to UI-friendly status.Upload status repository (
UploadStatusRepository.kt): Created repository to observe WorkManager job state for a specific recording file, convertingWorkInfotoUploadStatusand exposing it as a Flow.Enhanced UploadWorker: Modified to report error messages and "kept local" status through WorkManager's output/progress data, enabling the UI to display failure reasons and retry attempts.
UploadScheduler refactoring: Extracted
uniqueWorkName()function to centralize the naming scheme for upload jobs, making it reusable by the status repository.RecorderViewModel integration: Added
uploadStatusStateFlow that tracks the last saved recording's upload job, automatically switching to null when a new recording is saved.UI component (
UploadStatusRow): New composable that displays upload status with appropriate icons (cloud queue, upload, sync, done, off, error) and colors, including a progress indicator during active uploads. Shows contextual messages for queued, uploading, retrying, uploaded, kept local, and failed states.String resources: Added new localized strings for all upload states and failure scenarios.
Notable Implementation Details
getWorkInfosForUniqueWorkFlow()to observe job state changes across process death, ensuring status persists even if the app is killed.runAttemptCount.https://claude.ai/code/session_01AQtNehwfpS6kw5PqKyRMnj