mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-05 03:37:41 +00:00
Merged main to branch.
This commit is contained in:
commit
5e39b569a7
340 files changed
+22510
-2624
No files matched your search
@@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class CroppingPreviewParameters: UIPreviewParameters {
|
||||
final class CroppingPreviewParameters: UIPreviewParameters {
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class ImageHeaderView: UITableViewHeaderFooterView {
|
||||
final class ImageHeaderView: UITableViewHeaderFooterView {
|
||||
|
||||
static let rowHeight = CGFloat(integerLiteral: 88)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
@IBDesignable
|
||||
class InteractiveLabel: UILabel, UIEditMenuInteractionDelegate {
|
||||
final class InteractiveLabel: UILabel, UIEditMenuInteractionDelegate {
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class ModalNavigationController: UINavigationController {
|
||||
final class ModalNavigationController: UINavigationController {
|
||||
|
||||
override func viewDidLayoutSubviews() {
|
||||
super.viewDidLayoutSubviews()
|
||||
|
||||
@@ -10,7 +10,7 @@ import Foundation
|
||||
|
||||
import UIKit
|
||||
|
||||
class NonIntrinsicButton: UIButton {
|
||||
final class NonIntrinsicButton: UIButton {
|
||||
|
||||
// Prevent autolayout from messing around with our frame settings
|
||||
override var intrinsicContentSize: CGSize {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class NonIntrinsicImageView: UIImageView {
|
||||
final class NonIntrinsicImageView: UIImageView {
|
||||
|
||||
// Prevent autolayout from messing around with our frame settings
|
||||
override var intrinsicContentSize: CGSize {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class NonIntrinsicLabel: UILabel {
|
||||
final class NonIntrinsicLabel: UILabel {
|
||||
|
||||
// Prevent autolayout from messing around with our frame settings
|
||||
override var intrinsicContentSize: CGSize {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class RoundedProgressView: UIProgressView {
|
||||
final class RoundedProgressView: UIProgressView {
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
@available(*, deprecated, message: "UISliders in iOS 26 come with tickmarks.")
|
||||
class TickMarkSlider: UISlider {
|
||||
final class TickMarkSlider: UISlider {
|
||||
|
||||
private var enableFeedback = false
|
||||
private let feedbackGenerator = UISelectionFeedbackGenerator()
|
||||
|
||||
@@ -47,8 +47,14 @@ extension UIViewController {
|
||||
presentError(title: errorTitle, message: informativeText, dismiss: dismiss)
|
||||
}
|
||||
} else {
|
||||
let errorTitle = NSLocalizedString("Error", comment: "Error")
|
||||
presentError(title: errorTitle, message: error.localizedDescription, dismiss: dismiss)
|
||||
// Check if error supports recovery options
|
||||
if let recoverableError = error as? (RecoverableError & LocalizedError),
|
||||
!recoverableError.recoveryOptions.isEmpty {
|
||||
presentErrorWithRecovery(error: recoverableError, dismiss: dismiss)
|
||||
} else {
|
||||
let errorTitle = NSLocalizedString("Error", comment: "Error")
|
||||
presentError(title: errorTitle, message: error.localizedDescription, dismiss: dismiss)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,5 +92,28 @@ private extension UIViewController {
|
||||
|
||||
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
|
||||
dismiss?()
|
||||
_ = 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)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class VibrantButton: UIButton {
|
||||
final class VibrantButton: UIButton {
|
||||
|
||||
@IBInspectable var backgroundHighlightColor: UIColor = AppAssets.secondaryAccentColor
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class VibrantLabel: UILabel {
|
||||
final class VibrantLabel: UILabel {
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
Reference in new issue
Block a user