[AltServer] Adds “Search FAQ” button to ErrorDetailsViewController

This commit is contained in:
Riley Testut
2022-11-14 16:07:13 -06:00
committed by Magesh K
parent 7e01972cd4
commit f8d3d4971f

View File

@@ -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)
}
}