From 324ec7907a83042c48fb27af55a924c2016477b6 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/Base.lproj/Main.storyboard | 34 +++++++++++++++++++--- AltServer/ErrorDetailsViewController.swift | 15 ++++++++++ 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/AltServer/Base.lproj/Main.storyboard b/AltServer/Base.lproj/Main.storyboard index 3c867eac..71f5b70e 100644 --- a/AltServer/Base.lproj/Main.storyboard +++ b/AltServer/Base.lproj/Main.storyboard @@ -389,14 +389,14 @@ - + - + - + @@ -404,21 +404,47 @@ - + + + + + + + + + + + + + + + + + + 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) + } }