Improve support link & logging

This commit is contained in:
Leon Böttger committed 2026-02-05 20:54:59 +01:00
1 parent eb32603c5f
commit c86ed97bc2
5 files changed
+16 -78

No files matched your search

@@ -52,7 +52,7 @@
"location" : "https://github.com/leonboe1/LUI.git", "location" : "https://github.com/leonboe1/LUI.git",
"state" : { "state" : {
"branch" : "main", "branch" : "main",
"revision" : "a64f79481ee613281548f3e899dde26fac9f0a89" "revision" : "87f9d26e499b49838dc9135e063d10e1701480e9"
} }
}, },
{ {
@@ -87,8 +87,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git", "location" : "https://github.com/apple/swift-protobuf.git",
"state" : { "state" : {
"revision" : "c169a5744230951031770e27e475ff6eefe51f9d", "revision" : "959a56cda79509e66abd367a6498951b656aa460",
"version" : "1.33.3" "version" : "1.34.0"
} }
}, },
{ {
+11 -4
View File
@@ -128,6 +128,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
} }
log("[AppDelegate] Application did finish launching") log("[AppDelegate] Application did finish launching")
log("[AppDelegate] Currently running apps: \(NSWorkspace.shared.runningApplications.map { $0.localizedName ?? "-" })")
} }
@@ -183,11 +184,17 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
switch url.host { switch url.host {
case "sendLog": case "sendLog":
sendLoggingString() // If we're in an extension, redirect to the main app
case "openLog": if Bundle.main.bundlePath.hasSuffix(".appex") {
if let url = LogManager.sharedInstance.logFileURL { log("sendLoggingString: in extension, redirecting to main app")
NSWorkspace.shared.activateFileViewerSelecting([url])
if let url = URL(string: "quickdrop://sendLog") {
NSWorkspace.shared.open(url)
}
return
} }
LogExportPresenter.copyLogsToClipboardAndShowAlert()
case "removeData": case "removeData":
Settings.sharedInstance.deleteAllUserDefaults() Settings.sharedInstance.deleteAllUserDefaults()
default: default:
+1 -1
View File
@@ -43,5 +43,5 @@ let configuration = LUIConfiguration(
supportsPortraitSplitView: false, supportsPortraitSplitView: false,
supportsDarkModeShadow: false supportsDarkModeShadow: true
) )
-69
View File
@@ -161,75 +161,6 @@ class ErrorAlertHandler {
} }
#if os(macOS)
func sendLoggingString() {
// If we're in an extension, redirect to the main app
if Bundle.main.bundlePath.hasSuffix(".appex") {
log("sendLoggingString: in extension, redirecting to main app")
if let url = URL(string: "quickdrop://sendLog") {
NSWorkspace.shared.open(url)
}
return
}
// We're in the main app – do the actual sending
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" })")
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3, execute: {
sendEmailWithAttachment(
fileURL: url,
recipients: ["quickdrop@leonboettger.com"],
subject: "QuickDrop \(appVersion) - \(getDeviceAndSystem())"
)
})
}
}
fileprivate func getDeviceAndSystem() -> String {
// Get Mac model identifier
var size: Int = 0
sysctlbyname("hw.model", nil, &size, nil, 0)
var modelBuffer = [CChar](repeating: 0, count: size)
sysctlbyname("hw.model", &modelBuffer, &size, nil, 0)
let model = String(cString: modelBuffer)
// Get macOS version
let version = ProcessInfo.processInfo.operatingSystemVersion
let versionString = "\(version.majorVersion).\(version.minorVersion).\(version.patchVersion)"
return "\(model) - \(versionString)"
}
func sendEmailWithAttachment(fileURL: URL, recipients: [String], subject: String) {
guard let emailService = NSSharingService(named: .composeEmail) else {
log("No email service available")
return
}
emailService.recipients = recipients
emailService.subject = subject
emailService.perform(withItems: [fileURL])
log("Email service opened with recipients: \(recipients) and subject: \(subject)")
}
func copyToClipboard(_ text: String) {
let pasteboard = NSPasteboard.general
pasteboard.clearContents()
pasteboard.setString(text, forType: .string)
}
#endif
enum AlertType: String { enum AlertType: String {
case ApIsolation case ApIsolation
case NetworkFilter case NetworkFilter
@@ -44,7 +44,7 @@ struct WelcomeScreen: View {
Divider() Divider()
ExternalLinkLabel(label: "GetSupport", icon: "questionmark.circle") { ExternalLinkLabel(label: "GetSupport", icon: "questionmark.circle") {
sendLoggingString() SupportMail.sendSupportMail()
} }
ExternalLinkLabel(label: "PrivacyPolicy", icon: "hand.raised") { ExternalLinkLabel(label: "PrivacyPolicy", icon: "hand.raised") {