mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-21 13:55:58 +00:00
Re-enable automatic AP isolation checker
This commit is contained in:
1 parent
7c18c73c82
commit
bf6093e299
4 files changed
+69
-43
No files matched your search
@@ -13,12 +13,38 @@ import Network
|
||||
struct ApIsolationIssueView: View {
|
||||
|
||||
@Environment(\.colorScheme) var colorScheme
|
||||
let closeView : () -> Void
|
||||
|
||||
let scanner = DeviceToDeviceHeuristicScanner()
|
||||
|
||||
var body: some View {
|
||||
|
||||
IssueView(image: .router, header: "ApIsolationHeader".localized(), description: "ApIsolationDescription".localized(), actionLabel: "ApIsolationAction".localized()) {
|
||||
await openRouterSettingsPage()
|
||||
}
|
||||
.onAppear {
|
||||
checkIfApIsolationStillEnabled()
|
||||
}
|
||||
}
|
||||
|
||||
func checkIfApIsolationStillEnabled() {
|
||||
scanner.scan { isConnectionAllowed in
|
||||
if isConnectionAllowed {
|
||||
|
||||
log("AP Isolation is no longer enabled. Exiting...")
|
||||
|
||||
DispatchQueue.main.async {
|
||||
closeView()
|
||||
}
|
||||
}
|
||||
else {
|
||||
log("AP Isolation is still enabled. Checking again in 10 seconds...")
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
|
||||
checkIfApIsolationStillEnabled()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +147,7 @@ func isHostReachable(_ host: String) -> Bool {
|
||||
|
||||
|
||||
#Preview {
|
||||
ApIsolationIssueView()
|
||||
ApIsolationIssueView(closeView: {})
|
||||
.frame(width: issueViewWidth, height: issueViewHeight)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user