Skip to content

fix(downloads): keep progress in sync after a process kill - #5

Merged
Darkmintis merged 2 commits into
mainfrom
fix/download-progress-sync
Nov 9, 2026
Merged

Darkmintis merged 2 commits into
mainfrom
fix/download-progress-sync

Conversation

@Darkmintis

Copy link
Copy Markdown
Owner

Description

Fixes download progress getting stuck after GitStore is killed mid-transfer. The app-owned notification watcher died with the process, so it froze at the last percentage while DownloadManager kept downloading. Reopening Details also showed a fresh Install button instead of the running transfer.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement

Related Issue

N/A

Changes Made

  • Added reconcileActiveDownloads(): on app start, scans DownloadManager for pending/running/paused transfers belonging to GitStore, re-registers them, and restarts their notification watchers.
  • Added observeProgress(fileName): lets Details reattach to a download started in another screen or before a process restart.
  • DetailsViewModel now shows the real progress for an in-progress download on load and updates hasDownloadedApk when it completes.
  • Updated RELEASE_NOTES.md.

Testing

  • Tested on Android device/emulator
  • All existing tests pass
  • Added new tests (if applicable) — N/A

Test Configuration:

  • Android Version: 13 (SDK 33)
  • Device: Samsung SM-M127G

Manual reproduction:

  1. Start an install, leave GitStore, remove it from recents.
  2. Let the transfer pause/resume.
  3. Reopen the app — the notification resumes from the current %, Downloads shows the same %, and repo Details shows the same progress.

Automated:
./gradlew testDebugUnitTest lintDebug assembleRelease
43 tests, 0 failures, 0 lint errors, release APK built

Screenshots

N/A

Checklist

  • My code follows the code style of this project
  • I have performed a self-review of my code
  • I have commented my code where necessary
  • My changes generate no new warnings
  • I have updated the documentation accordingly
  • No lint errors

Additional Notes

  • Root cause: the notifier watcher was process-scoped, so it died with the app; DownloadManager itself kept running.
  • The three surfaces still poll DownloadManager independently at 500 ms, so they can differ by one tick, but they no longer freeze or drift apart.
  • No database migration, new permissions, or dependency changes.
  • v1.4.1 is not tagged yet — merge this before tagging.

The app-owned notification watcher lived only in the process, so killing the
app froze it at the last percentage while DownloadManager kept downloading. On
startup, reconcile pending/running/paused DownloadManager records and restart
the notifier for each, so the notification resumes with the real progress.

Details now reattaches to an in-progress download and renders the same progress
as the Downloads screen and the notification, instead of showing a fresh
Install button for a transfer that is already running.
@Darkmintis
Darkmintis merged commit 861f5b7 into main Nov 9, 2026
2 checks passed
@Darkmintis
Darkmintis deleted the fix/download-progress-sync branch November 9, 2026 09:37
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