From 01ba9c4c9bb49938010b4e5fe392943d4b2cfc37 Mon Sep 17 00:00:00 2001 From: nimbold <11913706+nimbold@users.noreply.github.com> Date: Mon, 8 Jun 2026 00:11:23 +0330 Subject: [PATCH] fix: pass UUID as String for download properties WindowGroup to prevent routing failures --- Scripts/fix_window.py | 21 +++++++++++++++++++++ Sources/Firelink/DownloadTable.swift | 2 +- Sources/Firelink/FirelinkApp.swift | 4 ++-- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 Scripts/fix_window.py diff --git a/Scripts/fix_window.py b/Scripts/fix_window.py new file mode 100644 index 0000000..e08d4cc --- /dev/null +++ b/Scripts/fix_window.py @@ -0,0 +1,21 @@ +with open("Sources/Firelink/FirelinkApp.swift", "r") as f: + app_content = f.read() + +old_group = ''' WindowGroup("Download Properties", id: "download-properties", for: UUID.self) { $downloadID in + if let downloadID {''' +new_group = ''' WindowGroup("Download Properties", id: "download-properties", for: String.self) { $downloadIDString in + if let idString = downloadIDString, let downloadID = UUID(uuidString: idString) {''' +app_content = app_content.replace(old_group, new_group) + +with open("Sources/Firelink/FirelinkApp.swift", "w") as f: + f.write(app_content) + +with open("Sources/Firelink/DownloadTable.swift", "r") as f: + table_content = f.read() + +old_open1 = 'openWindow(id: "download-properties", value: item.id)' +new_open1 = 'openWindow(id: "download-properties", value: item.id.uuidString)' +table_content = table_content.replace(old_open1, new_open1) + +with open("Sources/Firelink/DownloadTable.swift", "w") as f: + f.write(table_content) diff --git a/Sources/Firelink/DownloadTable.swift b/Sources/Firelink/DownloadTable.swift index 44d5562..42f08ef 100644 --- a/Sources/Firelink/DownloadTable.swift +++ b/Sources/Firelink/DownloadTable.swift @@ -165,7 +165,7 @@ struct DownloadTable: View { if item.status == .completed { openFile(item) } else { - openWindow(id: "download-properties", value: item.id) + openWindow(id: "download-properties", value: item.id.uuidString) } } diff --git a/Sources/Firelink/FirelinkApp.swift b/Sources/Firelink/FirelinkApp.swift index a9b21f9..8e919d3 100644 --- a/Sources/Firelink/FirelinkApp.swift +++ b/Sources/Firelink/FirelinkApp.swift @@ -115,8 +115,8 @@ struct FirelinkApp: App { } .windowResizability(.contentSize) - WindowGroup("Download Properties", id: "download-properties", for: UUID.self) { $downloadID in - if let downloadID { + WindowGroup("Download Properties", id: "download-properties", for: String.self) { $downloadIDString in + if let idString = downloadIDString, let downloadID = UUID(uuidString: idString) { DownloadPropertiesWindow(downloadID: downloadID) .environmentObject(controller) .environmentObject(settings)