Skip to content

fix: refresh file explorer after delete, move and upload - #426

Open
apovasin wants to merge 1 commit into
newhinton:masterfrom
apovasin:fix/refresh-after-ephemeral-ops
Open

apovasin wants to merge 1 commit into
newhinton:masterfrom
apovasin:fix/refresh-after-ephemeral-ops

Conversation

@apovasin

Copy link
Copy Markdown

Fixes #425.

Problem

Ephemeral operations (delete, move, upload) run as EphemeralWorker jobs, but the worker never
notified the file explorer, so the listing stayed stale until a manual refresh. EphemeralWorker
already had sendUploadFinishedBroadcast() (line 370) that nothing called, and
EphemeralTaskManager.queueDelete() accepted currentPath without putting it into the input data.

Change

  • queueDelete(): pass currentPath as DELETE_PATH in the worker input data
  • EphemeralWorker: keep the affected directory per operation and send the existing
    background_service_broadcast after postSync():
    • upload -> destination directory
    • move -> destination (path) + source directory (path2, already handled by the receiver)
    • delete -> the directory the delete was started from

No other behaviour is touched; scheduled syncs still go through SyncWorker unchanged.

Testing

Built with AGP 8.8 / Gradle 8.12.1 and tested on a real device (nubia NX711J, Android 13,
arm64-v8a, debug build of 2.5.6) against a local remote:

scenario before after
delete file file gone on disk, still listed (18+ s) list refreshed in ~3 s
delete non-empty folder same list refreshed in ~3 s
upload file not listed after completion listed in ~3 s
move file between folders destination stale destination and source both correct
crash buffer - 0 crashes

Happy to split this into separate PRs per operation if you prefer smaller changes.

EphemeralTaskManager.queueDelete() dropped the directory path and
EphemeralWorker never sent the refresh broadcast the explorer listens to,
so deleted items kept showing until a manual refresh. Move and upload had
the same problem because they go through the same worker.

- queueDelete(): pass the current path as DELETE_PATH
- EphemeralWorker: remember the affected directory per operation and send
  the existing background-service broadcast once the work is finished
  (destination only for upload, destination + source for move)
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.

File explorer stays stale after delete, move and upload

1 participant