From 6b5a64010ec2114394264a549c27afa1edf0774e Mon Sep 17 00:00:00 2001 From: Brandon Evans Date: Mon, 25 Jan 2021 19:09:06 -0700 Subject: [PATCH] Add bug report and feature request options to Help menu This will support error messages that instruct the user to go to the Help menu for these things. --- Xcodes/Frontend/About/AboutView.swift | 3 ++- Xcodes/XcodesApp.swift | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Xcodes/Frontend/About/AboutView.swift b/Xcodes/Frontend/About/AboutView.swift index d463f42..a34a817 100644 --- a/Xcodes/Frontend/About/AboutView.swift +++ b/Xcodes/Frontend/About/AboutView.swift @@ -2,6 +2,7 @@ import SwiftUI struct AboutView: View { let showAcknowledgementsWindow: () -> Void + @SwiftUI.Environment(\.openURL) var openURL: OpenURLAction var body: some View { HStack { @@ -18,7 +19,7 @@ struct AboutView: View { HStack(spacing: 32) { Button(action: { - NSWorkspace.shared.open(URL(string: "https://github.com/RobotsAndPencils/XcodesApp/")!) + openURL(URL(string: "https://github.com/RobotsAndPencils/XcodesApp/")!) }) { Label("GitHub Repo", systemImage: "link") } diff --git a/Xcodes/XcodesApp.swift b/Xcodes/XcodesApp.swift index 85b0569..4a8ab64 100644 --- a/Xcodes/XcodesApp.swift +++ b/Xcodes/XcodesApp.swift @@ -7,6 +7,7 @@ import SwiftUI struct XcodesApp: App { @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate: AppDelegate @SwiftUI.Environment(\.scenePhase) private var scenePhase: ScenePhase + @SwiftUI.Environment(\.openURL) var openURL: OpenURLAction @StateObject private var appState = AppState() var body: some Scene { @@ -51,6 +52,25 @@ struct XcodesApp: App { } XcodeCommands(appState: appState) + + CommandGroup(replacing: CommandGroupPlacement.help) { + Button("Xcodes GitHub Repo") { + let xcodesRepoURL = URL(string: "https://github.com/RobotsAndPencils/XcodesApp/")! + openURL(xcodesRepoURL) + } + + Divider() + + Button("Report a Bug") { + let bugReportURL = URL(string: "https://github.com/RobotsAndPencils/XcodesApp/issues/new?assignees=&labels=bug&template=bug_report.md&title=")! + openURL(bugReportURL) + } + + Button("Request a New Feature") { + let featureRequestURL = URL(string: "https://github.com/RobotsAndPencils/XcodesApp/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=")! + openURL(featureRequestURL) + } + } } }