mirror of
https://github.com/lwouis/alt-tab-macos.git
synced 2026-05-24 11:20:36 +00:00
feat: remove the need to add email in feedback form
This commit is contained in:
@@ -118,9 +118,6 @@
|
||||
/* No comment provided by engineer. */
|
||||
"Applications" = "Applications";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Are you sure you don’t want a response?" = "Are you sure you don’t 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 won’t show." = "Use the app without this permission. Thumbnails won’t show.";
|
||||
|
||||
@@ -626,8 +620,5 @@
|
||||
/* No comment provided by engineer. */
|
||||
"You can’t undo this action." = "You can’t undo this action.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"You didn’t write your email, thus can’t receive any response." = "You didn’t write your email, thus can’t 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";
|
||||
|
||||
@@ -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 don’t want a response?", comment: "")
|
||||
alert.informativeText = NSLocalizedString("You didn’t write your email, thus can’t 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 {
|
||||
|
||||
Reference in New Issue
Block a user