mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-11 02:51:11 +00:00
Fix iOS compiling
This commit is contained in:
1 parent
3fffa562ce
commit
608ab41c0b
6 files changed
+12
-13
No files matched your search
@@ -22,7 +22,7 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb
|
||||
private var mdnsServices: [NetService] = []
|
||||
private var incomingConnections: [String: InboundNearbyConnection] = [:]
|
||||
private var foundServices: [String: FoundServiceInfo] = [:]
|
||||
private var shareExtensionDelegates: [ShareExtensionDelegate] = []
|
||||
private var shareExtensionDelegates: [OutboundAppDelegate] = []
|
||||
private var outgoingTransfers: [String: OutgoingTransferInfo] = [:]
|
||||
private var startedDeviceDiscovery = false
|
||||
private var browsers: [NWBrowser] = []
|
||||
@@ -32,7 +32,7 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb
|
||||
private var qrCodeNameEncryptionKey: SymmetricKey?
|
||||
|
||||
public let endpointID: [UInt8] = generateEndpointID()
|
||||
public var mainAppDelegate: (any MainAppDelegate)?
|
||||
public var mainAppDelegate: (any InboundAppDelegate)?
|
||||
public static let shared = NearbyConnectionManager()
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb
|
||||
}
|
||||
|
||||
|
||||
public func addShareExtensionDelegate(_ delegate: ShareExtensionDelegate) {
|
||||
public func addShareExtensionDelegate(_ delegate: OutboundAppDelegate) {
|
||||
shareExtensionDelegates.append(delegate)
|
||||
for service in foundServices.values {
|
||||
guard let device = service.device else { continue }
|
||||
@@ -202,7 +202,7 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb
|
||||
}
|
||||
|
||||
|
||||
public func removeShareExtensionDelegate(_ delegate: ShareExtensionDelegate) {
|
||||
public func removeShareExtensionDelegate(_ delegate: OutboundAppDelegate) {
|
||||
shareExtensionDelegates.removeAll(where: { $0 === delegate })
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb
|
||||
}
|
||||
|
||||
|
||||
public func startOutgoingTransfer(deviceID: String, delegate: ShareExtensionDelegate, urls: [URL], textToSend: String?) {
|
||||
public func startOutgoingTransfer(deviceID: String, delegate: OutboundAppDelegate, urls: [URL], textToSend: String?) {
|
||||
log("Starting outgoing transfer to \(deviceID)")
|
||||
guard let info = foundServices[deviceID] else { return }
|
||||
|
||||
@@ -448,6 +448,6 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb
|
||||
let service: NWBrowser.Result
|
||||
let device: RemoteDeviceInfo
|
||||
let connection: OutboundNearbyConnection
|
||||
let delegate: ShareExtensionDelegate
|
||||
let delegate: OutboundAppDelegate
|
||||
}
|
||||
}
|
||||
@@ -26,13 +26,13 @@ protocol OutboundNearbyConnectionDelegate {
|
||||
}
|
||||
|
||||
|
||||
public protocol MainAppDelegate {
|
||||
public protocol InboundAppDelegate: AnyObject {
|
||||
func obtainUserConsent(for transfer: TransferMetadata, from device: RemoteDeviceInfo)
|
||||
func connectionWasTerminated(from device: RemoteDeviceInfo, wasPlainTextTransfer: Bool, error: Error?)
|
||||
}
|
||||
|
||||
|
||||
public protocol ShareExtensionDelegate: AnyObject {
|
||||
public protocol OutboundAppDelegate: AnyObject {
|
||||
func addDevice(device: RemoteDeviceInfo)
|
||||
func removeDevice(id: String)
|
||||
func startTransferWithQrCode(device: RemoteDeviceInfo)
|
||||
|
||||
@@ -14,7 +14,7 @@ import SwiftUI
|
||||
import UserNotifications
|
||||
|
||||
@main
|
||||
class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDelegate, NSWindowDelegate, MainAppDelegate {
|
||||
class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDelegate, NSWindowDelegate, InboundAppDelegate {
|
||||
|
||||
private var statusItem: NSStatusItem?
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
class ReceiveModel: ObservableObject, MainAppDelegate {
|
||||
class ReceiveModel: ObservableObject, InboundAppDelegate {
|
||||
|
||||
|
||||
init() {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
class ShareViewModel: ObservableObject, ShareExtensionDelegate {
|
||||
class ShareViewModel: ObservableObject, OutboundAppDelegate {
|
||||
|
||||
@Published var foundDevices: [RemoteDeviceInfo] = []
|
||||
@Published var selectedDevice: RemoteDeviceInfo?
|
||||
@@ -17,7 +17,6 @@ class ShareViewModel: ObservableObject, ShareExtensionDelegate {
|
||||
|
||||
var urls: [URL] = []
|
||||
var textToSend: String? = nil
|
||||
//private var errorAlertHandler = ErrorAlertHandler.shared
|
||||
|
||||
private var connectionEstablished = false
|
||||
private var timeoutDispatchWorkItem: DispatchWorkItem? = nil
|
||||
|
||||
@@ -10,7 +10,7 @@ import Foundation
|
||||
import SwiftUI
|
||||
import QRCode
|
||||
|
||||
class ShareViewController: NSViewController, ShareExtensionDelegate {
|
||||
class ShareViewController: NSViewController, OutboundAppDelegate {
|
||||
|
||||
private var urls: [URL] = []
|
||||
private var textToSend: String? = nil
|
||||
|
||||
Reference in new issue
Block a user