From 836029b5670c2336189ef1d809a229aa9b45ddbe Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Tue, 18 Nov 2025 00:58:57 +0100 Subject: [PATCH] Settings: move things to UpdateService & cleanup --- Commons/Settings.qml | 20 +++++------------ Services/Noctalia/UpdateService.qml | 34 ++++++++++++++++++----------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/Commons/Settings.qml b/Commons/Settings.qml index a2404734a..7533274e6 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -17,9 +17,6 @@ Singleton { property bool directoriesCreated: false property int settingsVersion: 23 property bool isDebug: Quickshell.env("NOCTALIA_DEBUG") === "1" - property bool changelogPending: false - property string changelogFromVersion: "" - property string changelogToVersion: "" // Define our app directories // Default config directory: ~/.config/noctalia @@ -40,7 +37,6 @@ Singleton { // Signal emitted when settings are loaded after startupcale changes signal settingsLoaded signal settingsSaved - signal changelogTriggered(string previousVersion, string currentVersion) // ----------------------------------------------------- // ----------------------------------------------------- @@ -553,11 +549,11 @@ Singleton { const versionChanged = storedVersion !== currentVersion; const shouldTrigger = forceShow || (hasSeenBefore && versionChanged); - if (shouldTrigger) { - changelogFromVersion = storedVersion; - changelogToVersion = currentVersion; - changelogPending = true; - root.changelogTriggered(storedVersion, currentVersion); + if (shouldTrigger && UpdateService) { + UpdateService.changelogFromVersion = storedVersion; + UpdateService.changelogToVersion = currentVersion; + UpdateService.changelogPending = true; + UpdateService.handleChangelogRequest(); } adapter.changelog.lastSeenVersion = currentVersion; @@ -568,12 +564,6 @@ Singleton { } } - function clearChangelogRequest() { - changelogPending = false; - changelogFromVersion = ""; - changelogToVersion = ""; - } - // ----------------------------------------------------- // Function to preprocess paths by expanding "~" to user's home directory function preprocessPath(path) { diff --git a/Services/Noctalia/UpdateService.qml b/Services/Noctalia/UpdateService.qml index 2e811ea01..248348a69 100644 --- a/Services/Noctalia/UpdateService.qml +++ b/Services/Noctalia/UpdateService.qml @@ -16,6 +16,9 @@ Singleton { // Changelog properties property bool initialized: false + property bool changelogPending: false + property string changelogFromVersion: "" + property string changelogToVersion: "" property string previousVersion: "" property string changelogCurrentVersion: "" property var releaseHighlights: [] @@ -45,15 +48,8 @@ Singleton { initialized = true; Logger.i("UpdateService", "Version:", root.currentVersion); - if (Settings.changelogPending) { - handleChangelogRequest(Settings.changelogFromVersion, Settings.changelogToVersion); - } - } - - Connections { - target: Settings ? Settings : null - function onChangelogTriggered(fromVersion, toVersion) { - handleChangelogRequest(fromVersion, toVersion); + if (changelogPending) { + handleChangelogRequest(changelogFromVersion, changelogToVersion); } } @@ -70,7 +66,10 @@ Singleton { } } - function handleChangelogRequest(fromVersion, toVersion) { + function handleChangelogRequest() { + const fromVersion = changelogFromVersion || ""; + const toVersion = changelogToVersion || ""; + if (!toVersion) return; @@ -80,7 +79,7 @@ Singleton { if (!popupScheduled && lastShownVersion === toVersion) return; - previousVersion = fromVersion || ""; + previousVersion = fromVersion; changelogCurrentVersion = toVersion; fetchError = GitHubService ? GitHubService.releaseFetchError : ""; releaseHighlights = buildReleaseHighlights(previousVersion, changelogCurrentVersion); @@ -89,7 +88,7 @@ Singleton { popupScheduled = true; root.popupQueued(previousVersion, changelogCurrentVersion); - Settings.clearChangelogRequest(); + clearChangelogRequest(); openWhenReady(); } @@ -305,6 +304,15 @@ Singleton { function showLatestChangelog() { if (!currentVersion) return; - handleChangelogRequest(Settings.data.changelog.lastSeenVersion, currentVersion); + changelogFromVersion = Settings.data.changelog.lastSeenVersion || ""; + changelogToVersion = currentVersion; + changelogPending = true; + handleChangelogRequest(); + } + + function clearChangelogRequest() { + changelogPending = false; + changelogFromVersion = ""; + changelogToVersion = ""; } }