fix(android): treat cancelled exports as terminal; honor server output filename - #620
Open
badbread wants to merge 1 commit into
Open
fix(android): treat cancelled exports as terminal; honor server output filename#620badbread wants to merge 1 commit into
badbread wants to merge 1 commit into
Conversation
…t filename A cancelled export job (server status "cancelled") was never recognized as terminal by ExportJob.isTerminal, so ExportViewModel.startPolling kept polling it forever and the status UI showed a spinner instead of a "Cancelled" state. Add ExportJob.isCancelled and fold it into isTerminal; the poller now stops quietly (no error toast) and the status label shows "Cancelled". ExportOutputFile.filename (the server's real on-disk basename, e.g. .mkv or a whole-job .zip) was never decoded on Android, so saved/shared exports were always named "...mp4" with a hardcoded video/mp4 MIME type regardless of the actual container. Decode filename and derive the extension/MIME type from it at both save sites (Downloads save + cache-then-share), falling back to mp4 only when the server didn't report a filename. Fixes #619 Signed-off-by: badbread <badbread@users.noreply.github.com>
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
Two small, verified bugs in the Android export flow (#619).
1. A cancelled export job polls forever. The server's
DELETE /export/{job_id}setsstatus = "cancelled"and the poller is documented to stop on that one terminal state.ExportJob.isTerminalindata/Models.ktonly checkedisDone || isFailed, soExportViewModel.startPollingnever noticed a cancelled job and kept polling indefinitely, with the UI stuck showing a spinner. Fix: addExportJob.isCancelledand fold it intoisTerminal; the poller now stops without an error toast (cancellation is user-initiated, not a failure), andExportScreen's status label shows "Cancelled".2. Exported files are saved with the wrong extension.
ExportOutputFile.filenameon the server carries the real on-disk basename (.mkvfor a no-transcode passthrough, or a whole-job.zip), but the Android model never decoded that field, and the save/share code hardcoded acrumb-export-<id>....mp4name plus avideo/mp4MIME type regardless of the actual container. An.mkvor.zipexport was saved/shared as.mp4, producing an unplayable/corrupt-looking file. Fix: decodefilename, derive the extension (and matching MIME type for MediaStore / the share intent) from it at both save sites (Downloads save, and cache-then-share), falling back tomp4only when the server didn't report a filename.Files changed
apps/android/app/src/main/java/video/crumb/app/data/Models.kt:ExportOutputFile.filename,ExportJob.isCancelled/isTerminal.apps/android/app/src/main/java/video/crumb/app/feature/export/ExportViewModel.kt: terminal-but-not-failed handling for cancelled jobs.apps/android/app/src/main/java/video/crumb/app/feature/export/ExportScreen.kt: "Cancelled" status label,exportFileExtension/exportMimeTypehelpers used bysaveExportToDownloads,downloadExportFileToCache, andshareLocalFile.Test plan
./gradlew :app:compileDebugKotlin testDebugUnitTestgreen on dev2 (BUILD SUCCESSFUL, exit 0)..mkv-source export and confirm the saved file keeps the.mkvextension.Fixes #619