mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Settings: move things to UpdateService & cleanup
This commit is contained in:
+5
-15
@@ -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) {
|
||||
|
||||
@@ -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 = "";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user