From 3ccb41ae0fe79bd3c08b4aab8d22ccc841f1e8c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6ttger?= Date: Sun, 18 May 2025 11:53:02 +0200 Subject: [PATCH] Make open finder automatically an optional setting --- NearbyShare/Helpers.swift | 1 + NearbyShare/InboundNearbyConnection.swift | 7 +++++-- QuickDrop/Base.lproj/Localizable.strings | 1 + QuickDrop/SettingsView.swift | 8 ++++++++ QuickDrop/ar.lproj/Localizable.strings | 1 + QuickDrop/de.lproj/Localizable.strings | 1 + QuickDrop/es.lproj/Localizable.strings | 1 + QuickDrop/fr.lproj/Localizable.strings | 1 + QuickDrop/hu.lproj/Localizable.strings | 1 + QuickDrop/it.lproj/Localizable.strings | 1 + QuickDrop/ja.lproj/Localizable.strings | 1 + QuickDrop/ko.lproj/Localizable.strings | 1 + QuickDrop/nl.lproj/Localizable.strings | 1 + QuickDrop/pt-BR.lproj/Localizable.strings | 1 + QuickDrop/pt-PT.lproj/Localizable.strings | 1 + QuickDrop/ro.lproj/Localizable.strings | 1 + QuickDrop/ru.lproj/Localizable.strings | 1 + QuickDrop/th.lproj/Localizable.strings | 1 + QuickDrop/uk.lproj/Localizable.strings | 1 + QuickDrop/zh-Hans.lproj/Localizable.strings | 1 + 20 files changed, 31 insertions(+), 2 deletions(-) diff --git a/NearbyShare/Helpers.swift b/NearbyShare/Helpers.swift index c39fd7e..559fe92 100644 --- a/NearbyShare/Helpers.swift +++ b/NearbyShare/Helpers.swift @@ -26,5 +26,6 @@ public enum UserDefaultsKeys: String, CaseIterable { case transmissionCount = "reviewRequestCountKey" case automaticallyAcceptFiles = "automaticallyAcceptFiles" case saveFolderBookmark = "saveFolderBookmark" + case openFinderAfterReceiving = "openFinderAfterReceiving" case endpointID = "endpointID" } diff --git a/NearbyShare/InboundNearbyConnection.swift b/NearbyShare/InboundNearbyConnection.swift index ed86a50..bdfca4f 100644 --- a/NearbyShare/InboundNearbyConnection.swift +++ b/NearbyShare/InboundNearbyConnection.swift @@ -574,8 +574,11 @@ public class SaveFilesManager { } if !filesFinishedDownloadingSinceLastRun.isEmpty && !isFileTransferRestricted() { - log("Opening \(filesFinishedDownloadingSinceLastRun.count) file(s) in Finder.") - NSWorkspace.shared.activateFileViewerSelecting(filesFinishedDownloadingSinceLastRun) + + if UserDefaults.standard.bool(forKey: UserDefaultsKeys.openFinderAfterReceiving.rawValue) { + log("Opening \(filesFinishedDownloadingSinceLastRun.count) file(s) in Finder.") + NSWorkspace.shared.activateFileViewerSelecting(filesFinishedDownloadingSinceLastRun) + } // Clear the list of finished files filesFinishedDownloadingSinceLastRun.removeAll() diff --git a/QuickDrop/Base.lproj/Localizable.strings b/QuickDrop/Base.lproj/Localizable.strings index 42d1b5e..d0a993c 100644 --- a/QuickDrop/Base.lproj/Localizable.strings +++ b/QuickDrop/Base.lproj/Localizable.strings @@ -73,6 +73,7 @@ "SaveFilesLocation" = "Incomping Files Location"; "SaveFilesToButton" = "Select…"; "DownloadsFolder" = "Downloads"; +"OpenFinderAfterReceiving" = "Show Files in Finder After Receiving"; "SendFiles" = "Send Files"; "ReceiveFiles" = "Receive Files"; diff --git a/QuickDrop/SettingsView.swift b/QuickDrop/SettingsView.swift index e4c4859..541a4a8 100644 --- a/QuickDrop/SettingsView.swift +++ b/QuickDrop/SettingsView.swift @@ -11,6 +11,7 @@ import NearbyShare struct SettingsView: View { @AppStorage(UserDefaultsKeys.automaticallyAcceptFiles.rawValue) private var automaticallyAcceptFiles = false + @AppStorage(UserDefaultsKeys.openFinderAfterReceiving.rawValue) private var openFinderAfterReceiving = false @AppStorage(UserDefaultsKeys.saveFolderBookmark.rawValue) private var saveFolderPath: Data = Data() var body: some View { @@ -37,6 +38,13 @@ struct SettingsView: View { selectFolder() } } + + Divider() + .padding(.vertical, 10) + + Toggle("OpenFinderAfterReceiving", isOn: $openFinderAfterReceiving) + .padding(.top, 5) + } } } diff --git a/QuickDrop/ar.lproj/Localizable.strings b/QuickDrop/ar.lproj/Localizable.strings index 78e6198..6e10684 100644 --- a/QuickDrop/ar.lproj/Localizable.strings +++ b/QuickDrop/ar.lproj/Localizable.strings @@ -64,6 +64,7 @@ "SaveFilesTo" = "حفظ الملفات الواردة في:"; "SaveFilesLocation" = "موقع الملفات الواردة"; "SaveFilesToButton" = "تحديد…"; +"OpenFinderAfterReceiving" = "عرض الملفات في Finder بعد الاستلام"; "DownloadsFolder" = "التنزيلات"; "SendFiles" = "إرسال الملفات"; "ReceiveFiles" = "استقبال الملفات"; diff --git a/QuickDrop/de.lproj/Localizable.strings b/QuickDrop/de.lproj/Localizable.strings index 9a481fa..e22b73f 100644 --- a/QuickDrop/de.lproj/Localizable.strings +++ b/QuickDrop/de.lproj/Localizable.strings @@ -66,6 +66,7 @@ "SaveFilesTo" = "Eingehende Dateien speichern in:"; "SaveFilesLocation" = "Speicherort der eingehenden Dateien"; "SaveFilesToButton" = "Auswählen…"; +"OpenFinderAfterReceiving" = "Dateien nach Empfang im Finder anzeigen"; "DownloadsFolder" = "Downloads"; "SendFiles" = "Dateien senden"; diff --git a/QuickDrop/es.lproj/Localizable.strings b/QuickDrop/es.lproj/Localizable.strings index 41b8d2d..4a1a831 100644 --- a/QuickDrop/es.lproj/Localizable.strings +++ b/QuickDrop/es.lproj/Localizable.strings @@ -64,6 +64,7 @@ "SaveFilesTo" = "Guardar archivos entrantes en:"; "SaveFilesLocation" = "Ubicación de archivos entrantes"; "SaveFilesToButton" = "Seleccionar…"; +"OpenFinderAfterReceiving" = "Mostrar archivos en Finder después de recibirlos"; "DownloadsFolder" = "Descargas"; "SendFiles" = "Enviar archivos"; "ReceiveFiles" = "Recibir archivos"; diff --git a/QuickDrop/fr.lproj/Localizable.strings b/QuickDrop/fr.lproj/Localizable.strings index d7ff2f2..41c5b3b 100644 --- a/QuickDrop/fr.lproj/Localizable.strings +++ b/QuickDrop/fr.lproj/Localizable.strings @@ -64,6 +64,7 @@ "SaveFilesTo" = "Enregistrer les fichiers reçus dans :"; "SaveFilesLocation" = "Emplacement des fichiers reçus"; "SaveFilesToButton" = "Sélectionner…"; +"OpenFinderAfterReceiving" = "Afficher les fichiers dans le Finder après réception"; "DownloadsFolder" = "Téléchargements"; "SendFiles" = "Envoyer des fichiers"; "ReceiveFiles" = "Recevoir des fichiers"; diff --git a/QuickDrop/hu.lproj/Localizable.strings b/QuickDrop/hu.lproj/Localizable.strings index 277e74a..39457cb 100644 --- a/QuickDrop/hu.lproj/Localizable.strings +++ b/QuickDrop/hu.lproj/Localizable.strings @@ -64,6 +64,7 @@ "SaveFilesTo" = "Bejövő fájlok mentése ide:"; "SaveFilesLocation" = "Bejövő fájlok helye"; "SaveFilesToButton" = "Kiválasztás…"; +"OpenFinderAfterReceiving" = "Fájlok megjelenítése a Finderben fogadás után"; "DownloadsFolder" = "Letöltések"; "SendFiles" = "Fájlok küldése"; "ReceiveFiles" = "Fájlok fogadása"; diff --git a/QuickDrop/it.lproj/Localizable.strings b/QuickDrop/it.lproj/Localizable.strings index 13eabed..ae3feee 100644 --- a/QuickDrop/it.lproj/Localizable.strings +++ b/QuickDrop/it.lproj/Localizable.strings @@ -64,6 +64,7 @@ "SaveFilesTo" = "Salva i file ricevuti in:"; "SaveFilesLocation" = "Posizione dei file ricevuti"; "SaveFilesToButton" = "Seleziona…"; +"OpenFinderAfterReceiving" = "Mostra i file nel Finder dopo la ricezione"; "DownloadsFolder" = "Download"; "SendFiles" = "Invia file"; "ReceiveFiles" = "Ricevi file"; diff --git a/QuickDrop/ja.lproj/Localizable.strings b/QuickDrop/ja.lproj/Localizable.strings index 2416ee4..53dbdb3 100644 --- a/QuickDrop/ja.lproj/Localizable.strings +++ b/QuickDrop/ja.lproj/Localizable.strings @@ -64,6 +64,7 @@ "SaveFilesTo" = "受信ファイルの保存先:"; "SaveFilesLocation" = "受信ファイルの保存場所"; "SaveFilesToButton" = "選択…"; +"OpenFinderAfterReceiving" = "受信後にFinderでファイルを表示"; "DownloadsFolder" = "ダウンロード"; "SendFiles" = "ファイルを送信"; "ReceiveFiles" = "ファイルを受信"; diff --git a/QuickDrop/ko.lproj/Localizable.strings b/QuickDrop/ko.lproj/Localizable.strings index a45cef4..0749de2 100644 --- a/QuickDrop/ko.lproj/Localizable.strings +++ b/QuickDrop/ko.lproj/Localizable.strings @@ -64,6 +64,7 @@ "SaveFilesTo" = "수신 파일 저장 위치:"; "SaveFilesLocation" = "수신 파일 위치"; "SaveFilesToButton" = "선택…"; +"OpenFinderAfterReceiving" = "수신 후 Finder에서 파일 보기"; "DownloadsFolder" = "다운로드"; "SendFiles" = "파일 보내기"; "ReceiveFiles" = "파일 받기"; diff --git a/QuickDrop/nl.lproj/Localizable.strings b/QuickDrop/nl.lproj/Localizable.strings index 682836c..eb28cdd 100644 --- a/QuickDrop/nl.lproj/Localizable.strings +++ b/QuickDrop/nl.lproj/Localizable.strings @@ -65,6 +65,7 @@ "SaveFilesTo" = "Opslaan inkomende bestanden in:"; "SaveFilesLocation" = "Locatie van inkomende bestanden"; "SaveFilesToButton" = "Selecteren…"; +"OpenFinderAfterReceiving" = "Toon bestanden in Finder na ontvangst"; "DownloadsFolder" = "Downloads"; "SendFiles" = "Bestanden verzenden"; "ReceiveFiles" = "Bestanden ontvangen"; diff --git a/QuickDrop/pt-BR.lproj/Localizable.strings b/QuickDrop/pt-BR.lproj/Localizable.strings index 4762aa3..2873056 100644 --- a/QuickDrop/pt-BR.lproj/Localizable.strings +++ b/QuickDrop/pt-BR.lproj/Localizable.strings @@ -64,6 +64,7 @@ "SaveFilesTo" = "Salvar arquivos recebidos em:"; "SaveFilesLocation" = "Localização dos arquivos recebidos"; "SaveFilesToButton" = "Selecionar…"; +"OpenFinderAfterReceiving" = "Mostrar arquivos no Finder após o recebimento"; "DownloadsFolder" = "Downloads"; "SendFiles" = "Enviar arquivos"; "ReceiveFiles" = "Receber arquivos"; diff --git a/QuickDrop/pt-PT.lproj/Localizable.strings b/QuickDrop/pt-PT.lproj/Localizable.strings index 44489cf..d023cc4 100644 --- a/QuickDrop/pt-PT.lproj/Localizable.strings +++ b/QuickDrop/pt-PT.lproj/Localizable.strings @@ -64,6 +64,7 @@ "SaveFilesTo" = "Guardar ficheiros recebidos em:"; "SaveFilesLocation" = "Localização dos ficheiros recebidos"; "SaveFilesToButton" = "Selecionar…"; +"OpenFinderAfterReceiving" = "Mostrar ficheiros no Finder após a receção"; "DownloadsFolder" = "Transferências"; "SendFiles" = "Enviar ficheiros"; "ReceiveFiles" = "Receber ficheiros"; diff --git a/QuickDrop/ro.lproj/Localizable.strings b/QuickDrop/ro.lproj/Localizable.strings index 585326b..2b21f89 100644 --- a/QuickDrop/ro.lproj/Localizable.strings +++ b/QuickDrop/ro.lproj/Localizable.strings @@ -64,6 +64,7 @@ "SaveFilesTo" = "Salvează fișierele primite în:"; "SaveFilesLocation" = "Locația fișierelor primite"; "SaveFilesToButton" = "Selectează…"; +"OpenFinderAfterReceiving" = "Afișează fișierele în Finder după primire"; "DownloadsFolder" = "Descărcări"; "SendFiles" = "Trimite fișiere"; "ReceiveFiles" = "Primește fișiere"; diff --git a/QuickDrop/ru.lproj/Localizable.strings b/QuickDrop/ru.lproj/Localizable.strings index 0e3983d..d22fab9 100644 --- a/QuickDrop/ru.lproj/Localizable.strings +++ b/QuickDrop/ru.lproj/Localizable.strings @@ -65,6 +65,7 @@ "SaveFilesTo" = "Сохранять входящие файлы в:"; "SaveFilesLocation" = "Местоположение входящих файлов"; "SaveFilesToButton" = "Выбрать…"; +"OpenFinderAfterReceiving" = "Показать файлы в Finder после получения"; "DownloadsFolder" = "Загрузки"; "SendFiles" = "Отправить файлы"; "ReceiveFiles" = "Получить файлы"; diff --git a/QuickDrop/th.lproj/Localizable.strings b/QuickDrop/th.lproj/Localizable.strings index e68bae8..ccbba8b 100644 --- a/QuickDrop/th.lproj/Localizable.strings +++ b/QuickDrop/th.lproj/Localizable.strings @@ -64,6 +64,7 @@ "SaveFilesTo" = "บันทึกไฟล์ขาเข้าไปที่:"; "SaveFilesLocation" = "ตำแหน่งไฟล์ขาเข้า"; "SaveFilesToButton" = "เลือก…"; +"OpenFinderAfterReceiving" = "แสดงไฟล์ใน Finder หลังจากรับแล้ว"; "DownloadsFolder" = "ดาวน์โหลด"; "SendFiles" = "ส่งไฟล์"; "ReceiveFiles" = "รับไฟล์"; diff --git a/QuickDrop/uk.lproj/Localizable.strings b/QuickDrop/uk.lproj/Localizable.strings index a571957..37d5adf 100644 --- a/QuickDrop/uk.lproj/Localizable.strings +++ b/QuickDrop/uk.lproj/Localizable.strings @@ -64,6 +64,7 @@ "SaveFilesTo" = "Зберігати вхідні файли у:"; "SaveFilesLocation" = "Розташування вхідних файлів"; "SaveFilesToButton" = "Вибрати…"; +"OpenFinderAfterReceiving" = "Показати файли у Finder після отримання"; "DownloadsFolder" = "Завантаження"; "SendFiles" = "Надіслати файли"; "ReceiveFiles" = "Отримати файли"; diff --git a/QuickDrop/zh-Hans.lproj/Localizable.strings b/QuickDrop/zh-Hans.lproj/Localizable.strings index fbf9e99..777d39d 100644 --- a/QuickDrop/zh-Hans.lproj/Localizable.strings +++ b/QuickDrop/zh-Hans.lproj/Localizable.strings @@ -64,6 +64,7 @@ "SaveFilesTo" = "保存传入文件到:"; "SaveFilesLocation" = "传入文件位置"; "SaveFilesToButton" = "选择…"; +"OpenFinderAfterReceiving" = "接收后在访达中显示文件"; "DownloadsFolder" = "下载"; "SendFiles" = "发送文件"; "ReceiveFiles" = "接收文件";