From 2d0c05e4e4430a9d2eda66ce3dd2144206bde4b2 Mon Sep 17 00:00:00 2001 From: nimbold <11913706+nimbold@users.noreply.github.com> Date: Mon, 8 Jun 2026 00:24:12 +0330 Subject: [PATCH] fix: restore single click selection by removing simultaneousGesture --- Scripts/remove_doubleclick.py | 45 ++++++++++++++++++++++++++++ Sources/Firelink/DownloadTable.swift | 32 +++++++------------- 2 files changed, 56 insertions(+), 21 deletions(-) create mode 100644 Scripts/remove_doubleclick.py diff --git a/Scripts/remove_doubleclick.py b/Scripts/remove_doubleclick.py new file mode 100644 index 0000000..a5da007 --- /dev/null +++ b/Scripts/remove_doubleclick.py @@ -0,0 +1,45 @@ +with open("Sources/Firelink/DownloadTable.swift", "r") as f: + content = f.read() + +old_column = ''' TableColumn("File Name", value: \\.fileName) { item in + doubleClickableCell(for: item) { + HStack(alignment: .top, spacing: 8) { + Image(systemName: item.category.symbolName) + .font(.title3) + .foregroundStyle(categoryColor(for: item.category)) + .frame(width: 22) + Text(item.fileName) + .font(.headline) + .lineLimit(1) + .truncationMode(.tail) + .allowsHitTesting(false) + } + .draggable(item.id.uuidString) + } + }''' + +new_column = ''' TableColumn("File Name", value: \\.fileName) { item in + HStack(alignment: .top, spacing: 8) { + Image(systemName: item.category.symbolName) + .font(.title3) + .foregroundStyle(categoryColor(for: item.category)) + .frame(width: 22) + Text(item.fileName) + .font(.headline) + .lineLimit(1) + .truncationMode(.tail) + .allowsHitTesting(false) + } + .draggable(item.id.uuidString) + }''' + +content = content.replace(old_column, new_column) + +import re + +# Remove doubleClickableCell function block +pattern = r'\s*private func doubleClickableCell\(for item: DownloadItem, @ViewBuilder content: \(\) -> Content\) -> some View \{\s*content\(\)\s*\.contentShape\(Rectangle\(\)\)\s*\.simultaneousGesture\(TapGesture\(count: 2\)\.onEnded \{\s*performPrimaryAction\(for: item\)\s*\}\)\s*\}' +content = re.sub(pattern, '', content) + +with open("Sources/Firelink/DownloadTable.swift", "w") as f: + f.write(content) diff --git a/Sources/Firelink/DownloadTable.swift b/Sources/Firelink/DownloadTable.swift index 476ee7d..5d05881 100644 --- a/Sources/Firelink/DownloadTable.swift +++ b/Sources/Firelink/DownloadTable.swift @@ -37,20 +37,18 @@ struct DownloadTable: View { Table(sortedItems, selection: $selection, sortOrder: $sortOrder) { TableColumn("File Name", value: \.fileName) { item in - doubleClickableCell(for: item) { - HStack(alignment: .top, spacing: 8) { - Image(systemName: item.category.symbolName) - .font(.title3) - .foregroundStyle(categoryColor(for: item.category)) - .frame(width: 22) - Text(item.fileName) - .font(.headline) - .lineLimit(1) - .truncationMode(.tail) - .allowsHitTesting(false) - } - .draggable(item.id.uuidString) + HStack(alignment: .top, spacing: 8) { + Image(systemName: item.category.symbolName) + .font(.title3) + .foregroundStyle(categoryColor(for: item.category)) + .frame(width: 22) + Text(item.fileName) + .font(.headline) + .lineLimit(1) + .truncationMode(.tail) + .allowsHitTesting(false) } + .draggable(item.id.uuidString) } .width(min: 200, ideal: 340) @@ -158,14 +156,6 @@ struct DownloadTable: View { } } - private func doubleClickableCell(for item: DownloadItem, @ViewBuilder content: () -> Content) -> some View { - content() - .contentShape(Rectangle()) - .simultaneousGesture(TapGesture(count: 2).onEnded { - performPrimaryAction(for: item) - }) - } - private func performPrimaryAction(for item: DownloadItem) { if item.status == .completed { openFile(item)