From 1ac988a4fcdee0b24ba8b56ed50c94738c37b648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6ttger?= Date: Mon, 6 Oct 2025 19:42:06 +0200 Subject: [PATCH] Add progress notification when receiving files --- NearbyShare/Connection/NearbyConnection.swift | 13 ++ .../Connection/NearbyConnectionManager.swift | 15 +- .../Connection/OutboundNearbyConnection.swift | 13 -- NearbyShare/Model/DataModel.swift | 2 +- QuickDrop.xcodeproj/project.pbxproj | 12 +- QuickDrop/View/QuickDropToastView.swift | 139 +++++++++++++++++ QuickDropiOS/FilePicker.swift | 4 +- QuickDropiOS/ReceiveModel.swift | 143 +++++++++++++++--- QuickDropiOS/SendModel.swift | 4 +- QuickDropiOS/UIAlert.swift | 13 +- ShareExtension/ShareViewController.swift | 2 +- 11 files changed, 308 insertions(+), 52 deletions(-) create mode 100644 QuickDrop/View/QuickDropToastView.swift diff --git a/NearbyShare/Connection/NearbyConnection.swift b/NearbyShare/Connection/NearbyConnection.swift index 981bac2..ecb9bcb 100644 --- a/NearbyShare/Connection/NearbyConnection.swift +++ b/NearbyShare/Connection/NearbyConnection.swift @@ -521,6 +521,19 @@ class NearbyConnection { } + func cancel() { + cancelled = true + if encryptionDone { + var cancel = Sharing_Nearby_Frame() + cancel.version = .v1 + cancel.v1 = Sharing_Nearby_V1Frame() + cancel.v1.type = .cancel + try? sendTransferSetupFrame(cancel) + } + try? sendDisconnectionAndDisconnect() + } + + func disconnect() { log("[NearbyConnection \(self.id)] Disconnecting from connection.") diff --git a/NearbyShare/Connection/NearbyConnectionManager.swift b/NearbyShare/Connection/NearbyConnectionManager.swift index 3586fd9..fe59347 100644 --- a/NearbyShare/Connection/NearbyConnectionManager.swift +++ b/NearbyShare/Connection/NearbyConnectionManager.swift @@ -123,7 +123,7 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb public func becomeInvisible() { if !startedAdvertising { - print("[NearbyConnectionManager] Already invisible, ignoring becomeInvisible()") + log("[NearbyConnectionManager] Already invisible, ignoring becomeInvisible()") return } @@ -205,7 +205,7 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb func updatedTransferProgress(connection: InboundNearbyConnection, progress: Double) { - mainAppDelegate?.transferProgress(progress: progress) + mainAppDelegate?.transferProgress(connectionID: connection.id, progress: progress) } @@ -308,9 +308,14 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb } - public func cancelOutgoingTransfer(id: String) { - guard let transfer = outgoingTransfers[id] else { return } - transfer.connection.cancel() + public func cancelTransfer(id: String) { + + if let transfer = incomingConnections[id] { + transfer.cancel() + } + if let transfer = outgoingTransfers[id] { + transfer.connection.cancel() + } } diff --git a/NearbyShare/Connection/OutboundNearbyConnection.swift b/NearbyShare/Connection/OutboundNearbyConnection.swift index 3f3479c..7a47786 100644 --- a/NearbyShare/Connection/OutboundNearbyConnection.swift +++ b/NearbyShare/Connection/OutboundNearbyConnection.swift @@ -68,19 +68,6 @@ class OutboundNearbyConnection: NearbyConnection { } } } - - - public func cancel() { - cancelled = true - if encryptionDone { - var cancel = Sharing_Nearby_Frame() - cancel.version = .v1 - cancel.v1 = Sharing_Nearby_V1Frame() - cancel.v1.type = .cancel - try? sendTransferSetupFrame(cancel) - } - try? sendDisconnectionAndDisconnect() - } override func connectionReady() { diff --git a/NearbyShare/Model/DataModel.swift b/NearbyShare/Model/DataModel.swift index aa2f9f5..8942d94 100644 --- a/NearbyShare/Model/DataModel.swift +++ b/NearbyShare/Model/DataModel.swift @@ -30,7 +30,7 @@ protocol OutboundNearbyConnectionDelegate { public protocol InboundAppDelegate: AnyObject { func obtainUserConsent(transfer: TransferMetadata, device: RemoteDeviceInfo, acceptAutomatically: Bool) func connectionWasTerminated(from device: RemoteDeviceInfo, wasPlainTextTransfer: Bool, error: Error?) - func transferProgress(progress: Double) + func transferProgress(connectionID: String, progress: Double) } diff --git a/QuickDrop.xcodeproj/project.pbxproj b/QuickDrop.xcodeproj/project.pbxproj index dfd58a9..dcf7236 100644 --- a/QuickDrop.xcodeproj/project.pbxproj +++ b/QuickDrop.xcodeproj/project.pbxproj @@ -123,6 +123,7 @@ EB7F54142D78E9E700989564 /* LicenseWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB7F54132D78E9E400989564 /* LicenseWindow.swift */; }; EB821C992E76FE5300036963 /* SmallSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB96ED8A2D7F7CF4004B3FF1 /* SmallSheetView.swift */; }; EB821C9A2E76FE5300036963 /* SmallSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB96ED8A2D7F7CF4004B3FF1 /* SmallSheetView.swift */; }; + EB869DB52E92AA3A009AAAD4 /* QuickDropToastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB869DB42E92AA33009AAAD4 /* QuickDropToastView.swift */; }; EB886E522E4E19390052B7D9 /* HKDF.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB886E512E4E19390052B7D9 /* HKDF.swift */; }; EB886E532E4E19390052B7D9 /* HKDF.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB886E512E4E19390052B7D9 /* HKDF.swift */; }; EB886E542E4E19390052B7D9 /* HKDF.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB886E512E4E19390052B7D9 /* HKDF.swift */; }; @@ -341,6 +342,7 @@ EB7CD1442D6FB0C100CB0CB5 /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = ""; }; EB7F54112D78E95C00989564 /* TutorialView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TutorialView.swift; sourceTree = ""; }; EB7F54132D78E9E400989564 /* LicenseWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LicenseWindow.swift; sourceTree = ""; }; + EB869DB42E92AA33009AAAD4 /* QuickDropToastView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickDropToastView.swift; sourceTree = ""; }; EB886E512E4E19390052B7D9 /* HKDF.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HKDF.swift; sourceTree = ""; }; EB886E662E4F2F7C0052B7D9 /* License.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = License.swift; sourceTree = ""; }; EB950B2D2E52027F002D68FA /* iOSShareExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = iOSShareExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -605,6 +607,7 @@ EBD2A2162D2860BE00BCB8E2 /* WelcomeScreen.swift */, EB7F54112D78E95C00989564 /* TutorialView.swift */, EB7F54132D78E9E400989564 /* LicenseWindow.swift */, + EB869DB42E92AA33009AAAD4 /* QuickDropToastView.swift */, EB05DFBD2E59FC8000EF567A /* TrustedDevicesView.swift */, EB6F62D62D91F4AC00534EC2 /* SettingsView.swift */, EBC05C812E33B58300EECC18 /* IssueViews */, @@ -938,6 +941,7 @@ EB3643602D73A2A2009CDFF8 /* AudioManager.swift in Sources */, EB5C38412E38C49D0052EFD7 /* LaunchAtLogin.swift in Sources */, EB5C37B82E377A6F0052EFD7 /* SleepManager.swift in Sources */, + EB869DB52E92AA3A009AAAD4 /* QuickDropToastView.swift in Sources */, EB5C37B92E377A6F0052EFD7 /* SaveFilesManager.swift in Sources */, EB5C37BA2E377A6F0052EFD7 /* Helpers.swift in Sources */, EB05DFBE2E59FC8900EF567A /* TrustedDevicesView.swift in Sources */, @@ -1239,8 +1243,8 @@ MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; - SHARED_BUILD = 76; - SHARED_VERSION = 2.4.2; + SHARED_BUILD = 77; + SHARED_VERSION = 2.4.3; STRING_CATALOG_GENERATE_SYMBOLS = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_EMIT_LOC_STRINGS = YES; @@ -1302,8 +1306,8 @@ MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = macosx; - SHARED_BUILD = 76; - SHARED_VERSION = 2.4.2; + SHARED_BUILD = 77; + SHARED_VERSION = 2.4.3; STRING_CATALOG_GENERATE_SYMBOLS = YES; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_EMIT_LOC_STRINGS = YES; diff --git a/QuickDrop/View/QuickDropToastView.swift b/QuickDrop/View/QuickDropToastView.swift new file mode 100644 index 0000000..50efa6c --- /dev/null +++ b/QuickDrop/View/QuickDropToastView.swift @@ -0,0 +1,139 @@ +// +// IncomingFileTransmissionView.swift +// QuickDrop +// +// Created by Leon Böttger on 05.10.25. +// + +import SwiftUI +import AppKit + + +let toastViewSize = CGSize(width: 400, height: 100) + +struct QuickDropToastView: View { + @ObservedObject var settings = Settings.shared + @ObservedObject var receiveModel: ReceiveModel + public var onCancel: () -> Void = {} + + init(receiveModel: ReceiveModel, + onCancel: @escaping () -> Void = {}) { + self.receiveModel = receiveModel + self.onCancel = onCancel + } + + public var body: some View { + VStack(spacing: 12) { + HStack(spacing: 12) { + ZStack(alignment: .bottomLeading) { + Image(.quickDropIcon) + .resizable() + .scaledToFill() + .frame(width: 44, height: 44) + .clipShape(Circle()) + } + + VStack(alignment: .leading, spacing: 2) { + Text(String("QuickDrop")) + .font(.system(size: 16, weight: .semibold)) + Text("Receiving") + .font(.system(size: 13)) + .foregroundColor(.secondary) + .lineLimit(1) + .truncationMode(.tail) + } + + Spacer(minLength: 12) + } + + HStack() { + + CapsuleProgress(value: receiveModel.progress ?? 1.0) + + Button(action: onCancel) { + Image(systemName: "xmark") + .font(.system(size: 10, weight: .semibold)) + .foregroundColor(.secondary) + .frame(width: 18, height: 18) + .background( + VisualEffectView(material: .hudWindow) + .clipShape(Circle()) + ) + } + .buttonStyle(PlainButtonStyle()) + } + } + .padding(16) + .background( + VisualEffectView(material: .hudWindow) + .clipShape(RoundedRectangle(cornerRadius: 16, style: .continuous)) + ) + .overlay( + RoundedRectangle(cornerRadius: 16, style: .continuous) + .stroke(Color.black.opacity(0.06), lineWidth: 1) + ) + .shadow(color: Color.black.opacity(0.12), radius: 20) + .frame(maxWidth: .infinity) + .opacity(isFileTransferRestricted() ? 0 : 1) + } +} + + +// NSVisualEffectView wrapper for macOS 11 compatible blur/vibrancy +struct VisualEffectView: NSViewRepresentable { + var material: NSVisualEffectView.Material = .hudWindow + var blendingMode: NSVisualEffectView.BlendingMode = .withinWindow + var state: NSVisualEffectView.State = .active + + func makeNSView(context: Context) -> NSVisualEffectView { + let v = NSVisualEffectView() + v.material = material + v.blendingMode = blendingMode + v.state = state + v.isEmphasized = true + return v + } + + func updateNSView(_ v: NSVisualEffectView, context: Context) { + v.material = material + v.blendingMode = blendingMode + v.state = state + } +} + + +// Capsule-style linear progress (0...1) +struct CapsuleProgress: View { + var value: Double + var track = Color(NSColor.separatorColor).opacity(0.28) + var fill = Color(NSColor.systemBlue) + + var body: some View { + GeometryReader { geo in + ZStack(alignment: .leading) { + Capsule().fill(track) + Capsule() + .fill(fill) + .frame(width: max(0, min(1, value)) * geo.size.width) + } + } + .frame(height: 8) + .animation(.easeInOut(duration: 0.25), value: value) + } +} + + +// MARK: - Preview +struct QuickDropToastView_Previews: PreviewProvider { + struct Demo: View { + var body: some View { + QuickDropToastView( + receiveModel: ReceiveModel(), + onCancel: { } + ) + .padding() + .frame(width: toastViewSize.width, height: toastViewSize.height) + } + } + static var previews: some View { Demo() } +} diff --git a/QuickDropiOS/FilePicker.swift b/QuickDropiOS/FilePicker.swift index a15d3a6..03b2230 100644 --- a/QuickDropiOS/FilePicker.swift +++ b/QuickDropiOS/FilePicker.swift @@ -162,10 +162,10 @@ fileprivate struct DataUrl: Transferable { .cornerRadius(8) } onResult: { urls, text in if let urls = urls { - print("Selected URLs: \(urls)") + log("Selected URLs: \(urls)") } if let text = text { - print("Clipboard text: \(text)") + log("Clipboard text: \(text)") } } } diff --git a/QuickDropiOS/ReceiveModel.swift b/QuickDropiOS/ReceiveModel.swift index d48dc9a..20c75a8 100644 --- a/QuickDropiOS/ReceiveModel.swift +++ b/QuickDropiOS/ReceiveModel.swift @@ -17,6 +17,12 @@ import LUI class ReceiveModel: ObservableObject, InboundAppDelegate { + #if os(macOS) + @Published var progress: Double? = nil + private var toastWindow: NSWindow? + private var toastHosting: NSHostingView? + #endif + let controlPlusScreen: (Bool) -> Void init(controlPlusScreen: @escaping (Bool) -> Void = { _ in }) { @@ -34,7 +40,7 @@ class ReceiveModel: ObservableObject, InboundAppDelegate { #endif let fileStr: String - + if let textTitle = transfer.textDescription { fileStr = textTitle } else if transfer.files.count == 1 { @@ -72,25 +78,28 @@ class ReceiveModel: ObservableObject, InboundAppDelegate { if acceptAutomatically && isMac { pressAcceptButton(transferID: transfer.id, trustDevice: false) - UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound]) { granted, _ in - if granted { - log("[ReceiveModel] User granted notification permissions") - - let notificationContent = UNMutableNotificationContent() - notificationContent.title = "QuickDrop" - notificationContent.body = mainMessage - notificationContent.sound = nil - let notificationId = UUID().uuidString - - let notificationReq = UNNotificationRequest(identifier: notificationId, content: notificationContent, trigger: nil) - UNUserNotificationCenter.current().add(notificationReq) - - DispatchQueue.main.asyncAfter(deadline: .now() + 5) { - UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: [notificationId]) + if transfer.type != .file { + UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound]) { granted, _ in + if granted { + log("[ReceiveModel] User granted notification permissions") + + let notificationContent = UNMutableNotificationContent() + notificationContent.title = "QuickDrop" + notificationContent.body = mainMessage + notificationContent.sound = nil + let notificationId = UUID().uuidString + + let notificationReq = UNNotificationRequest(identifier: notificationId, content: notificationContent, trigger: nil) + UNUserNotificationCenter.current().add(notificationReq) + + DispatchQueue.main.asyncAfter(deadline: .now() + 5) { + UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: [notificationId]) + } } } } - } else { + } + else { let title = "QuickDrop - \(pinCodeMessage)" let primaryButtonTitle = "Accept".localized() @@ -132,15 +141,23 @@ class ReceiveModel: ObservableObject, InboundAppDelegate { case .Decline: secondaryButtonAction() } + } onCancel: { + NearbyConnectionManager.shared.cancelTransfer(id: transferID) } #endif } } - func transferProgress(progress: Double) { + func transferProgress(connectionID: String, progress: Double) { + #if os(iOS) ProgressAlert.shared.updateProgress(progress) + #else + DispatchQueue.main.async { + self.progress = progress + self.showQuickDropToast(for: connectionID) + } #endif } @@ -148,6 +165,10 @@ class ReceiveModel: ObservableObject, InboundAppDelegate { func connectionWasTerminated(from device: RemoteDeviceInfo, wasPlainTextTransfer: Bool, error: (any Error)?) { #if os(macOS) + DispatchQueue.main.async { + self.hideQuickDropToast() + self.progress = nil + } finish() #else ProgressAlert.shared.updateProgress(nil) { @@ -209,4 +230,90 @@ class ReceiveModel: ObservableObject, InboundAppDelegate { NearbyConnectionManager.shared.submitUserConsent(transferID: transferID, accept: true, trustDevice: trustDevice, storeInTemp: false) } } + + + // MARK: - macOS Progress Overlay + + #if os(macOS) + func showQuickDropToast(for connectionID: String) { + guard toastWindow == nil else { return } + + let contentView = QuickDropToastView( + receiveModel: self, + onCancel: { + NearbyConnectionManager.shared.cancelTransfer(id: connectionID) + } + ) + + let hostingView = NSHostingView(rootView: contentView) + hostingView.frame.size = toastViewSize + + // Prefer the screen under the mouse, then the key window’s screen, then main + let screen = NSScreen.screens.first { $0.frame.contains(NSEvent.mouseLocation) } + ?? NSApp.keyWindow?.screen + ?? NSScreen.main + + guard let screen else { return } + + let frame = screen.frame + let visible = screen.visibleFrame + + let marginX: CGFloat = 24 + let marginFromTop: CGFloat = 30 + + // If the menu bar is auto-hidden, visible.maxY == frame.maxY; subtract the status bar thickness to stay clear + let menuBarHidden = abs(frame.maxY - visible.maxY) < 0.5 + let extraTopInset = menuBarHidden ? NSStatusBar.system.thickness : 0 + + let targetX = visible.maxX - toastViewSize.width - marginX + let targetY = visible.maxY - toastViewSize.height - marginFromTop - extraTopInset + + // Start slightly above the final spot for a smooth slide-in + let startY = min(frame.maxY + 10, targetY + 10) + let startFrame = CGRect(x: targetX, y: startY, width: toastViewSize.width, height: toastViewSize.height) + + let window = NSWindow(contentRect: startFrame, + styleMask: [.borderless], + backing: .buffered, + defer: false) + window.isOpaque = false + window.backgroundColor = .clear + window.hasShadow = true + window.level = .statusBar + window.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary] + window.contentView = hostingView + window.ignoresMouseEvents = false + window.alphaValue = 0 + window.makeKeyAndOrderFront(nil) + + self.toastWindow = window + self.toastHosting = hostingView + + NSAnimationContext.runAnimationGroup { ctx in + ctx.duration = 0.35 + ctx.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) + window.animator().setFrameOrigin(CGPoint(x: targetX, y: targetY)) + window.animator().alphaValue = 1 + } + } + + + func hideQuickDropToast() { + guard let window = toastWindow, + let screen = NSScreen.main else { return } + + let offscreenY = screen.visibleFrame.origin.y + screen.visibleFrame.height + 20 + + NSAnimationContext.runAnimationGroup({ ctx in + ctx.duration = 0.35 + ctx.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) + window.animator().setFrameOrigin(CGPoint(x: window.frame.origin.x, y: offscreenY)) + window.animator().alphaValue = 0 + }, completionHandler: { + window.orderOut(nil) + self.toastWindow = nil + self.toastHosting = nil + }) + } + #endif } diff --git a/QuickDropiOS/SendModel.swift b/QuickDropiOS/SendModel.swift index b4d6cd9..67d4e6f 100644 --- a/QuickDropiOS/SendModel.swift +++ b/QuickDropiOS/SendModel.swift @@ -60,7 +60,7 @@ class SendModel: ObservableObject, OutboundAppDelegate { errorVibration() #endif - ErrorAlertHandler.shared.showErrorAlert(for: selectedDevice?.name ?? "?", error: error) + ErrorAlertHandler.shared.showErrorAlert(for: selectedDevice?.name ?? "UnknownDevice".localized(), error: error) progressValue = nil selectedDevice = nil @@ -116,7 +116,7 @@ class SendModel: ObservableObject, OutboundAppDelegate { progressValue = 0 progressState = nil selectedDevice = nil - NearbyConnectionManager.shared.cancelOutgoingTransfer(id: device.id!) + NearbyConnectionManager.shared.cancelTransfer(id: device.id!) } else { diff --git a/QuickDropiOS/UIAlert.swift b/QuickDropiOS/UIAlert.swift index dfe33b5..8fb36c0 100644 --- a/QuickDropiOS/UIAlert.swift +++ b/QuickDropiOS/UIAlert.swift @@ -18,12 +18,12 @@ final class ProgressAlert { private weak var progressView: UIProgressView? // MARK: - Initial Accept / Decline - func askForUserPermission(title: String, message: String, acceptLabel: String, acceptAlwaysLabel: String?, rejectLabel: String, acceptAutomatically: Bool, onAccept: @escaping (AcceptAction) -> Void) { + func askForUserPermission(title: String, message: String, acceptLabel: String, acceptAlwaysLabel: String?, rejectLabel: String, acceptAutomatically: Bool, onAccept: @escaping (AcceptAction) -> Void, onCancel: @escaping () -> Void) { guard let vc = topMostViewController() else { return } if acceptAutomatically { onAccept(.Accept) - self.showProgressAlert(on: vc) + self.showProgressAlert(on: vc, onCancel: onCancel) } else { @@ -37,13 +37,13 @@ final class ProgressAlert { alert.addAction(UIAlertAction(title: acceptLabel, style: .default, handler: { _ in onAccept(.Accept) - self.showProgressAlert(on: vc) + self.showProgressAlert(on: vc, onCancel: onCancel) })) if let acceptAlways = acceptAlwaysLabel { alert.addAction(UIAlertAction(title: acceptAlways, style: .default, handler: { _ in onAccept(.AcceptAlways) - self.showProgressAlert(on: vc) + self.showProgressAlert(on: vc, onCancel: onCancel) })) } @@ -52,7 +52,7 @@ final class ProgressAlert { } // MARK: - Progress Alert - private func showProgressAlert(on vc: UIViewController) { + private func showProgressAlert(on vc: UIViewController, onCancel: @escaping () -> Void) { let alert = UIAlertController(title: "Receiving".localized(), message: "\n\n", preferredStyle: .alert) @@ -67,7 +67,8 @@ final class ProgressAlert { ]) let cancel = UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: { _ in - print("Cancel during progress") + log("Cancel during progress") + onCancel() }) alert.addAction(cancel) diff --git a/ShareExtension/ShareViewController.swift b/ShareExtension/ShareViewController.swift index aaf9ca0..e75f673 100644 --- a/ShareExtension/ShareViewController.swift +++ b/ShareExtension/ShareViewController.swift @@ -117,7 +117,7 @@ class ShareViewController: NSViewController, OutboundAppDelegate { @IBAction func cancel(_: AnyObject?) { if let device = chosenDevice { - NearbyConnectionManager.shared.cancelOutgoingTransfer(id: device.id!) + NearbyConnectionManager.shared.cancelTransfer(id: device.id!) } let cancelError = NSError(domain: NSCocoaErrorDomain, code: NSUserCancelledError, userInfo: nil) extensionContext!.cancelRequest(withError: cancelError)