diff options
| author | saturneric <[email protected]> | 2026-09-24 23:25:25 +0200 |
|---|---|---|
| committer | saturneric <[email protected]> | 2026-09-24 23:25:25 +0200 |
| commit | 1c95ebf2cbb4d4c841141f568eb394f4091b6ba7 (patch) | |
| tree | edc4ae7cddc999d9500cc10dd6c83821c14fd9e0 /src/m_ver_check/VersionCheckingModule.cpp | |
| parent | feat(update): add robust GitHub update checking (diff) | |
| download | modules-1c95ebf2cbb4d4c841141f568eb394f4091b6ba7.tar.gz modules-1c95ebf2cbb4d4c841141f568eb394f4091b6ba7.zip | |
feat(update): track unseen releases without prompting
- replace startup dialogs with quiet background update checks
- track and persist the latest update seen by the user
- expose update attention state for badges and UI indicators
- acknowledge updates when the update page is opened
- retain acknowledgements across failures, restarts, and rebuilds
- expand tests for attention, persistence, and rediscovered releases
Diffstat (limited to 'src/m_ver_check/VersionCheckingModule.cpp')
| -rw-r--r-- | src/m_ver_check/VersionCheckingModule.cpp | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/src/m_ver_check/VersionCheckingModule.cpp b/src/m_ver_check/VersionCheckingModule.cpp index 73cf9fa..4fe5bd7 100644 --- a/src/m_ver_check/VersionCheckingModule.cpp +++ b/src/m_ver_check/VersionCheckingModule.cpp @@ -115,26 +115,6 @@ void OpenUpdateDialog() { {gf::cmd::ViewRef{QStringLiteral(GF_MODULE_ID ".update")}}); } -/// Once per run: the startup check's answer, or a fresh stored one. -void CheckAtStartup() { - auto* checker = VersionChecker(); - if (checker == nullptr) return; - - auto watch = std::make_shared<QMetaObject::Connection>(); - const auto decide = [checker, watch] { - if (checker->State().checking) return; - QObject::disconnect(*watch); - if (ShouldPromptOnStartup(checker->State())) { - LOG_INFO("a newer release is available, notifying user"); - OpenUpdateDialog(); - } - }; - - *watch = QObject::connect(checker, &UpdateChecker::Changed, checker, decide); - checker->Start(CheckMode::kIfStale); - decide(); -} - /// The update dialog, in a frame the Host owns. class UpdateWidget : public QWidget, public gf::ui::DialogWidget { public: @@ -273,7 +253,11 @@ auto OnApplicationLoaded(const GFEvent& /*event*/) -> GFEventResult { return GFEventResult::Ok(); } - OnGuiThread(&CheckAtStartup); + // In the background, and quietly: a newer release shows as a badge on + // Help > Check for Updates, never as a window. + OnGuiThread([] { + if (auto* checker = VersionChecker()) checker->Start(CheckMode::kIfStale); + }); // An observation, answered at once: the check runs on its own. return GFEventResult::Ok(); |
