Skip to content

Automatic update checks (AppImage, Windows, macOS) #321

@danirod

Description

@danirod

Let's bring back #58 from the dead.

Now that there is a version checker in the settings, adding a trigger that runs the version check routine on startup every couple of days is feasible.

It is important that this capability is behind the app-updater feature flag, just like the rest of the updates system. Not only this is important for people who want to completely forbid Cartero from communication to the internet for anything that is not a document HTTP request. It is also important for packagers because when installed from a package manager, the source of truth for updates might be the repository itself (as in, the version in AUR, the version in NixOS or the version in ALT Linux should update only when the repo rules dictate so).

Here is the gist for this feature.

  • Add a second GSettings schema file in the data/ directory, es.danirod.Cartero.CheckUpdate.gschema.xml. It is important to have a separate file because then we can ask data/meson.build to only build and package this file if the meson option is enabled.
  • This one should have the following options at least:
    • update-frequency (enum; never, daily, weekly, monthly). Frequency. Controlled from a dropdown in the update settings in the preferences dialog.
    • next-check (u64). The timestamp of the next check. If the application boots and the current date is higher than the next-check timestamp, a check is triggered and next-check is updated to now + (the amount of seconds derived from update-frequency, 86400 if daily, 864007 if weekly, 8640030 if monthly).
    • auto-check-offered (bool). On startup, check if this value is false, and only if false, set auto-check-offered to true (to disable running this on the next launch), and show a dialog with a string like "hey you want to periodically see if a new version has been released". When the user agrees, the settings are automatically configured to weekly and the next-check is reset to now + 86400*7. If the user disagrees, keep it at never.
    • first-run (bool). Initially false, but set it to true on every run. Before setting it to true, check if false. If false, do not run the auto-check-offered logic. The idea is to only trigger the updates dialog on the second launch, to prevent having a dialog when the application first launches.

When a check needs to be made, the GAction for checking for updates is executed. Maybe the dialog has to be updated to indicate the current version you are running, not only the latest version available.

I am also considering to have an endpoint in https://cartero.danirod.es to expose the latest version, to avoid having checks being made straight to GitHub.com.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions