mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-11 02:51:11 +00:00
Toast view cancel all connections with xmark
This commit is contained in:
1 parent
0b94a888b5
commit
7e0a2e2830
2 files changed
+11
-5
No files matched your search
@@ -482,6 +482,13 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb
|
||||
}
|
||||
}
|
||||
|
||||
public func cancelAllIncomingConnections() {
|
||||
let incomingTransfers = Array(incomingConnections.values)
|
||||
for transfer in incomingTransfers {
|
||||
transfer.cancel()
|
||||
}
|
||||
}
|
||||
|
||||
private func endpointID(for service: NWBrowser.Result) -> String? {
|
||||
guard case let NWEndpoint.service(name: serviceName, type: _, domain: _, interface: _) = service.endpoint else { return nil }
|
||||
guard let nameData = Data.dataFromUrlSafeBase64(serviceName) else { return nil }
|
||||
|
||||
@@ -458,12 +458,11 @@ class ReceiveModel: ObservableObject, InboundAppDelegate {
|
||||
let contentView = QuickDropToastHostView(
|
||||
receiveModel: self,
|
||||
onCancel: { [weak self] in
|
||||
NearbyConnectionManager.shared.cancelTransfer(id: connectionID)
|
||||
guard let self else { return }
|
||||
self.processes.removeValue(forKey: connectionID)
|
||||
if self.processes.isEmpty {
|
||||
self.progress = nil
|
||||
}
|
||||
NearbyConnectionManager.shared.cancelAllIncomingConnections()
|
||||
|
||||
self.processes.removeAll()
|
||||
self.progress = nil
|
||||
self.toastActions = nil
|
||||
self.consentState = nil
|
||||
self.hideQuickDropToast(style: .fade)
|
||||
|
||||
Reference in new issue
Block a user