From 5e383c2148e2ce5a9018ea1f2d7448bc74da4249 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Fri, 9 Sep 2022 17:44:15 -0500 Subject: [PATCH] Adds Error Log screen Allows users to view a history of all errors that occured when performing app operations. --- AltStore.xcodeproj/project.pbxproj | 1 + .../Error Log/ErrorLogViewController.swift | 14 ++++++++++---- AltStore/Settings/Settings.storyboard | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/AltStore.xcodeproj/project.pbxproj b/AltStore.xcodeproj/project.pbxproj index 060580d0..486c59b0 100644 --- a/AltStore.xcodeproj/project.pbxproj +++ b/AltStore.xcodeproj/project.pbxproj @@ -2575,6 +2575,7 @@ BF08858322DE795100DE9F1E /* MyAppsViewController.swift in Sources */, BFC84A4D2421A19100853474 /* SourcesViewController.swift in Sources */, BFF0B696232242D3007A79E1 /* LicensesViewController.swift in Sources */, + BFD52BD422A0800A000B7ED1 /* ServerManager.swift in Sources */, D57FE84428C7DB7100216002 /* ErrorLogViewController.swift in Sources */, BFBE0007250AD0E70080826E /* ViewAppIntentHandler.swift in Sources */, BFDB6A0822AAED73007EA6D6 /* ResignAppOperation.swift in Sources */, diff --git a/AltStore/Settings/Error Log/ErrorLogViewController.swift b/AltStore/Settings/Error Log/ErrorLogViewController.swift index 23786b9b..092319eb 100644 --- a/AltStore/Settings/Error Log/ErrorLogViewController.swift +++ b/AltStore/Settings/Error Log/ErrorLogViewController.swift @@ -76,8 +76,14 @@ private extension ErrorLogViewController let cell = cell as! ErrorLogTableViewCell cell.dateLabel.text = self.timeFormatter.string(from: loggedError.date) cell.errorFailureLabel.text = loggedError.localizedFailure ?? NSLocalizedString("Operation Failed", comment: "") - cell.errorCodeLabel.text = loggedError.error.localizedErrorCode - + + switch loggedError.domain + { + case AltServerErrorDomain: cell.errorCodeLabel?.text = String(format: NSLocalizedString("AltServer Error %@", comment: ""), NSNumber(value: loggedError.code)) + case OperationError.domain: cell.errorCodeLabel?.text = String(format: NSLocalizedString("AltStore Error %@", comment: ""), NSNumber(value: loggedError.code)) + default: cell.errorCodeLabel?.text = loggedError.error.localizedErrorCode + } + let nsError = loggedError.error as NSError let errorDescription = [nsError.localizedDescription, nsError.localizedRecoverySuggestion].compactMap { $0 }.joined(separator: "\n\n") cell.errorDescriptionTextView.text = errorDescription @@ -249,10 +255,10 @@ private extension ErrorLogViewController func searchFAQ(for loggedError: LoggedError) { - let baseURL = URL(string: "https://faq.altstore.io/getting-started/error-codes")! + let baseURL = URL(string: "https://faq.altstore.io/getting-started/troubleshooting-guide")! var components = URLComponents(url: baseURL, resolvingAgainstBaseURL: false)! - let query = [loggedError.domain, "\(loggedError.error.displayCode)"].joined(separator: "+") + let query = [loggedError.domain, "\(loggedError.code)"].joined(separator: "+") components.queryItems = [URLQueryItem(name: "q", value: query)] let safariViewController = SFSafariViewController(url: components.url ?? baseURL) diff --git a/AltStore/Settings/Settings.storyboard b/AltStore/Settings/Settings.storyboard index 02085bde..3478ae3c 100644 --- a/AltStore/Settings/Settings.storyboard +++ b/AltStore/Settings/Settings.storyboard @@ -1144,6 +1144,7 @@ Settings by i cons from the Noun Project +