mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-20 21:36:00 +00:00
Improve logging
This commit is contained in:
1 parent
e3cbc19f11
commit
d3a95c068f
1 file changed
+12
-7
@@ -180,14 +180,16 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
|
|
||||||
|
|
||||||
func application(_ application: NSApplication, open urls: [URL]) {
|
func application(_ application: NSApplication, open urls: [URL]) {
|
||||||
|
|
||||||
|
log("[AppDelegate] application(open:): Received URLs: \(urls)")
|
||||||
|
|
||||||
for url in urls {
|
for url in urls {
|
||||||
if url.scheme == "quickdrop" {
|
if url.scheme == "quickdrop" {
|
||||||
|
|
||||||
switch url.host {
|
switch url.host {
|
||||||
case "sendLog":
|
case "sendLog":
|
||||||
// If we're in an extension, redirect to the main app
|
// If we're in an extension, redirect to the main app
|
||||||
if Bundle.main.bundlePath.hasSuffix(".appex") {
|
if Bundle.main.bundlePath.hasSuffix(".appex") {
|
||||||
log("sendLoggingString: in extension, redirecting to main app")
|
log("[AppDelegate] sendLoggingString: in extension, redirecting to main app")
|
||||||
|
|
||||||
if let url = URL(string: "quickdrop://sendLog") {
|
if let url = URL(string: "quickdrop://sendLog") {
|
||||||
NSWorkspace.shared.open(url)
|
NSWorkspace.shared.open(url)
|
||||||
@@ -198,9 +200,12 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
LogExportPresenter.showUploadLogsAlert()
|
LogExportPresenter.showUploadLogsAlert()
|
||||||
case "openLog":
|
case "openLog":
|
||||||
if let url = LogManager.sharedInstance.logFileURL {
|
if let url = LogManager.sharedInstance.logFileURL {
|
||||||
log("Opening log file: \(url)")
|
log("[AppDelegate] Opening log file: \(url)")
|
||||||
NSWorkspace.shared.activateFileViewerSelecting([url])
|
NSWorkspace.shared.activateFileViewerSelecting([url])
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
log("[AppDelegate] No log file found to open.")
|
||||||
|
}
|
||||||
case "mockTransferFailure":
|
case "mockTransferFailure":
|
||||||
ErrorAlertHandler.shared.showErrorAlert(for: "Test Device", error: NearbyError.inputOutput)
|
ErrorAlertHandler.shared.showErrorAlert(for: "Test Device", error: NearbyError.inputOutput)
|
||||||
case "removeData":
|
case "removeData":
|
||||||
@@ -294,11 +299,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
if let window = plusWindow, window.isVisible {
|
if let window = plusWindow, window.isVisible {
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
window.makeKeyAndOrderFront(nil)
|
window.makeKeyAndOrderFront(nil)
|
||||||
log("Plus screen already open, bringing to front")
|
log("[AppDelegate] Plus screen already open, bringing to front")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log("Opening Plus screen")
|
log("[AppDelegate] Opening Plus screen")
|
||||||
|
|
||||||
// Create the welcome screen SwiftUI view
|
// Create the welcome screen SwiftUI view
|
||||||
let plusView = GetPlusViewV4(showSheet: Binding(get: { self.plusWindow != nil }, set: { newValue in
|
let plusView = GetPlusViewV4(showSheet: Binding(get: { self.plusWindow != nil }, set: { newValue in
|
||||||
@@ -383,10 +388,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
|||||||
let scanner = DeviceToDeviceHeuristicScanner.shared
|
let scanner = DeviceToDeviceHeuristicScanner.shared
|
||||||
scanner.scan { allowed in
|
scanner.scan { allowed in
|
||||||
if allowed {
|
if allowed {
|
||||||
log("✅ Device-to-device likely allowed (peer responded on LAN).")
|
log("[AppDelegate] ✅ Device-to-device likely allowed (peer responded on LAN).")
|
||||||
ErrorAlertHandler.shared.closeApIsolationAlert()
|
ErrorAlertHandler.shared.closeApIsolationAlert()
|
||||||
} else {
|
} else {
|
||||||
log("❌ Device-to-device check failed. Informing user...")
|
log("[AppDelegate] ❌ Device-to-device check failed. Informing user...")
|
||||||
ErrorAlertHandler.shared.openAlert(type: .ApIsolation)
|
ErrorAlertHandler.shared.openAlert(type: .ApIsolation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user