mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-01 09:50:16 +00:00
Clean whitespace-only lines.
This commit is contained in:
1 parent
9827300a9a
commit
9efde554d4
452 files changed
+5354
-5354
No files matched your search
@@ -11,7 +11,7 @@ import RSCore
|
||||
import Account
|
||||
|
||||
extension UIViewController {
|
||||
|
||||
|
||||
func presentError(_ error: Error, dismiss: (() -> Void)? = nil) {
|
||||
if let accountError = error as? AccountError, accountError.isCredentialsError {
|
||||
presentAccountError(accountError, dismiss: dismiss)
|
||||
@@ -41,7 +41,7 @@ extension UIViewController {
|
||||
let localizedError = NSLocalizedString("This theme cannot be used because of data corruption in the Info.plist. %@.", comment: "Decoding key missing")
|
||||
informativeText = NSString.localizedStringWithFormat(localizedError as NSString, debugDescription) as String
|
||||
presentError(title: errorTitle, message: informativeText, dismiss: dismiss)
|
||||
|
||||
|
||||
default:
|
||||
informativeText = error.localizedDescription
|
||||
presentError(title: errorTitle, message: informativeText, dismiss: dismiss)
|
||||
@@ -61,44 +61,44 @@ extension UIViewController {
|
||||
}
|
||||
|
||||
private extension UIViewController {
|
||||
|
||||
|
||||
func presentAccountError(_ error: AccountError, dismiss: (() -> Void)? = nil) {
|
||||
let title = NSLocalizedString("Account Error", comment: "Account Error")
|
||||
let alertController = UIAlertController(title: title, message: error.localizedDescription, preferredStyle: .alert)
|
||||
|
||||
|
||||
if error.account?.type == .feedbin {
|
||||
|
||||
let credentialsTitle = NSLocalizedString("Update Credentials", comment: "Update Credentials")
|
||||
let credentialsAction = UIAlertAction(title: credentialsTitle, style: .default) { [weak self] _ in
|
||||
dismiss?()
|
||||
|
||||
|
||||
let navController = UIStoryboard.account.instantiateViewController(withIdentifier: "FeedbinAccountNavigationViewController") as! UINavigationController
|
||||
navController.modalPresentationStyle = .formSheet
|
||||
let addViewController = navController.topViewController as! FeedbinAccountViewController
|
||||
addViewController.account = error.account
|
||||
self?.present(navController, animated: true)
|
||||
}
|
||||
|
||||
|
||||
alertController.addAction(credentialsAction)
|
||||
alertController.preferredAction = credentialsAction
|
||||
|
||||
}
|
||||
|
||||
|
||||
let dismissTitle = NSLocalizedString("OK", comment: "OK")
|
||||
let dismissAction = UIAlertAction(title: dismissTitle, style: .default) { _ in
|
||||
dismiss?()
|
||||
}
|
||||
alertController.addAction(dismissAction)
|
||||
|
||||
|
||||
self.present(alertController, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
|
||||
func presentErrorWithRecovery(error: RecoverableError & LocalizedError, dismiss: (() -> Void)? = nil) {
|
||||
let title = error.errorDescription ?? NSLocalizedString("Error", comment: "Error")
|
||||
let message = [error.failureReason, error.recoverySuggestion].compactMap { $0 }.joined(separator: " ")
|
||||
|
||||
|
||||
let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
|
||||
|
||||
|
||||
// Add recovery options as buttons
|
||||
for (index, option) in error.recoveryOptions.enumerated() {
|
||||
let action = UIAlertAction(title: option, style: index == 0 ? .default : .cancel) { _ in
|
||||
@@ -106,13 +106,13 @@ private extension UIViewController {
|
||||
_ = error.attemptRecovery(optionIndex: index)
|
||||
}
|
||||
alertController.addAction(action)
|
||||
|
||||
|
||||
// Make the first option the preferred action
|
||||
if index == 0 {
|
||||
alertController.preferredAction = action
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
self.present(alertController, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user