Files
DeepTutor/apps/mobile/app/knowledge
ZQR1101 78cb0e1b29 fix(mobile): bind an upload queue to the screen and destination it was picked for
The queue had no identity of its own: a file picked for one knowledge base could
be drained after the screen had moved to another base, another account or no
server at all, and a pending picker could resolve into a closed screen.

Every task now carries the destination it was picked for (origin, base, account)
and the queue carries a generation that is bumped on unmount, sign-out, account
switch, base switch and server change. `drain` re-checks both before each file
and again after every await, so a retired queue cannot start another request,
and a failure or cancellation can no longer be retried into the wrong place.

Copies the picker left in the cache are released when they can no longer be
used — refused validation, a withdrawn queue, an abandoned screen, a closed
screen before the picker resolved. Ownership is decided by the directory, not by
the scheme: only paths strictly below `Paths.cache` with no `.`/`..` segment are
deleted, and a `content://` URI is never touched, so the learner's own document
cannot be destroyed by a cleanup.

Both catalogue hooks now key their reload on the server-plus-account identity
(`knowledgeScope`) rather than on a client object, so an inline client cannot
make them loop while a real switch still clears the previous owner's rows.
2026-11-25 15:36:43 +08:00
..