Skip to content

ADFA-4893 — ZIM download: pause/resume + cancel on the status screen - #472

Merged
luisguzman-adfa merged 9 commits into
mainfrom
fix/ADFA-4893-zim-pause-resume
Aug 26, 2026
Merged

luisguzman-adfa merged 9 commits into
mainfrom
fix/ADFA-4893-zim-pause-resume

Conversation

@luisguzman-adfa

@luisguzman-adfa luisguzman-adfa commented Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • RestContentClient: pause() / resume(), handles the paused poll phase
    (non-terminal), onPaused(int) as a Listener default (existing callers
    compile unchanged).
  • ZimDownloadService: session sPaused/isPaused(), static pause/resume,
    ACTION_PAUSE/RESUME before the sRunning guard; the queue holds while paused.
  • ZimPreparingFragment: Pause⇄Resume + Cancel row on the status screen, driven
    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).
  • SetupProgressActivity: determinate byte-weighted bar on the ZIM index row
    (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 the runKiwix
percent: 0 reset 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.

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).
…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.
@luisguzman-adfa
luisguzman-adfa merged commit edbf1c4 into main Aug 26, 2026
4 checks passed
@luisguzman-adfa
luisguzman-adfa deleted the fix/ADFA-4893-zim-pause-resume branch August 26, 2026 00:40
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