mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-20 05:16:02 +00:00
iOS: Localize local network access, add alert if no local network access
This commit is contained in:
1 parent
6087a274ad
commit
22e86bc4f5
23 files changed
+501
-29
No files matched your search
@@ -42,7 +42,7 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb
|
||||
public static let shared = NearbyConnectionManager()
|
||||
|
||||
@Published var attachments: AttachmentDetails? = nil
|
||||
|
||||
@Published var hasLocalNetworkAccess = true
|
||||
|
||||
override init() {
|
||||
#if os(macOS)
|
||||
@@ -206,6 +206,26 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
browser.stateUpdateHandler = { newState in
|
||||
switch newState {
|
||||
case .failed(let error):
|
||||
log("[NearbyConnectionManager] Browser failed: \(error)")
|
||||
case .ready:
|
||||
log("[NearbyConnectionManager] Browser ready")
|
||||
self.hasLocalNetworkAccess = true
|
||||
case .waiting(let error):
|
||||
log("[NearbyConnectionManager] Browser waiting: \(error)")
|
||||
|
||||
if error.errorCode == -65570 {
|
||||
log("[NearbyConnectionManager] Local network access not granted.")
|
||||
self.hasLocalNetworkAccess = false
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
browser.start(queue: .main)
|
||||
browsers.append(browser)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user