From bad205f5f65aed7da0912b64d4171e12754bbb03 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Thu, 14 Aug 2025 15:42:34 +0200 Subject: [PATCH] More small fixes for Github.qml/About.qml --- Modules/Settings/Tabs/About.qml | 2 +- Services/GitHub.qml | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Modules/Settings/Tabs/About.qml b/Modules/Settings/Tabs/About.qml index f768999..258c7e2 100644 --- a/Modules/Settings/Tabs/About.qml +++ b/Modules/Settings/Tabs/About.qml @@ -11,7 +11,7 @@ ColumnLayout { id: root property string latestVersion: GitHub.latestVersion - property string currentVersion: "v2.0.0" // Fallback version + property string currentVersion: "Unknown" // Fallback version property var contributors: GitHub.contributors spacing: 0 diff --git a/Services/GitHub.qml b/Services/GitHub.qml index 1bfac4c..1b74f4d 100644 --- a/Services/GitHub.qml +++ b/Services/GitHub.qml @@ -18,7 +18,7 @@ Singleton { property var contributors: [] FileView { - objectName: "githubDataFileView" + id: githubDataFileView path: githubDataFile watchChanges: true onFileChanged: reload() @@ -80,12 +80,16 @@ Singleton { // -------------------------------- function saveData() { data.timestamp = Time.timestamp + console.log("[GitHub] Saving data to cache file:", githubDataFile) + console.log("[GitHub] Data to save - version:", data.version, "contributors:", data.contributors.length) + + // Ensure cache directory exists + Quickshell.execDetached(["mkdir", "-p", Settings.cacheDir]) + Qt.callLater(() => { - // Access the FileView's writeAdapter method - var fileView = root.children.find(child => child.objectName === "githubDataFileView") - if (fileView) { - fileView.writeAdapter() - } + // Use direct ID reference to the FileView + githubDataFileView.writeAdapter() + console.log("[GitHub] Cache file written successfully") }) } @@ -140,8 +144,10 @@ Singleton { onStreamFinished: { try { const response = text + console.log("[GitHub] Raw contributors response length:", response ? response.length : 0) if (response && response.trim()) { const data = JSON.parse(response) + console.log("[GitHub] Parsed contributors data type:", typeof data, "length:", Array.isArray(data) ? data.length : "not array") root.data.contributors = data || [] root.contributors = root.data.contributors console.log("[GitHub] Contributors fetched from GitHub:", root.contributors.length)