Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
app_updates.hpp
Go to the documentation of this file.
1#pragma once
2
3// In-app software updates, as a service the hosting process may provide.
4//
5// A standalone app that embeds an updater (Sparkle, via pulp_add_sparkle())
6// installs an AppUpdateService at launch. Everything else -- an AU, VST3,
7// CLAP or AAX plug-in inside a DAW, a test binary, a build without an
8// updater -- has none installed, and every query below then reports
9// `available == false`. That is the contract an editor relies on: the
10// editor code is shared by every format, so it asks app_update_status() and
11// shows its "Check for Updates" controls only when the answer is available.
12//
13// Surfaces built on this service:
14// * the standalone app menu's "Check for Updates…" item (standalone.cpp),
15// * AppUpdatesSettingsView, a drop-in Settings group for native editors
16// (pulp/format/app_updates_settings_view.hpp),
17// * add_app_update_handlers(), the EditorBridge messages a JS editor calls
18// (pulp/format/app_updates_bridge.hpp; client in @pulp/react).
19//
20// Extension point (not built): a plug-in may later install its own service
21// that never runs an installer in the host's process -- for example one that
22// reads the same appcast, reports a newer version, and whose
23// check_for_updates() opens `releases_url` or asks the standalone app to
24// update. The status shape already carries what such a notice needs.
25
26#include <cstdint>
27#include <memory>
28#include <string>
29
30namespace pulp::format {
31
34enum class AppUpdateInstaller : std::uint8_t {
38};
39
42 bool available = false;
44 bool can_check_now = false;
47 bool automatic_checks = false;
49 bool automatic_install = false;
51 bool stub = false;
52 std::string app_name;
55 std::string version;
56 std::string build;
58 std::int64_t last_check_unix_seconds = 0;
60 std::string releases_url;
62 std::string feed_host;
64};
65
67 public:
68 virtual ~AppUpdateService() = default;
69 [[nodiscard]] virtual AppUpdateStatus status() const = 0;
72 virtual bool check_for_updates() = 0;
74 virtual bool set_automatic_checks(bool on) = 0;
77 virtual bool open_releases_page() {
78 return false;
79 }
80};
81
84void set_app_update_service(std::shared_ptr<AppUpdateService> service);
85[[nodiscard]] std::shared_ptr<AppUpdateService> app_update_service();
86
93
99[[nodiscard]] std::string app_update_note(const AppUpdateStatus& status);
100
102[[nodiscard]] std::string app_update_version_text(const AppUpdateStatus& status);
103
105[[nodiscard]] std::string app_update_last_check_text(const AppUpdateStatus& status);
106
111[[nodiscard]] std::string app_update_status_json(const AppUpdateStatus& status);
112
113} // namespace pulp::format
Definition app_updates.hpp:66
virtual bool check_for_updates()=0
Start a user-initiated check; the backend shows its own progress, "up to date" and update dialogs.
virtual bool set_automatic_checks(bool on)=0
Turn scheduled checks on or off. Returns false if the backend refused.
virtual bool open_releases_page()
Open status().releases_url in the user's browser.
Definition app_updates.hpp:77
virtual ~AppUpdateService()=default
virtual AppUpdateStatus status() const =0
What the product grants a device: the quota table indexed by capability tier and live thermal state.
Definition aax_editor.hpp:31
void set_app_update_service(std::shared_ptr< AppUpdateService > service)
Install (or, with nullptr, remove) the process-wide service.
std::string app_update_note(const AppUpdateStatus &status)
The explanatory note shown under the Settings controls, built only from facts in status,...
std::shared_ptr< AppUpdateService > app_update_service()
bool open_app_releases_page()
std::string app_update_version_text(const AppUpdateStatus &status)
"Version 1.0.7 (1.0.7.2)" – the build is shown only when it differs.
bool check_for_app_updates()
AppUpdateInstaller
How an update is installed, as the app declares it (pulp_add_sparkle INSTALLER).
Definition app_updates.hpp:34
@ app_bundle
A replacement .app: quits and reopens the app.
Definition app_updates.hpp:37
@ unknown
Not declared; the note says nothing about installing.
Definition app_updates.hpp:35
@ package
A signed .pkg: quits the app, asks for an admin password.
Definition app_updates.hpp:36
AppUpdateStatus app_update_status()
Convenience wrappers over the installed service.
bool set_app_update_automatic_checks(bool on)
std::string app_update_status_json(const AppUpdateStatus &status)
The status as a JSON object, the shape the JS bridge returns: {available, canCheckNow,...
std::string app_update_last_check_text(const AppUpdateStatus &status)
"Last checked: never" or "Last checked: 2026-10-04 14:03" (local time).
Definition app_updates.hpp:40
AppUpdateInstaller installer
Definition app_updates.hpp:63
std::int64_t last_check_unix_seconds
Unix seconds of the last completed check; 0 = never checked.
Definition app_updates.hpp:58
bool available
This process can check for, and install, updates. False in plug-ins.
Definition app_updates.hpp:42
bool can_check_now
A user-initiated check may start now (false while one is running).
Definition app_updates.hpp:44
std::string app_name
Definition app_updates.hpp:52
bool automatic_install
The backend may download AND install an update without asking.
Definition app_updates.hpp:49
bool stub
The backend is a development stub that never contacts a feed.
Definition app_updates.hpp:51
std::string build
Definition app_updates.hpp:56
bool automatic_checks
Scheduled background checks are on.
Definition app_updates.hpp:47
std::string releases_url
Web page that lists releases (pulp_add_sparkle RELEASES_URL); may be empty.
Definition app_updates.hpp:60
std::string version
User-facing version (CFBundleShortVersionString) and build (CFBundleVersion, the number the feed is c...
Definition app_updates.hpp:55
std::string feed_host
Host of the update feed, e.g. "github.com"; may be empty.
Definition app_updates.hpp:62