mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-21 13:55:58 +00:00
Fix: iOS app advertised to scan even though not connected to Wi-Fi
This commit is contained in:
1 parent
5429126c1e
commit
f066a11608
4 files changed
+10
-9
No files matched your search
@@ -44,7 +44,7 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb
|
|||||||
public static let shared = NearbyConnectionManager()
|
public static let shared = NearbyConnectionManager()
|
||||||
|
|
||||||
@Published var attachments: AttachmentDetails? = nil
|
@Published var attachments: AttachmentDetails? = nil
|
||||||
@Published var hasLocalNetworkAccess = true
|
@Published var hasLocalNetworkPermission = true
|
||||||
@Published var isConnectedToLocalNetwork = true
|
@Published var isConnectedToLocalNetwork = true
|
||||||
|
|
||||||
public var connectionUpdateCallback: (Bool) -> Void = { _ in } {
|
public var connectionUpdateCallback: (Bool) -> Void = { _ in } {
|
||||||
@@ -248,13 +248,13 @@ public class NearbyConnectionManager: NSObject, NetServiceDelegate, InboundNearb
|
|||||||
log("[NearbyConnectionManager] Browser failed: \(error)")
|
log("[NearbyConnectionManager] Browser failed: \(error)")
|
||||||
case .ready:
|
case .ready:
|
||||||
log("[NearbyConnectionManager] Browser ready")
|
log("[NearbyConnectionManager] Browser ready")
|
||||||
self.hasLocalNetworkAccess = true
|
self.hasLocalNetworkPermission = true
|
||||||
case .waiting(let error):
|
case .waiting(let error):
|
||||||
log("[NearbyConnectionManager] Browser waiting: \(error)")
|
log("[NearbyConnectionManager] Browser waiting: \(error)")
|
||||||
|
|
||||||
if error == NWError.dns(DNSServiceErrorType(kDNSServiceErr_PolicyDenied)) {
|
if error == NWError.dns(DNSServiceErrorType(kDNSServiceErr_PolicyDenied)) {
|
||||||
log("[NearbyConnectionManager] Local network access not granted.")
|
log("[NearbyConnectionManager] Local network access not granted.")
|
||||||
self.hasLocalNetworkAccess = false
|
self.hasLocalNetworkPermission = false
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
"location" : "https://github.com/leonboe1/LUI.git",
|
"location" : "https://github.com/leonboe1/LUI.git",
|
||||||
"state" : {
|
"state" : {
|
||||||
"branch" : "main",
|
"branch" : "main",
|
||||||
"revision" : "85f746ee449d85a36722c3cafe9403525ef3a719"
|
"revision" : "2e656d5e3634e47f95f81af86a2a56080f05af88"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
"location" : "https://github.com/siteline/swiftui-introspect",
|
"location" : "https://github.com/siteline/swiftui-introspect",
|
||||||
"state" : {
|
"state" : {
|
||||||
"branch" : "main",
|
"branch" : "main",
|
||||||
"revision" : "9bedf1e79c7b7c34b35b74bef126f56d2400ef7f"
|
"revision" : "aa15494beb99fcc4c4248ea71928bd4fef947c87"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log("Application did finish launching")
|
log("[AppDelegate] Application did finish launching")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ struct DeviceListView: View {
|
|||||||
.padding(.top, 8)
|
.padding(.top, 8)
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
|
|
||||||
if !nearbyConnectionManager.hasLocalNetworkAccess {
|
if !nearbyConnectionManager.hasLocalNetworkPermission {
|
||||||
CardView(backgroundColor: .red, title: "NoNetworkAccess", titleSymbol: "network.slash") {
|
CardView(backgroundColor: .red, title: "NoNetworkAccess", titleSymbol: "network.slash") {
|
||||||
CardSubView(symbol: "exclamationmark.triangle.fill", text: "NoLocalNetworkAccessDescription")
|
CardSubView(symbol: "exclamationmark.triangle.fill", text: "NoLocalNetworkAccessDescription")
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ struct DeviceListView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if nearbyConnectionManager.hasLocalNetworkAccess && nearbyConnectionManager.hasLocalNetworkAccess {
|
if nearbyConnectionManager.hasLocalNetworkPermission && nearbyConnectionManager.isConnectedToLocalNetwork {
|
||||||
HStack(spacing: 8) {
|
HStack(spacing: 8) {
|
||||||
Text("SearchingForDevices")
|
Text("SearchingForDevices")
|
||||||
.font(.system(size: 14))
|
.font(.system(size: 14))
|
||||||
@@ -178,7 +178,8 @@ struct DeviceListView: View {
|
|||||||
NearbyConnectionManager.shared.stopDeviceDiscovery()
|
NearbyConnectionManager.shared.stopDeviceDiscovery()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.animation(.smooth, value: nearbyConnectionManager.hasLocalNetworkAccess)
|
.animation(.smooth, value: nearbyConnectionManager.hasLocalNetworkPermission)
|
||||||
|
.animation(.smooth, value: nearbyConnectionManager.isConnectedToLocalNetwork)
|
||||||
.navigationBarItems(trailing: ZStack {
|
.navigationBarItems(trailing: ZStack {
|
||||||
if isShareExtension() {
|
if isShareExtension() {
|
||||||
XButton(action: { NearbyConnectionManager.shared.attachments?.closeView?() })
|
XButton(action: { NearbyConnectionManager.shared.attachments?.closeView?() })
|
||||||
|
|||||||
Reference in new issue
Block a user