Implement Silent Auto-Download (#154)
This MR is my first take at getting that auto-download feature for puzzle sets working on startup as outlined in the Startup Actions design doc.
Here’s is a summary of the implementation, what works, what’s still hanging and some and a things I’d love some eyes on.
Implementation Details
I followed the design doc’s requirements for the auto-download feature, with the following considerations :
If there's no network on startup, we shouldn't run the downloaders. If network becomes available, we could then trigger the download stage.
The Downloader currently has a cancel dialog that pops up after a certain time. We will need to suppress that dialog, but probably cancel the operation if it takes too long. Maybe a 10-second timeout is sufficient to give the downloader a chance to finish but not wait indefinitely.
We need to figure out how best to notify the user about progress. [...] Just doing it silently could also be sufficient. The user may not need to know it's being downloaded.
What I Got Working:
- Network Check: Straightforward implementation..
-
Download Stage: Added
puzzle_set_auto_download_allto iterate over enabled puzzle sets and trigger auto-downloads usingpuzzle_downloader_run_auto. - Silent Operation:
-
Cancel Dialog Suppression: Introduced a new callback,
auto_downloader_cancel_timeout_cb, to quietly silently subprocess after 10 seconds. -
Failure Handling: Created
auto_command_finished_cb, logging failures instead of displaying a dialog. - Went with the silent approach (no notifications), since the doc says that’s cool enough.
Variants (Straight from the Design Doc):
We should keep track of the last time we went into a puzzle set and determine if there are new puzzles available. These puzzles could be added either by the auto downloader or updating the puzzle set (eg, maya's puzzles). We could add a label saying "New puzzles available" in this instance in the main page.
GNOME 44 has support for background apps. We can consider an option where we keep the app running and have it download crosswords daily regardless of whether you start it.
Along the same lines, if we keep the app open for more than 24 hours, do we want to trigger this again? It's pretty straightforward to add that timer, but is it something the user would expect?
-
Tracking Last Access Time:That “New puzzles available” idea ain’t in yet but could be added in a future MR.
-
GNOME 44 Background App Support: Didn’t touch that here.
-
Re-triggering Auto-Downloads Every 24 Hours:I’m leaning no on this one. It may be unexpected for users and would result in unwanted downloads.
Known Issues:
- Progress Percentage Bug: Spotted a bug where the puzzle progress jumps to 100% after a restart, even if it’s partially-done. Not tied to this MR, but it’s on the radar in issue #258 (closed).
Concerns and Feedback Requested:
-
Code Redundancy:
-
Added two new callbacks (
auto_downloader_cancel_timeout_cbandauto_command_finished_cb) to handle silent auto-downloads. -
They are similar to
downloader_cancel_timeout_cbandcommand_finished_cb, but they skip the dialog logic. -
Is there a cleaner way to do this? maybe modifying
PuzzleDownloaderto have asilentflag instead of duplicating the callbacks?
-
-
Auto-Clean Feature: Design doc mentions cleaning out old puzzles, but I didn’t dig into that here.
Would really appreciate some thoughts on the redundancy thing and any other improvements!