feat: remove the need to add email in feedback form

This commit is contained in:
lwouis
2026-04-13 10:46:11 +02:00
parent 9c5b9630e8
commit da9a46bf49
2 changed files with 4 additions and 36 deletions
+3 -12
View File
@@ -118,9 +118,6 @@
/* No comment provided by engineer. */
"Applications" = "Applications";
/* No comment provided by engineer. */
"Are you sure you dont want a response?" = "Are you sure you dont want a response?";
/* No comment provided by engineer. */
"Arrow keys" = "Arrow keys";
@@ -343,9 +340,6 @@
/* No comment provided by engineer. */
"Open Trackpad Settings…" = "Open Trackpad Settings…";
/* No comment provided by engineer. */
"Optional: email (if you want a reply)" = "Optional: email (if you want a reply)";
/* No comment provided by engineer. */
"Order windows by" = "Order windows by";
@@ -416,9 +410,6 @@
/* No comment provided by engineer. */
"Send a crash report?" = "Send a crash report?";
/* No comment provided by engineer. */
"Send anyway" = "Send anyway";
/* No comment provided by engineer. */
"Send debug profile (CPU, memory, etc)" = "Send debug profile (CPU, memory, etc)";
@@ -575,6 +566,9 @@
/* No comment provided by engineer. */
"Updates policy" = "Updates policy";
/* No comment provided by engineer. */
"Usage" = "Usage";
/* No comment provided by engineer. */
"Use the app without this permission. Thumbnails wont show." = "Use the app without this permission. Thumbnails wont show.";
@@ -626,8 +620,5 @@
/* No comment provided by engineer. */
"You cant undo this action." = "You cant undo this action.";
/* No comment provided by engineer. */
"You didnt write your email, thus cant receive any response." = "You didnt write your email, thus cant receive any response.";
/* No comment provided by engineer. */
"You may need to disable some conflicting system gestures" = "You may need to disable some conflicting system gestures";
+1 -24
View File
@@ -10,7 +10,6 @@ class FeedbackWindow: NSWindow {
static var shared: FeedbackWindow?
var issueTitle: TextArea!
var body: TextArea!
var email: TextArea!
var sendButton: NSButton!
var debugProfile: NSButton!
static var canBecomeKey_ = true
@@ -52,7 +51,6 @@ class FeedbackWindow: NSWindow {
buttons.spacing = GridView.interPadding
issueTitle = TextArea(80, 1, NSLocalizedString("Title", comment: ""), checkEmptyFields)
body = TextArea(80, 12, NSLocalizedString("I think the app could be improved with…", comment: ""), checkEmptyFields)
email = TextArea(80, 1, NSLocalizedString("Optional: email (if you want a reply)", comment: ""))
debugProfile = NSButton(checkboxWithTitle: NSLocalizedString("Send debug profile (CPU, memory, etc)", comment: ""), target: nil, action: nil)
debugProfile.state = .on
let warning = BoldLabel("" + NSLocalizedString("All data from this form will be made public, as a ticket on github.com", comment: ""))
@@ -62,11 +60,10 @@ class FeedbackWindow: NSWindow {
[warning],
[issueTitle],
[body],
[email],
[debugProfile],
[buttons],
])
view.cell(atColumnIndex: 0, rowIndex: 7).xPlacement = .trailing
view.cell(atColumnIndex: 0, rowIndex: 6).xPlacement = .trailing
setContentSize(view.fittingSize)
contentView = view
checkEmptyFields()
@@ -83,13 +80,6 @@ class FeedbackWindow: NSWindow {
}
@objc private func sendCallback() {
if email.stringValue.isEmpty && !warnAboutNoEmail() {
return
}
openTicket()
}
private func openTicket() {
URLSession.shared.dataTask(with: prepareRequest(), completionHandler: { data, response, error in
if error != nil || response == nil || (response as! HTTPURLResponse).statusCode != 201 {
Logger.error { "HTTP call failed. response:\(response) error:\(error) data:\(data.flatMap { String(data: $0, encoding: .utf8) })" }
@@ -100,16 +90,6 @@ class FeedbackWindow: NSWindow {
close()
}
private func warnAboutNoEmail() -> Bool {
let alert = NSAlert()
alert.alertStyle = .warning
alert.messageText = NSLocalizedString("Are you sure you dont want a response?", comment: "")
alert.informativeText = NSLocalizedString("You didnt write your email, thus cant receive any response.", comment: "")
alert.addButton(withTitle: NSLocalizedString("Send anyway", comment: ""))
alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
return alert.runModal() == NSApplication.ModalResponse.alertFirstButtonReturn
}
private func prepareRequest() -> URLRequest {
var request = URLRequest(url: URL(string: "https://api.github.com/repos/lwouis/alt-tab-macos/issues")!)
request.httpMethod = "POST"
@@ -127,9 +107,6 @@ class FeedbackWindow: NSWindow {
private func assembleBody() -> String {
var result = ""
result += "_This issue was opened by a bot after a user submitted feedback through the in-app form._"
if !email.stringValue.isEmpty {
result += "\n\n__From:__ " + email.stringValue
}
result += "\n\n__Message:__"
result += "\n\n> " + body.stringValue.replacingOccurrences(of: "\n", with: "\n> ")
if debugProfile.state == .on {