mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-21 13:55:58 +00:00
Ap Isolation check only when opening troubleshooting
This commit is contained in:
1 parent
3ccb41ae0f
commit
711519ded5
5 files changed
+67
-93
No files matched your search
@@ -825,7 +825,7 @@
|
|||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SHARED_BUILD = 37;
|
SHARED_BUILD = 38;
|
||||||
SHARED_VERSION = 1.9;
|
SHARED_VERSION = 1.9;
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
@@ -884,7 +884,7 @@
|
|||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SHARED_BUILD = 37;
|
SHARED_BUILD = 38;
|
||||||
SHARED_VERSION = 1.9;
|
SHARED_VERSION = 1.9;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
language = "en"
|
||||||
launchStyle = "0"
|
launchStyle = "0"
|
||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
|||||||
@@ -93,30 +93,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
}
|
}
|
||||||
|
|
||||||
UNUserNotificationCenter.current().delegate = self
|
UNUserNotificationCenter.current().delegate = self
|
||||||
|
|
||||||
let monitor = NWPathMonitor()
|
|
||||||
monitor.pathUpdateHandler = { path in
|
|
||||||
if path.status == .satisfied {
|
|
||||||
if path.supportsIPv4 && !path.supportsIPv6 {
|
|
||||||
log("Detected IPv4-only network.")
|
|
||||||
self.performDeviceToDeviceCheck()
|
|
||||||
} else if !path.supportsIPv4 && path.supportsIPv6 {
|
|
||||||
log("IPv6-only network, likely iPhone hotspot. Skipping device-to-device check.")
|
|
||||||
} else if path.supportsIPv4 && path.supportsIPv6 {
|
|
||||||
log("Detected Dual stack network.")
|
|
||||||
self.performDeviceToDeviceCheck()
|
|
||||||
} else {
|
|
||||||
log("Detected no IP support")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log("Network unavailable")
|
|
||||||
}
|
|
||||||
|
|
||||||
monitor.cancel()
|
|
||||||
}
|
|
||||||
|
|
||||||
let queue = DispatchQueue(label: "NetworkMonitor")
|
|
||||||
monitor.start(queue: queue)
|
|
||||||
|
|
||||||
hasConnectionMonitor.pathUpdateHandler = { path in
|
hasConnectionMonitor.pathUpdateHandler = { path in
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
@@ -141,20 +117,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
log("✅ Device-to-device likely allowed (peer responded on LAN).")
|
log("✅ Device-to-device likely allowed (peer responded on LAN).")
|
||||||
self.apIsolationAlertWindow?.close()
|
self.apIsolationAlertWindow?.close()
|
||||||
} else {
|
} else {
|
||||||
|
log("❌ Device-to-device check failed. Informing user...")
|
||||||
log("❌ First check failed. Retrying in 10 seconds...")
|
self.openAlert(type: .ApIsolation)
|
||||||
|
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
|
|
||||||
scanner.scan { allowed in
|
|
||||||
if allowed {
|
|
||||||
log("✅ Device-to-device likely allowed (peer responded on LAN).")
|
|
||||||
self.apIsolationAlertWindow?.close()
|
|
||||||
} else {
|
|
||||||
log("❌ Second check failed. Informing user...")
|
|
||||||
self.openAlert(type: .ApIsolation)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,70 +25,76 @@ struct IssueView: View {
|
|||||||
@State var isLoading = false
|
@State var isLoading = false
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
ZStack {
|
||||||
let imageSize = 120.0
|
|
||||||
ScrollView {
|
|
||||||
|
|
||||||
ZStack {
|
if colorScheme == .light {
|
||||||
|
Color.white
|
||||||
if colorScheme == .light {
|
|
||||||
Color.gray.opacity(0.1)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Color.black.opacity(0.2)
|
|
||||||
}
|
|
||||||
|
|
||||||
Image(image)
|
|
||||||
.resizable()
|
|
||||||
.frame(width: imageSize, height: imageSize)
|
|
||||||
.overlay(
|
|
||||||
Image(systemName: "exclamationmark.circle.fill")
|
|
||||||
.font(.system(size: imageSize * 0.2))
|
|
||||||
.background(Circle().foregroundColor(.white))
|
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing)
|
|
||||||
.foregroundColor(.red)
|
|
||||||
|
|
||||||
.padding(imageSize * 0.09)
|
|
||||||
.padding(.trailing, image == .filter ? 15 : 0)
|
|
||||||
.padding(.bottom, imageSize * 0.03)
|
|
||||||
)
|
|
||||||
.padding(.vertical)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.padding(.bottom, 20)
|
|
||||||
|
|
||||||
Text(header)
|
let imageSize = 120.0
|
||||||
.font(.title2)
|
ScrollView {
|
||||||
.fontWeight(.bold)
|
|
||||||
.multilineTextAlignment(.center)
|
ZStack {
|
||||||
|
|
||||||
Text(description)
|
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
|
||||||
.opacity(0.7)
|
|
||||||
.padding()
|
|
||||||
|
|
||||||
if let actionLabel = actionLabel, let action = action {
|
|
||||||
Button(actionLabel) {
|
|
||||||
|
|
||||||
withAnimation {
|
if colorScheme == .light {
|
||||||
isLoading = true
|
Color.gray.opacity(0.1)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Color.black.opacity(0.2)
|
||||||
}
|
}
|
||||||
|
|
||||||
Task {
|
Image(image)
|
||||||
await action()
|
.resizable()
|
||||||
|
.frame(width: imageSize, height: imageSize)
|
||||||
|
.overlay(
|
||||||
|
Image(systemName: "exclamationmark.circle.fill")
|
||||||
|
.font(.system(size: imageSize * 0.2))
|
||||||
|
.background(Circle().foregroundColor(.white))
|
||||||
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing)
|
||||||
|
.foregroundColor(.red)
|
||||||
|
|
||||||
|
.padding(imageSize * 0.09)
|
||||||
|
.padding(.trailing, image == .filter ? 15 : 0)
|
||||||
|
.padding(.bottom, imageSize * 0.03)
|
||||||
|
)
|
||||||
|
.padding(.vertical)
|
||||||
|
|
||||||
|
}
|
||||||
|
.padding(.bottom, 20)
|
||||||
|
|
||||||
|
Text(header)
|
||||||
|
.font(.title2)
|
||||||
|
.fontWeight(.bold)
|
||||||
|
.multilineTextAlignment(.center)
|
||||||
|
|
||||||
|
Text(description)
|
||||||
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
|
.opacity(0.7)
|
||||||
|
.padding()
|
||||||
|
|
||||||
|
if let actionLabel = actionLabel, let action = action {
|
||||||
|
Button(actionLabel) {
|
||||||
|
|
||||||
withAnimation {
|
withAnimation {
|
||||||
isLoading = false
|
isLoading = true
|
||||||
|
}
|
||||||
|
|
||||||
|
Task {
|
||||||
|
await action()
|
||||||
|
|
||||||
|
withAnimation {
|
||||||
|
isLoading = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
.opacity(isLoading ? 0 : 1)
|
||||||
.opacity(isLoading ? 0 : 1)
|
.overlay(
|
||||||
.overlay(
|
ProgressView()
|
||||||
ProgressView()
|
.opacity(isLoading ? 1 : 0)
|
||||||
.opacity(isLoading ? 1 : 0)
|
.scaleEffect(0.7)
|
||||||
.scaleEffect(0.7)
|
|
||||||
)
|
)
|
||||||
.padding(.bottom, 30)
|
.padding(.bottom, 30)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ struct WelcomeScreen: View {
|
|||||||
|
|
||||||
case .troubleshooting:
|
case .troubleshooting:
|
||||||
TutorialView(title: "Troubleshooting", text: "TroubleshootingDescription", showsLicense: false, openIAP: openPlusScreen)
|
TutorialView(title: "Troubleshooting", text: "TroubleshootingDescription", showsLicense: false, openIAP: openPlusScreen)
|
||||||
|
.onAppear {
|
||||||
|
checkForNetworkIssues()
|
||||||
|
}
|
||||||
|
|
||||||
case .app:
|
case .app:
|
||||||
TutorialView(title: "AndroidApp", text: "AndroidAppDescription", showsLicense: false, showsBetaJoinButton: true, openIAP: openPlusScreen)
|
TutorialView(title: "AndroidApp", text: "AndroidAppDescription", showsLicense: false, showsBetaJoinButton: true, openIAP: openPlusScreen)
|
||||||
|
|||||||
Reference in new issue
Block a user