Settings: migration for shellstate is now handled in Settings.qml

This commit is contained in:
Ly-sec
2025-11-22 15:40:53 +01:00
parent 83d1cbacc7
commit 8eaa5cc034
7 changed files with 221 additions and 137 deletions
+1 -36
View File
@@ -319,17 +319,7 @@ Singleton {
const changelog = ShellState.getChangelogState();
changelogLastSeenVersion = changelog.lastSeenVersion || "";
if (!changelogLastSeenVersion) {
// Try to migrate from old changelog-state.json
migrateFromOldChangelogFile();
// Also try settings migration
if (!changelogLastSeenVersion && Settings.data && Settings.data.changelog && Settings.data.changelog.lastSeenVersion) {
changelogLastSeenVersion = Settings.data.changelog.lastSeenVersion;
debouncedSaveChangelogState();
Logger.i("UpdateService", "Migrated changelog lastSeenVersion from settings to ShellState");
}
}
// Migration is now handled in Settings.qml
Logger.d("UpdateService", "Loaded changelog state from ShellState");
} catch (error) {
Logger.e("UpdateService", "Failed to load changelog state:", error);
@@ -341,31 +331,6 @@ Singleton {
}
}
function migrateFromOldChangelogFile() {
const oldChangelogPath = Settings.cacheDir + "changelog-state.json";
const migrationFileView = Qt.createQmlObject(`
import QtQuick
import Quickshell.Io
FileView {
id: migrationView
path: "${oldChangelogPath}"
printErrors: false
adapter: JsonAdapter {
property string lastSeenVersion: ""
}
onLoaded: {
parent.changelogLastSeenVersion = adapter.lastSeenVersion || "";
parent.debouncedSaveChangelogState();
Logger.i("UpdateService", "Migrated changelog-state.json to ShellState");
migrationView.destroy();
}
onLoadFailed: {
migrationView.destroy();
}
}
`, root, "changelogMigrationView");
}
function debouncedSaveChangelogState() {
// Queue a save and restart the debounce timer
pendingSave = true;