diff --git a/NearbyShare/Connection/InboundNearbyConnection.swift b/NearbyShare/Connection/InboundNearbyConnection.swift index 9008348..5bcb895 100644 --- a/NearbyShare/Connection/InboundNearbyConnection.swift +++ b/NearbyShare/Connection/InboundNearbyConnection.swift @@ -513,9 +513,11 @@ class InboundNearbyConnection: NearbyConnection { #endif filesToBeReceived[id]!.progress = progress filesToBeReceived[id]!.created = true - - log("[InboundNearbyConnection \(self.id)] Accepted file with size \(file.meta.size)") } + + let totalBytes = filesToBeReceived.values.reduce(0) { $0 + $1.meta.size } + let gigabytes = Double(totalBytes) / 1_000_000_000 + log("[InboundNearbyConnection \(self.id)] Accepted \(filesToBeReceived.count) file(s) with size \(totalBytes) bytes (\(gigabytes) GB)") var frame = Sharing_Nearby_Frame() frame.version = .v1 diff --git a/NearbyShare/Connection/NearbyConnection.swift b/NearbyShare/Connection/NearbyConnection.swift index c3c257b..8194122 100644 --- a/NearbyShare/Connection/NearbyConnection.swift +++ b/NearbyShare/Connection/NearbyConnection.swift @@ -207,8 +207,7 @@ class NearbyConnection { log("[NearbyConnection \(self.id)] Connection closed by peer during receiveFrameAsync(length:)") if let content = content, !content.isEmpty { - log("[NearbyConnection \(self.id)] Connection closed by peer during receiveFrameAsync(length:), but trying to process the frame anyway. Frame length: \(content.count)") - self.processReceivedFrame(frameData: content) + log("[NearbyConnection \(self.id)] Connection closed by peer during receiveFrameAsync(length:), and frame not empty. Frame length: \(content.count)") } else { log("[NearbyConnection \(self.id)] Connection closed by peer during receiveFrameAsync(length:), but no content received anymore (\(String(describing: content))).") @@ -424,7 +423,10 @@ class NearbyConnection { } else if offlineFrame.hasV1, offlineFrame.v1.hasType, case .keepAlive = offlineFrame.v1.type { - log("[NearbyConnection \(self.id)] Sent keep-alive, \(self.bytesTransferred) bytes sent") + let bytesTransferred = self.bytesTransferred + let gigabytesTransferred = Double(bytesTransferred) / 1_000_000_000 + + log("[NearbyConnection \(self.id)] Sent keep-alive, \(self.bytesTransferred) bytes (\(gigabytesTransferred) GB) sent") sendKeepAlive(ack: true) } else { diff --git a/QuickDrop/AppDelegate.swift b/QuickDrop/AppDelegate.swift index b9e989f..0c2829a 100644 --- a/QuickDrop/AppDelegate.swift +++ b/QuickDrop/AppDelegate.swift @@ -112,6 +112,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele let queue2 = DispatchQueue(label: "NetworkConnectionMonitor") hasConnectionMonitor.start(queue: queue2) + + log("Application did finish launching") } @@ -147,10 +149,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele func application(_ application: NSApplication, open urls: [URL]) { for url in urls { if url.scheme == "quickdrop", url.host == "sendLog" { - sendLoggingString() // this time it runs in the main app + sendLoggingString() } - if url.scheme == "quickdrop", url.host == "openLog", let url = LogManager.sharedInstance.logFileURL { log("Opening log file: \(url)") // open folder containing the log file diff --git a/QuickDrop/Localizable.xcstrings b/QuickDrop/Localizable.xcstrings index a88b076..1e5ce82 100644 --- a/QuickDrop/Localizable.xcstrings +++ b/QuickDrop/Localizable.xcstrings @@ -7157,6 +7157,9 @@ } } } + }, + "Reset UD" : { + }, "SaveFilesLocation" : { "extractionState" : "manual", diff --git a/QuickDrop/Util/ErrorAlertHandler.swift b/QuickDrop/Util/ErrorAlertHandler.swift index 0bd0107..a9a89fe 100644 --- a/QuickDrop/Util/ErrorAlertHandler.swift +++ b/QuickDrop/Util/ErrorAlertHandler.swift @@ -148,12 +148,15 @@ func sendLoggingString() { if let url = LogManager.sharedInstance.logFileURL { let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown" log("Sending logging string with file URL: \(url)") + log("Currently running apps: \(NSWorkspace.shared.runningApplications.map { $0.localizedName ?? "Unknown" })") - sendEmailWithAttachment( - fileURL: url, - recipients: ["quickdrop@leonboettger.com"], - subject: "QuickDrop \(appVersion) - \(getDeviceAndSystem())" - ) + DispatchQueue.main.asyncAfter(deadline: .now() + 0.3, execute: { + sendEmailWithAttachment( + fileURL: url, + recipients: ["quickdrop@leonboettger.com"], + subject: "QuickDrop \(appVersion) - \(getDeviceAndSystem())" + ) + }) } }