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
30
namespace
pulp::format
{
31
34
enum class
AppUpdateInstaller
: std::uint8_t {
35
unknown
,
36
package
,
37
app_bundle
,
38
};
39
40
struct
AppUpdateStatus
{
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
;
63
AppUpdateInstaller
installer
=
AppUpdateInstaller::unknown
;
64
};
65
66
class
AppUpdateService
{
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
84
void
set_app_update_service
(std::shared_ptr<AppUpdateService> service);
85
[[nodiscard]] std::shared_ptr<AppUpdateService>
app_update_service
();
86
89
[[nodiscard]]
AppUpdateStatus
app_update_status
();
90
bool
check_for_app_updates
();
91
bool
set_app_update_automatic_checks
(
bool
on);
92
bool
open_app_releases_page
();
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
pulp::format::AppUpdateService
Definition
app_updates.hpp:66
pulp::format::AppUpdateService::check_for_updates
virtual bool check_for_updates()=0
Start a user-initiated check; the backend shows its own progress, "up to date" and update dialogs.
pulp::format::AppUpdateService::set_automatic_checks
virtual bool set_automatic_checks(bool on)=0
Turn scheduled checks on or off. Returns false if the backend refused.
pulp::format::AppUpdateService::open_releases_page
virtual bool open_releases_page()
Open status().releases_url in the user's browser.
Definition
app_updates.hpp:77
pulp::format::AppUpdateService::~AppUpdateService
virtual ~AppUpdateService()=default
pulp::format::AppUpdateService::status
virtual AppUpdateStatus status() const =0
pulp::format
What the product grants a device: the quota table indexed by capability tier and live thermal state.
Definition
aax_editor.hpp:31
pulp::format::set_app_update_service
void set_app_update_service(std::shared_ptr< AppUpdateService > service)
Install (or, with nullptr, remove) the process-wide service.
pulp::format::app_update_note
std::string app_update_note(const AppUpdateStatus &status)
The explanatory note shown under the Settings controls, built only from facts in status,...
pulp::format::app_update_service
std::shared_ptr< AppUpdateService > app_update_service()
pulp::format::open_app_releases_page
bool open_app_releases_page()
pulp::format::app_update_version_text
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.
pulp::format::check_for_app_updates
bool check_for_app_updates()
pulp::format::AppUpdateInstaller
AppUpdateInstaller
How an update is installed, as the app declares it (pulp_add_sparkle INSTALLER).
Definition
app_updates.hpp:34
pulp::format::AppUpdateInstaller::app_bundle
@ app_bundle
A replacement .app: quits and reopens the app.
Definition
app_updates.hpp:37
pulp::format::AppUpdateInstaller::unknown
@ unknown
Not declared; the note says nothing about installing.
Definition
app_updates.hpp:35
pulp::format::AppUpdateInstaller::package
@ package
A signed .pkg: quits the app, asks for an admin password.
Definition
app_updates.hpp:36
pulp::format::app_update_status
AppUpdateStatus app_update_status()
Convenience wrappers over the installed service.
pulp::format::set_app_update_automatic_checks
bool set_app_update_automatic_checks(bool on)
pulp::format::app_update_status_json
std::string app_update_status_json(const AppUpdateStatus &status)
The status as a JSON object, the shape the JS bridge returns: {available, canCheckNow,...
pulp::format::app_update_last_check_text
std::string app_update_last_check_text(const AppUpdateStatus &status)
"Last checked: never" or "Last checked: 2026-10-04 14:03" (local time).
pulp::format::AppUpdateStatus
Definition
app_updates.hpp:40
pulp::format::AppUpdateStatus::installer
AppUpdateInstaller installer
Definition
app_updates.hpp:63
pulp::format::AppUpdateStatus::last_check_unix_seconds
std::int64_t last_check_unix_seconds
Unix seconds of the last completed check; 0 = never checked.
Definition
app_updates.hpp:58
pulp::format::AppUpdateStatus::available
bool available
This process can check for, and install, updates. False in plug-ins.
Definition
app_updates.hpp:42
pulp::format::AppUpdateStatus::can_check_now
bool can_check_now
A user-initiated check may start now (false while one is running).
Definition
app_updates.hpp:44
pulp::format::AppUpdateStatus::app_name
std::string app_name
Definition
app_updates.hpp:52
pulp::format::AppUpdateStatus::automatic_install
bool automatic_install
The backend may download AND install an update without asking.
Definition
app_updates.hpp:49
pulp::format::AppUpdateStatus::stub
bool stub
The backend is a development stub that never contacts a feed.
Definition
app_updates.hpp:51
pulp::format::AppUpdateStatus::build
std::string build
Definition
app_updates.hpp:56
pulp::format::AppUpdateStatus::automatic_checks
bool automatic_checks
Scheduled background checks are on.
Definition
app_updates.hpp:47
pulp::format::AppUpdateStatus::releases_url
std::string releases_url
Web page that lists releases (pulp_add_sparkle RELEASES_URL); may be empty.
Definition
app_updates.hpp:60
pulp::format::AppUpdateStatus::version
std::string version
User-facing version (CFBundleShortVersionString) and build (CFBundleVersion, the number the feed is c...
Definition
app_updates.hpp:55
pulp::format::AppUpdateStatus::feed_host
std::string feed_host
Host of the update feed, e.g. "github.com"; may be empty.
Definition
app_updates.hpp:62
core
format
include
pulp
format
app_updates.hpp
Generated by
1.15.0