From f8d3d4971f4fc18dce9d2af93b92292237950852 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Mon, 14 Nov 2022 16:07:13 -0600 Subject: [PATCH] =?UTF-8?q?[AltServer]=20Adds=20=E2=80=9CSearch=20FAQ?= =?UTF-8?q?=E2=80=9D=20button=20to=20ErrorDetailsViewController?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AltServer/ErrorDetailsViewController.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/AltServer/ErrorDetailsViewController.swift b/AltServer/ErrorDetailsViewController.swift index 6f9fd1c7..5ea59b7f 100644 --- a/AltServer/ErrorDetailsViewController.swift +++ b/AltServer/ErrorDetailsViewController.swift @@ -44,5 +44,20 @@ private extension ErrorDetailsViewController let detailedDescription = error.formattedDetailedDescription(with: font) self.detailedDescriptionLabel.attributedStringValue = detailedDescription } + + @IBAction func searchFAQ(_ sender: NSButton) + { + guard let error else { return } + + let baseURL = URL(string: "https://faq.altstore.io/getting-started/error-codes")! + var components = URLComponents(url: baseURL, resolvingAgainstBaseURL: false)! + + let nsError = error as NSError + let query = [nsError.domain, "\(error.displayCode)"].joined(separator: "+") + components.queryItems = [URLQueryItem(name: "q", value: query)] + + let url = components.url ?? baseURL + NSWorkspace.shared.open(url) + } }