Repository navigation
ADFA-4893 — ZIM download: pause/resume + cancel on the status screen - #472
Merged
Merged
Conversation
App-side wiring of the engine's existing pause/resume for the ZIM stream: RestContentClient (pause/resume + 'paused' poll + onPaused default), ZimDownloadService (session pause; the sequential queue holds while paused), ZimPreparingFragment (Pause/Resume + Cancel row on the status screen). Reuses ADFA-5119 strings. Server side already supports it (kiwix, 4894).
Hide the on-screen control row when the box's dash-node predates ADFA-4894 (no pause/resume endpoints), via DashboardVersion.atLeast(...,1,2,4). Old boxes fall back to the notification Cancel instead of showing a Pause that 404s. atLeast() is false for unknown/older versions, so the default is safe.
Extend the ADFA-5228 row bar (proot maps/module rows) to the REST streams: the ZIM row in SetupProgressActivity now shows a byte-weighted overall percent, matching the status screen. Books/Kolibri keep their indicator (Books has no per-item size yet). Adds an addRowProgressBar(col, percent, running) overload and a zimOverallPercent() helper.
…le; resume keeps % Kiwix reconnect is now visible and pausable: net-retry gains an explicit delaysMs schedule; the kiwix runner uses 3/6/9/18/36 s (5 waits), takes ctx.signal so pause breaks a backoff wait at once, and reports attempt/total via a new ctx.reportRetry -> GET /:type/jobs/:id gains retryAttempt/retryTotal (in-memory, no DB change). runKiwix no longer sends percent:0 on its initial update, so a resumed job keeps its retained percent. Bump 1.2.6-dev.1.
RestContentClient surfaces onReconnecting from the poll; ZimDownloadService tracks it and the status screen shows "Reconnecting n/5". Drops the app's invisible 3x auto-retry (retryOrFail): the server owns reconnection now, and an exhausted job goes FAILED for a manual retry. Adds k2go_dl_reconnecting_fmt (x34, English; translations to follow).
…ADFA-4893-zim-pause-resume
…l always The status screen had a size mismatch: big Pause/Cancel while running, but a small per-item Retry pill on failure. Now the primary button morphs Pause → Resume → Retry from the live state and Cancel is always beside it, so the row stays put across states and Retry is the same size as the rest. The per-item Retry pill is dropped (retryFailed() re-queues all failed items), and the now-orphaned ZimDownloadService.retry(ctx,
…-aligned)
Buttons: the status screen had a size mismatch — big Pause/Cancel while
running, a small per-item Retry pill on failure. Now one primary button morphs
Pause ⇄ Resume ⇄ Retry from the live state, Cancel is always beside it, and the
per-item pill is gone (retryFailed() re-queues all failed items). The failed
label is honest too ("<name> · Failed" instead of "All content ready").
Auto-reconnect: the reconnect state now reads like rootfs — reuse
k2go_dl_attempt ("Reconnecting… n of N", static ellipsis); Pause interrupts the
backoff, so there's no per-attempt "X" (same as rootfs).
Cleanup: drop the redundant k2go_dl_reconnecting_fmt (x34) and the now-orphaned
ZimDownloadService.retry(ctx,i); remove the "resumes if it drops" clause from
the detail line (x34) — the visible reconnection makes that reassurance moot.
… kickoff Code-review follow-up. Dedupe the byte-weighted percent: ZimDownloadService. overallPercent() is the one source for both the status-screen bar and the index row bar (SetupProgressActivity only gates -1 to hide on terminal). And give the START download POST a small bounded retry (3x / 2s) — the one point the server's own reconnect can't cover — instead of failing a warming box at once; an empty id still fails fast, and cancel stops the loop.
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.
ADFA-4893 — ZIM download: pause/resume + cancel, and progress visibility
Wires the app onto the engine's existing pause/resume for the ZIM stream, puts
the controls on the status screen (not the index), and gives the ZIM index row
the determinate bar the proot rows already have.
What changes
pause()/resume(), handles thepausedpoll phase(non-terminal),
onPaused(int)as a Listenerdefault(existing callerscompile unchanged).
sPaused/isPaused(), staticpause/resume,ACTION_PAUSE/RESUMEbefore thesRunningguard; the queue holds while paused.by the service poll; reuses ADFA-5119 strings. Shown only when the box's
dash-node is ≥ 1.2.4 (older boxes keep the notification Cancel).
(extends ADFA-5228 to the REST streams). Books/Kolibri keep their indicator.
Server dependency
No dash-node change — kiwix already honors pause/resume since 1.2.4 (ADFA-4894).
Box must run dash-node ≥ 1.2.4.
Follow-ups (dash-node sub-pass, not here)
Visible reconnect state (
Reconnecting n/5+ X = pause), and therunKiwixpercent: 0reset that flashes 0% on resume.Verification
Box on ≥ 1.2.4: start a ZIM download → index row shows the bar; open detail →
Pause (phase
paused, partial kept, queue holds) → Resume → Cancel. On < 1.2.4,the control row must not appear.