From 46ab82a8fd7ca6251229128c98df2ea6e4f3e3c0 Mon Sep 17 00:00:00 2001 From: Filip Benklewski <250849052+FilipB97@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:11:44 +0100 Subject: [PATCH] =?UTF-8?q?fix(mac):=20panel=20plik=C3=B3w=20nie=20pomija?= =?UTF-8?q?=20po=20cichu=20operacji=20w=20trakcie=20przesy=C5=82ania=20(B4?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Druga operacja w trakcie przesyłania dawała tylko ciche return, a startTransfer przed tym kasował anulowanie i podmieniał opis trwającego przesyłania. Teraz: sygnał dźwiękowy i komunikat w pasku stanu (także obok postępu), stan trwającego przesyłania nienaruszony, a przy wysyłaniu sprawdzenie przed pytaniem o nadpisanie. Co-Authored-By: Claude Opus 5.5 --- mac/App/Sources/Waypoint/FileSession.swift | 12 +++++++++++- mac/App/Sources/Waypoint/FilesView.swift | 3 +++ mac/WaypointCore/Sources/WaypointCore/Strings.swift | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/mac/App/Sources/Waypoint/FileSession.swift b/mac/App/Sources/Waypoint/FileSession.swift index 96c22c9..647f57c 100644 --- a/mac/App/Sources/Waypoint/FileSession.swift +++ b/mac/App/Sources/Waypoint/FileSession.swift @@ -203,9 +203,16 @@ final class FileSession: Identifiable { messageIsError = error } + /// Panel wykonuje jedną operację naraz: kolejna w trakcie przesyłania nie znika po cichu. + private func rejectBusy() { + NSSound.beep() + show(L("files.busy"), error: true) + } + /// Wykonuje pracę na kolejce SFTP; wynik (albo błąd) wraca na wątek główny. private func run(_ label: String?, work: @escaping (RemoteFS) throws -> T, done: @escaping (T) -> Void) { - guard let c = client, !busy else { return } + guard let c = client else { return } + guard !busy else { rejectBusy(); return } busy = true if let label { show(label) } queue.async { [weak self] in @@ -291,6 +298,7 @@ final class FileSession: Identifiable { /// Wysyłanie plików/katalogów z Findera (przycisk albo przeciągnięcie). Istniejące nazwy → pytanie. func upload(_ urls: [URL], confirmedOverwrite: Bool = false) { guard !urls.isEmpty else { return } + guard !busy else { rejectBusy(); return } let existing = urls.map(\.lastPathComponent).filter { n in entries.contains { $0.name == n } } if !existing.isEmpty && !confirmedOverwrite { overwriteQuestion = (existing, urls) @@ -398,6 +406,8 @@ final class FileSession: Identifiable { private func startTransfer(_ label: String, total: UInt64, work: @escaping (RemoteFS, @escaping (UInt64) -> Bool) throws -> T, done: @escaping (T) -> Void) { + // Przed zmianą wspólnego stanu: odrzucone przesyłanie nie może skasować anulowania ani opisu trwającego. + guard !busy else { rejectBusy(); return } cancelFlag.set(false) let flag = cancelFlag transfer = Transfer(label: label, done: 0, total: total) diff --git a/mac/App/Sources/Waypoint/FilesView.swift b/mac/App/Sources/Waypoint/FilesView.swift index 57110b6..c5aea24 100644 --- a/mac/App/Sources/Waypoint/FilesView.swift +++ b/mac/App/Sources/Waypoint/FilesView.swift @@ -235,6 +235,9 @@ struct FilesView: View { ProgressView().controlSize(.small) } Button(L("btn.cancel")) { session.cancelTransfer() } + if session.messageIsError, let m = session.message { + Text(m).foregroundStyle(Color.red).lineLimit(1) + } } else if let m = session.message { Text(m).foregroundStyle(session.messageIsError ? Color.red : Color.secondary).lineLimit(1) .textSelection(.enabled) diff --git a/mac/WaypointCore/Sources/WaypointCore/Strings.swift b/mac/WaypointCore/Sources/WaypointCore/Strings.swift index 1595343..6ce2a88 100644 --- a/mac/WaypointCore/Sources/WaypointCore/Strings.swift +++ b/mac/WaypointCore/Sources/WaypointCore/Strings.swift @@ -242,6 +242,7 @@ public enum Strings { "files.downloading": "Pobieranie: %@", "files.downloaded": "Pobrano %@ do %@", "files.deleting": "Usuwanie…", + "files.busy": "Trwa inna operacja: poczekaj, aż się skończy, albo ją anuluj.", "files.deleted": "Usunięto elementów: %ld", "files.delete.one": "Usunąć „%@”?", "files.delete.many": "Usunąć %ld elementów?", @@ -821,6 +822,7 @@ public enum Strings { "files.downloading": "Downloading: %@", "files.downloaded": "Downloaded %@ to %@", "files.deleting": "Deleting…", + "files.busy": "Another operation is in progress: wait for it to finish or cancel it.", "files.deleted": "Deleted items: %ld", "files.delete.one": "Delete “%@”?", "files.delete.many": "Delete %ld items?",