From ce77e7342847f3ffe0b205c91b90332568b4d609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6ttger?= Date: Fri, 4 Apr 2025 20:26:09 +0200 Subject: [PATCH] Refactoring --- NearDrop/AppDelegate.swift | 2 +- NearbyShare/InboundNearbyConnection.swift | 14 +------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/NearDrop/AppDelegate.swift b/NearDrop/AppDelegate.swift index b5e3a65..1dd16df 100644 --- a/NearDrop/AppDelegate.swift +++ b/NearDrop/AppDelegate.swift @@ -282,7 +282,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele private func pressAcceptButton(transferID: String) { - if true || (!isPlusVersion() && transmissionCount() > 0) { + if false || (!isPlusVersion() && transmissionCount() > 0) { self.continueTransmission(accept: true, transferID: transferID, storeInTemp: true) log("Showing plus screen...") diff --git a/NearbyShare/InboundNearbyConnection.swift b/NearbyShare/InboundNearbyConnection.swift index b3e371b..5ef9686 100644 --- a/NearbyShare/InboundNearbyConnection.swift +++ b/NearbyShare/InboundNearbyConnection.swift @@ -471,24 +471,12 @@ public class SaveFilesManager { for file in files { let fileName = file.lastPathComponent - var destinationURL = target.appendingPathComponent(fileName) + let destinationURL = target.appendingPathComponent(fileName) if !filesFinishedDownloading.contains(destinationURL) { log("File \(file) not finished downloading, skipping") - log("Pending files: \(filesFinishedDownloading)") continue } - - var counter = 1 - let fileExtension = destinationURL.pathExtension - let baseName = destinationURL.deletingPathExtension().lastPathComponent - - while fileManager.fileExists(atPath: destinationURL.path) { - let newFileName = "\(baseName)-\(counter)" - let newFileNameWithExtension = fileExtension.isEmpty ? newFileName : "\(newFileName).\(fileExtension)" - destinationURL = target.appendingPathComponent(newFileNameWithExtension) - counter += 1 - } log("Moving file: \(file.lastPathComponent) to \(destinationURL.lastPathComponent)") try fileManager.copyItem(at: file, to: destinationURL)