mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-22 14:26:01 +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 mdnsServices: [NetService] = []
|
||||||
private var incomingConnections: [String: InboundNearbyConnection] = [:]
|
private var incomingConnections: [String: InboundNearbyConnection] = [:]
|
||||||
private var foundServices: [String: FoundServiceInfo] = [:]
|
private var foundServices: [String: FoundServiceInfo] = [:]
|
||||||
private var shareExtensionDelegates: [ShareExtensionDelegate] = []
|
private var shareExtensionDelegates: [OutboundAppDelegate] = []
|
||||||
private var outgoingTransfers: [String: OutgoingTransferInfo] = [:]
|
private var outgoingTransfers: [String: OutgoingTransferInfo] = [:]
|
||||||
private var startedDeviceDiscovery = false
|
private var startedDeviceDiscovery = false
|
||||||
private var browsers: [NWBrowser] = []
|
private var browsers: [NWBrowser] = []
|
||||||
@@ -32,7 +32,7 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb
|
|||||||
private var qrCodeNameEncryptionKey: SymmetricKey?
|
private var qrCodeNameEncryptionKey: SymmetricKey?
|
||||||
|
|
||||||
public let endpointID: [UInt8] = generateEndpointID()
|
public let endpointID: [UInt8] = generateEndpointID()
|
||||||
public var mainAppDelegate: (any MainAppDelegate)?
|
public var mainAppDelegate: (any InboundAppDelegate)?
|
||||||
public static let shared = NearbyConnectionManager()
|
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)
|
shareExtensionDelegates.append(delegate)
|
||||||
for service in foundServices.values {
|
for service in foundServices.values {
|
||||||
guard let device = service.device else { continue }
|
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 })
|
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)")
|
log("Starting outgoing transfer to \(deviceID)")
|
||||||
guard let info = foundServices[deviceID] else { return }
|
guard let info = foundServices[deviceID] else { return }
|
||||||
|
|
||||||
@@ -448,6 +448,6 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb
|
|||||||
let service: NWBrowser.Result
|
let service: NWBrowser.Result
|
||||||
let device: RemoteDeviceInfo
|
let device: RemoteDeviceInfo
|
||||||
let connection: OutboundNearbyConnection
|
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 obtainUserConsent(for transfer: TransferMetadata, from device: RemoteDeviceInfo)
|
||||||
func connectionWasTerminated(from device: RemoteDeviceInfo, wasPlainTextTransfer: Bool, error: Error?)
|
func connectionWasTerminated(from device: RemoteDeviceInfo, wasPlainTextTransfer: Bool, error: Error?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public protocol ShareExtensionDelegate: AnyObject {
|
public protocol OutboundAppDelegate: AnyObject {
|
||||||
func addDevice(device: RemoteDeviceInfo)
|
func addDevice(device: RemoteDeviceInfo)
|
||||||
func removeDevice(id: String)
|
func removeDevice(id: String)
|
||||||
func startTransferWithQrCode(device: RemoteDeviceInfo)
|
func startTransferWithQrCode(device: RemoteDeviceInfo)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import SwiftUI
|
|||||||
import UserNotifications
|
import UserNotifications
|
||||||
|
|
||||||
@main
|
@main
|
||||||
class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDelegate, NSWindowDelegate, MainAppDelegate {
|
class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDelegate, NSWindowDelegate, InboundAppDelegate {
|
||||||
|
|
||||||
private var statusItem: NSStatusItem?
|
private var statusItem: NSStatusItem?
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
class ReceiveModel: ObservableObject, MainAppDelegate {
|
class ReceiveModel: ObservableObject, InboundAppDelegate {
|
||||||
|
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
class ShareViewModel: ObservableObject, ShareExtensionDelegate {
|
class ShareViewModel: ObservableObject, OutboundAppDelegate {
|
||||||
|
|
||||||
@Published var foundDevices: [RemoteDeviceInfo] = []
|
@Published var foundDevices: [RemoteDeviceInfo] = []
|
||||||
@Published var selectedDevice: RemoteDeviceInfo?
|
@Published var selectedDevice: RemoteDeviceInfo?
|
||||||
@@ -17,7 +17,6 @@ class ShareViewModel: ObservableObject, ShareExtensionDelegate {
|
|||||||
|
|
||||||
var urls: [URL] = []
|
var urls: [URL] = []
|
||||||
var textToSend: String? = nil
|
var textToSend: String? = nil
|
||||||
//private var errorAlertHandler = ErrorAlertHandler.shared
|
|
||||||
|
|
||||||
private var connectionEstablished = false
|
private var connectionEstablished = false
|
||||||
private var timeoutDispatchWorkItem: DispatchWorkItem? = nil
|
private var timeoutDispatchWorkItem: DispatchWorkItem? = nil
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import Foundation
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
import QRCode
|
import QRCode
|
||||||
|
|
||||||
class ShareViewController: NSViewController, ShareExtensionDelegate {
|
class ShareViewController: NSViewController, OutboundAppDelegate {
|
||||||
|
|
||||||
private var urls: [URL] = []
|
private var urls: [URL] = []
|
||||||
private var textToSend: String? = nil
|
private var textToSend: String? = nil
|
||||||
|
|||||||
Reference in new issue
Block a user