mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-11 02:51:11 +00:00
Improve support link & logging
This commit is contained in:
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",
|
||||
"state" : {
|
||||
"branch" : "main",
|
||||
"revision" : "a64f79481ee613281548f3e899dde26fac9f0a89"
|
||||
"revision" : "87f9d26e499b49838dc9135e063d10e1701480e9"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -87,8 +87,8 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/apple/swift-protobuf.git",
|
||||
"state" : {
|
||||
"revision" : "c169a5744230951031770e27e475ff6eefe51f9d",
|
||||
"version" : "1.33.3"
|
||||
"revision" : "959a56cda79509e66abd367a6498951b656aa460",
|
||||
"version" : "1.34.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -128,6 +128,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
|
||||
}
|
||||
|
||||
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 {
|
||||
case "sendLog":
|
||||
sendLoggingString()
|
||||
case "openLog":
|
||||
if let url = LogManager.sharedInstance.logFileURL {
|
||||
NSWorkspace.shared.activateFileViewerSelecting([url])
|
||||
// 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
|
||||
}
|
||||
|
||||
LogExportPresenter.copyLogsToClipboardAndShowAlert()
|
||||
case "removeData":
|
||||
Settings.sharedInstance.deleteAllUserDefaults()
|
||||
default:
|
||||
|
||||
@@ -43,5 +43,5 @@ let configuration = LUIConfiguration(
|
||||
|
||||
supportsPortraitSplitView: false,
|
||||
|
||||
supportsDarkModeShadow: false
|
||||
supportsDarkModeShadow: true
|
||||
)
|
||||
@@ -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 {
|
||||
case ApIsolation
|
||||
case NetworkFilter
|
||||
|
||||
@@ -44,7 +44,7 @@ struct WelcomeScreen: View {
|
||||
Divider()
|
||||
|
||||
ExternalLinkLabel(label: "GetSupport", icon: "questionmark.circle") {
|
||||
sendLoggingString()
|
||||
SupportMail.sendSupportMail()
|
||||
}
|
||||
|
||||
ExternalLinkLabel(label: "PrivacyPolicy", icon: "hand.raised") {
|
||||
|
||||
Reference in new issue
Block a user