diff --git a/AltStore/Extensions/Error+Message.swift b/AltStore/Extensions/Error+Message.swift new file mode 100644 index 00000000..108ca021 --- /dev/null +++ b/AltStore/Extensions/Error+Message.swift @@ -0,0 +1,13 @@ +// +// Error+Message.swift +// SideStore +// +// Created by naturecodevoid on 5/30/23. +// Copyright © 2023 SideStore. All rights reserved. +// + +extension Error { + func message() -> String { + (self as? LocalizedError)?.failureReason ?? self.localizedDescription + } +} diff --git a/AltStore/LaunchViewController.swift b/AltStore/LaunchViewController.swift index 4383d650..7b174c64 100644 --- a/AltStore/LaunchViewController.swift +++ b/AltStore/LaunchViewController.swift @@ -152,7 +152,7 @@ final class LaunchViewController: RSTLaunchViewController, UIDocumentPickerDeleg try start(pairing_file, documentsDirectory) } catch { try! FileManager.default.removeItem(at: FileManager.default.documentsDirectory.appendingPathComponent("\(pairingFileName)")) - displayError("minimuxer failed to start, please restart SideStore. \((error as? LocalizedError)?.failureReason ?? "UNKNOWN ERROR!!!!!! REPORT TO GITHUB ISSUES!")") + displayError("minimuxer failed to start, please restart SideStore. \(error.message())") } set_debug(UserDefaults.shared.isDebugLoggingEnabled) start_auto_mounter(documentsDirectory) diff --git a/AltStore/Resources/en.lproj/Localizable.strings b/AltStore/Resources/en.lproj/Localizable.strings index d6129a37..d6b4ed2e 100644 --- a/AltStore/Resources/en.lproj/Localizable.strings +++ b/AltStore/Resources/en.lproj/Localizable.strings @@ -191,12 +191,6 @@ You should only enable Developer Mode if you meet one of the following requireme "DevModeView.password" = "Password"; "DevModeView.incorrectPassword" = "Incorrect password."; "DevModeView.read" = "Read the text!"; -"DevModeView.console" = "Console"; -"DevModeView.dataExplorer" = "Data File Explorer"; -"DevModeView.tmpExplorer" = "Temporary File Explorer"; -"DevModeView.skipResign" = "Skip Resign"; -"DevModeView.footer" = "Skip Resign should only be used when you have an IPA that you have self signed. Otherwise, it will break things, and might make SideStore crash (there is absolutely no error handling and everything is expected to work)."; -"DevModeView.minimuxer" = "minimuxer debug actions"; "DevModeView.General.header" = "General"; "DevModeView.General.console" = "Console"; "DevModeView.General.unstableFeaturesNightlyOnly" = "Unstable Features are only available on nightly builds, PR builds and debug builds."; diff --git a/AltStore/SceneDelegate.swift b/AltStore/SceneDelegate.swift index 6b9d2a06..e52b4d52 100644 --- a/AltStore/SceneDelegate.swift +++ b/AltStore/SceneDelegate.swift @@ -140,26 +140,26 @@ private extension SceneDelegate } case "sidejit-enable": - guard UnstableFeatures.enabled(.jitUrlScheme) else { return UIApplication.alertOk(title: "JIT URL scheme unstable feature is not enabled", message: nil) } + guard UnstableFeatures.enabled(.jitUrlScheme) else { return UIApplication.alert(title: "JIT URL scheme unstable feature is not enabled", message: nil) } if let bundleID = queryItems["bid"] { DispatchQueue.main.async { do { try debug_app(bundleID) } catch { - UIApplication.alertOk(title: "An error occurred when enabling JIT", message: error.localizedDescription) + UIApplication.alert(title: "An error occurred when enabling JIT", message: error.message()) } } } else if let processID = queryItems["pid"] { DispatchQueue.main.async { do { - guard let processID = UInt32(processID) else { return UIApplication.alertOk(title: "An error occurred when enabling JIT", message: "Process ID is not a valid unsigned integer") } + guard let processID = UInt32(processID) else { return UIApplication.alert(title: "An error occurred when enabling JIT", message: "Process ID is not a valid unsigned integer") } try attach_debugger(processID) } catch { - UIApplication.alertOk(title: "An error occurred when enabling JIT", message: error.localizedDescription) + UIApplication.alert(title: "An error occurred when enabling JIT", message: error.message()) } } - } else { return UIApplication.alertOk(title: "An error occurred when enabling JIT", message: "Please specify a bundle ID using the `bid` query parameter or a process ID using `pid` query parameter") } + } else { return UIApplication.alert(title: "An error occurred when enabling JIT", message: "Please specify a bundle ID using the `bid` query parameter or a process ID using `pid` query parameter") } default: break } diff --git a/AltStore/SwiftUI/View Components/AsyncFallibleButton.swift b/AltStore/SwiftUI/View Components/AsyncFallibleButton.swift index 24a91402..b6cd6af8 100644 --- a/AltStore/SwiftUI/View Components/AsyncFallibleButton.swift +++ b/AltStore/SwiftUI/View Components/AsyncFallibleButton.swift @@ -88,7 +88,7 @@ struct AsyncFallibleButton: View { } catch { DispatchQueue.main.async { state = .error - errorAlertMessage = (error as? LocalizedError)?.failureReason ?? error.localizedDescription + errorAlertMessage = error.message() showErrorAlert = true } } diff --git a/AltStore/SwiftUI/Views/Onboarding/OnboardingView.swift b/AltStore/SwiftUI/Views/Onboarding/OnboardingView.swift index 5fb6870f..9aae7a94 100644 --- a/AltStore/SwiftUI/Views/Onboarding/OnboardingView.swift +++ b/AltStore/SwiftUI/Views/Onboarding/OnboardingView.swift @@ -315,7 +315,7 @@ extension OnboardingView { try! FileManager.default.removeItem(at: FileManager.default.documentsDirectory.appendingPathComponent("\(pairingFileName)")) NotificationManager.shared.reportError(error: error) debugPrint("minimuxer failed to start, please restart SideStore.", error) -// displayError("minimuxer failed to start, please restart SideStore. \((error as? LocalizedError)?.failureReason ?? "UNKNOWN ERROR!!!!!! REPORT TO GITHUB ISSUES!")") +// displayError("minimuxer failed to start, please restart SideStore. \(error.message())") } start_auto_mounter(documentsDirectory) }