mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-11 11:01:07 +00:00
Send file as log
This commit is contained in:
1 parent
199621acf3
commit
088a3b5389
2 files changed
+23
-9
No files matched your search
@@ -110,11 +110,13 @@ struct LargeAppIconView<Content: View>: View {
|
||||
.padding(.top, 50)
|
||||
.onTapGesture {
|
||||
taps += 1
|
||||
print("Tapped \(taps) times")
|
||||
print("Clicked \(taps) times")
|
||||
|
||||
if taps == 5 {
|
||||
sendLoggingString()
|
||||
print("Copied log to clipboard")
|
||||
|
||||
taps = 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,16 +134,28 @@ struct LargeAppIconView<Content: View>: View {
|
||||
|
||||
func sendLoggingString() {
|
||||
|
||||
let logString = LogManager.sharedInstance.getLogString()
|
||||
|
||||
if let url = URL(string: "mailto:quickdrop@leonboettger.com?subject=QuickDrop Log&body=\n\n\n––––––––––––––––––––\n\(logString)") {
|
||||
NSWorkspace.shared.open(url)
|
||||
if let url = LogManager.sharedInstance.logFileURL {
|
||||
sendEmailWithAttachment(fileURL: url, recipients: ["quickdrop@leonboettger.com"], subject: "QuickDrop Log")
|
||||
}
|
||||
|
||||
let logString = LogManager.sharedInstance.getLogString()
|
||||
|
||||
copyToClipboard(logString)
|
||||
}
|
||||
|
||||
|
||||
func sendEmailWithAttachment(fileURL: URL, recipients: [String], subject: String) {
|
||||
guard let emailService = NSSharingService(named: .composeEmail) else {
|
||||
print("No email service available")
|
||||
return
|
||||
}
|
||||
|
||||
emailService.recipients = recipients
|
||||
emailService.subject = subject
|
||||
emailService.perform(withItems: [fileURL])
|
||||
}
|
||||
|
||||
|
||||
func copyToClipboard(_ text: String) {
|
||||
let pasteboard = NSPasteboard.general
|
||||
pasteboard.clearContents()
|
||||
|
||||
@@ -789,8 +789,8 @@
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SHARED_BUILD = 30;
|
||||
SHARED_VERSION = 1.7.2;
|
||||
SHARED_BUILD = 31;
|
||||
SHARED_VERSION = 1.7.3;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
@@ -848,8 +848,8 @@
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = macosx;
|
||||
SHARED_BUILD = 30;
|
||||
SHARED_VERSION = 1.7.2;
|
||||
SHARED_BUILD = 31;
|
||||
SHARED_VERSION = 1.7.3;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user