From 1256b91d4f211034a4173548957b861bde557369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6ttger?= Date: Sat, 15 Nov 2025 14:11:20 +0100 Subject: [PATCH] Refactoring --- .../Connection/InboundNearbyConnection.swift | 17 ++++++----------- .../xcshareddata/swiftpm/Package.resolved | 2 +- QuickDropiOS/Configuration.swift | 9 +++++++-- QuickDropiOS/View/ContentView.swift | 15 +++++++++++++-- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/NearbyShare/Connection/InboundNearbyConnection.swift b/NearbyShare/Connection/InboundNearbyConnection.swift index c585be5..0acaee6 100644 --- a/NearbyShare/Connection/InboundNearbyConnection.swift +++ b/NearbyShare/Connection/InboundNearbyConnection.swift @@ -537,8 +537,12 @@ class InboundNearbyConnection: NearbyConnection { } checkIfCanProceed(metadata: metadata) - } else { - rejectDueToUnsupportedFileType(frame) + } + else { + log("[InboundNearbyConnection \(self.id)] Rejecting transfer due to unsupported file type. Frame is \(frame.debugDescription)") + + lastError = NearbyError.canceled(reason: .unsupportedType) + rejectTransfer(with: .unsupportedAttachmentType) } @@ -558,15 +562,6 @@ class InboundNearbyConnection: NearbyConnection { } } - - func rejectDueToUnsupportedFileType(_ frame: Sharing_Nearby_Frame) { - - log("[InboundNearbyConnection \(self.id)] Rejecting transfer due to unsupported file type. Frame is \(frame.debugDescription)") - - lastError = NearbyError.canceled(reason: .unsupportedType) - rejectTransfer(with: .unsupportedAttachmentType) - } - func submitUserConsent(accepted: Bool, trustDevice: Bool) { if trustDevice, let peerCertificate = peerCertificate, let remoteDeviceInfo = remoteDeviceInfo { diff --git a/QuickDrop.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/QuickDrop.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a9e61e4..3c05d6e 100644 --- a/QuickDrop.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/QuickDrop.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -52,7 +52,7 @@ "location" : "https://github.com/leonboe1/LUI.git", "state" : { "branch" : "main", - "revision" : "0b862decf853e1f542eeab1f8d548f8ff629deca" + "revision" : "c971b0a42e299c6ad78e933db473342e11fd9456" } }, { diff --git a/QuickDropiOS/Configuration.swift b/QuickDropiOS/Configuration.swift index b55482e..b71f37a 100644 --- a/QuickDropiOS/Configuration.swift +++ b/QuickDropiOS/Configuration.swift @@ -6,13 +6,18 @@ // import LUI +import Foundation let configuration = LUIConfiguration( appName: "QuickDrop", - inAppPurchaseName: "plusversion", + plusVersionInfo: GetPlusViewInformation(lifetimeID: "plusversion", description: "plusview_description_phone", plusVersionFeatures: [], settingsLabelColor: .orange, settingsFooter: "plusview_footer_phone"), - plusVersionInfo: GetPlusViewInformation(description: "plusview_description_phone", plusVersionFeatures: [], settingsLabelColor: .orange, settingsFooter: "plusview_footer_phone"), + setPlusVersion: { result in + DispatchQueue.main.async { + Settings.shared.gotPlus = result + } + }, hasRoundedFont: false, diff --git a/QuickDropiOS/View/ContentView.swift b/QuickDropiOS/View/ContentView.swift index c6dd8c0..9837b8f 100644 --- a/QuickDropiOS/View/ContentView.swift +++ b/QuickDropiOS/View/ContentView.swift @@ -99,7 +99,18 @@ struct DeviceListView: View { } } - if sendModel.foundDevices.isEmpty { + var availableDevices: [RemoteDeviceInfo] { + var devices = sendModel.foundDevices + + if let selected = sendModel.selectedDevice, + !devices.contains(where: { $0.id == selected.id }) { + devices.append(selected) + } + + return devices + } + + if availableDevices.isEmpty { CustomSection(header: "NoDevicesFound") { @@ -127,7 +138,7 @@ struct DeviceListView: View { } else { CustomSection(header: "AvailableDevices") { - ForEach(sendModel.foundDevices) { device in + ForEach(availableDevices) { device in let isSelected = sendModel.selectedDevice == device