diff --git a/Mac/Inspector/FeedInspectorViewController.swift b/Mac/Inspector/FeedInspectorViewController.swift index ab03d606e..ab6b50fa4 100644 --- a/Mac/Inspector/FeedInspectorViewController.swift +++ b/Mac/Inspector/FeedInspectorViewController.swift @@ -8,7 +8,7 @@ import AppKit import UserNotifications -import Synchronization +import os import Articles import Account diff --git a/Mac/ShareExtension/ShareViewController.swift b/Mac/ShareExtension/ShareViewController.swift index a8ce721ff..bbb72839b 100644 --- a/Mac/ShareExtension/ShareViewController.swift +++ b/Mac/ShareExtension/ShareViewController.swift @@ -8,7 +8,7 @@ import AppKit import UniformTypeIdentifiers -import Synchronization +import os final class ShareViewController: NSViewController { @IBOutlet var nameTextField: NSTextField! @@ -17,7 +17,7 @@ final class ShareViewController: NSViewController { private struct State: Sendable { var url: URL? } - private let state = Mutex(State()) + private let state = OSAllocatedUnfairLock(initialState: State()) nonisolated private var url: URL? { get { diff --git a/Modules/Account/Package.swift b/Modules/Account/Package.swift index 48cd0733c..9a37db0cb 100644 --- a/Modules/Account/Package.swift +++ b/Modules/Account/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "Account", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library( name: "Account", diff --git a/Modules/Articles/Package.swift b/Modules/Articles/Package.swift index 0de0b468b..1f74f3c6f 100644 --- a/Modules/Articles/Package.swift +++ b/Modules/Articles/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "Articles", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library( name: "Articles", diff --git a/Modules/Articles/Sources/Articles/ArticleStatus.swift b/Modules/Articles/Sources/Articles/ArticleStatus.swift index 0bcc10aae..5e664a8bc 100644 --- a/Modules/Articles/Sources/Articles/ArticleStatus.swift +++ b/Modules/Articles/Sources/Articles/ArticleStatus.swift @@ -7,7 +7,7 @@ // import Foundation -import Synchronization +import os public final class ArticleStatus: Hashable, Sendable { @@ -27,7 +27,7 @@ public final class ArticleStatus: Hashable, Sendable { var starred: Bool } - private let state: Mutex + private let state: OSAllocatedUnfairLock public var read: Bool { get { @@ -49,7 +49,7 @@ public final class ArticleStatus: Hashable, Sendable { public init(articleID: String, read: Bool, starred: Bool, dateArrived: Date) { self.articleID = articleID - self.state = Mutex(State(read: read, starred: starred)) + self.state = OSAllocatedUnfairLock(initialState: State(read: read, starred: starred)) self.dateArrived = dateArrived } diff --git a/Modules/Articles/Sources/Articles/DatabaseID.swift b/Modules/Articles/Sources/Articles/DatabaseID.swift index a0ba58d82..a9379f1bd 100644 --- a/Modules/Articles/Sources/Articles/DatabaseID.swift +++ b/Modules/Articles/Sources/Articles/DatabaseID.swift @@ -8,9 +8,9 @@ import Foundation import RSCore -import Synchronization +import os -private let databaseIDCache = Mutex([String: String]()) +private let databaseIDCache = OSAllocatedUnfairLock(initialState: [String: String]()) public func databaseIDWithString(_ s: String) -> String { databaseIDCache.withLock { cache in diff --git a/Modules/ArticlesDatabase/Package.swift b/Modules/ArticlesDatabase/Package.swift index 0762a0997..bd31ac17a 100644 --- a/Modules/ArticlesDatabase/Package.swift +++ b/Modules/ArticlesDatabase/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "ArticlesDatabase", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library( name: "ArticlesDatabase", diff --git a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift index 4074c0123..822a4e751 100644 --- a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift +++ b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/ArticlesTable.swift @@ -7,7 +7,7 @@ // import Foundation -import Synchronization +import os import RSCore import RSDatabase import RSDatabaseObjC @@ -23,7 +23,7 @@ final class ArticlesTable: DatabaseTable, Sendable { private let searchTable: SearchTable private let authorsLookupTable: DatabaseLookupTable private let retentionStyle: ArticlesDatabase.RetentionStyle - private let articlesCache = Mutex([String: Article]()) + private let articlesCache = OSAllocatedUnfairLock(initialState: [String: Article]()) // TODO: update articleCutoffDate as time passes and based on user preferences. let articleCutoffDate = Date().bySubtracting(days: 90) diff --git a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/SearchTable.swift b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/SearchTable.swift index 9bc1835aa..3e3de26a0 100644 --- a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/SearchTable.swift +++ b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/SearchTable.swift @@ -7,7 +7,6 @@ // import Foundation -import Synchronization import RSCore import RSDatabase import RSDatabaseObjC diff --git a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/StatusesTable.swift b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/StatusesTable.swift index bc15d5c6b..43092cadd 100644 --- a/Modules/ArticlesDatabase/Sources/ArticlesDatabase/StatusesTable.swift +++ b/Modules/ArticlesDatabase/Sources/ArticlesDatabase/StatusesTable.swift @@ -7,7 +7,7 @@ // import Foundation -import Synchronization +import os import RSCore import RSDatabase import RSDatabaseObjC @@ -272,7 +272,7 @@ private final class StatusCache: Sendable { var dictionary = [String: ArticleStatus]() } - private let state = Mutex(State()) + private let state = OSAllocatedUnfairLock(initialState: State()) var cachedStatuses: Set { state.withLock { Set($0.dictionary.values) } diff --git a/Modules/CloudKitSync/Package.swift b/Modules/CloudKitSync/Package.swift index 0fe53ffb5..c1cbdfac7 100644 --- a/Modules/CloudKitSync/Package.swift +++ b/Modules/CloudKitSync/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "CloudKitSync", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library( name: "CloudKitSync", diff --git a/Modules/ErrorLog/Package.swift b/Modules/ErrorLog/Package.swift index 892975bc2..2115c45f8 100644 --- a/Modules/ErrorLog/Package.swift +++ b/Modules/ErrorLog/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "ErrorLog", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library( name: "ErrorLog", diff --git a/Modules/FeedFinder/Package.swift b/Modules/FeedFinder/Package.swift index 50908b019..f4a183493 100644 --- a/Modules/FeedFinder/Package.swift +++ b/Modules/FeedFinder/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "FeedFinder", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library( name: "FeedFinder", diff --git a/Modules/NewsBlur/Package.swift b/Modules/NewsBlur/Package.swift index 1e0b48c77..8259306e9 100644 --- a/Modules/NewsBlur/Package.swift +++ b/Modules/NewsBlur/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "NewsBlur", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library( name: "NewsBlur", diff --git a/Modules/NewsBlur/Sources/NewsBlur/NewsBlurAPICaller.swift b/Modules/NewsBlur/Sources/NewsBlur/NewsBlurAPICaller.swift index c923f647b..fa7033d7e 100644 --- a/Modules/NewsBlur/Sources/NewsBlur/NewsBlurAPICaller.swift +++ b/Modules/NewsBlur/Sources/NewsBlur/NewsBlurAPICaller.swift @@ -7,7 +7,7 @@ // import Foundation -import Synchronization +import os import RSWeb import Secrets @@ -17,13 +17,13 @@ public final class NewsBlurAPICaller: Sendable { let baseURL = URL(string: "https://www.newsblur.com/")! let transport: Transport - private let suspendedLock = Mutex(false) + private let suspendedLock = OSAllocatedUnfairLock(initialState: false) var suspended: Bool { get { suspendedLock.withLock { $0 }} set { suspendedLock.withLock { $0 = newValue }} } - private let credentialsLock = Mutex(nil) + private let credentialsLock = OSAllocatedUnfairLock(initialState: nil) public var credentials: Credentials? { get { credentialsLock.withLock { $0 }} set { credentialsLock.withLock { $0 = newValue }} diff --git a/Modules/RSCore/Package.swift b/Modules/RSCore/Package.swift index 036cd611b..ccb4ca576 100644 --- a/Modules/RSCore/Package.swift +++ b/Modules/RSCore/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "RSCore", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library(name: "RSCore", type: .dynamic, targets: ["RSCore"]), .library(name: "RSCoreObjC", type: .dynamic, targets: ["RSCoreObjC"]), diff --git a/Modules/RSCore/Sources/RSCore/BinaryDiskCache.swift b/Modules/RSCore/Sources/RSCore/BinaryDiskCache.swift index 723622ac8..aac68f50f 100644 --- a/Modules/RSCore/Sources/RSCore/BinaryDiskCache.swift +++ b/Modules/RSCore/Sources/RSCore/BinaryDiskCache.swift @@ -7,11 +7,11 @@ // import Foundation -import Synchronization +import os nonisolated public final class BinaryDiskCache: Sendable { public let folder: String - private let mutex = Mutex(()) + private let mutex = OSAllocatedUnfairLock(initialState: ()) public init(folder: String) { self.folder = folder diff --git a/Modules/RSCore/Sources/RSCore/Cache.swift b/Modules/RSCore/Sources/RSCore/Cache.swift index 2b1baf913..bf027497d 100644 --- a/Modules/RSCore/Sources/RSCore/Cache.swift +++ b/Modules/RSCore/Sources/RSCore/Cache.swift @@ -6,7 +6,7 @@ // import Foundation -import Synchronization +import os public protocol CacheRecord: Sendable { var dateCreated: Date { get } @@ -21,7 +21,7 @@ public final class Cache: Sendable { var lastCleanupDate = Date() var cache = [String: T]() } - private let stateLock = Mutex(State()) + private let stateLock = OSAllocatedUnfairLock(initialState: State()) public init(timeToLive: TimeInterval, timeBetweenCleanups: TimeInterval) { self.timeToLive = timeToLive diff --git a/Modules/RSCore/Sources/RSCore/MainThreadOperation.swift b/Modules/RSCore/Sources/RSCore/MainThreadOperation.swift index 3b07e3f98..122107389 100644 --- a/Modules/RSCore/Sources/RSCore/MainThreadOperation.swift +++ b/Modules/RSCore/Sources/RSCore/MainThreadOperation.swift @@ -7,7 +7,7 @@ // import Foundation -import Synchronization +import os /// Code to be run by MainThreadOperationQueue on @MainActor. /// @@ -31,7 +31,7 @@ import Synchronization private struct State: Sendable { var isCanceled = false } - private let state = Mutex(State()) + private let state = OSAllocatedUnfairLock(initialState: State()) // Check this at appropriate times in case the operation has been canceled. nonisolated public var isCanceled: Bool { diff --git a/Modules/RSDatabase/Package.swift b/Modules/RSDatabase/Package.swift index 9b8315c72..5c7a8d85f 100644 --- a/Modules/RSDatabase/Package.swift +++ b/Modules/RSDatabase/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "RSDatabase", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library( name: "RSDatabase", diff --git a/Modules/RSDatabase/Sources/RSDatabase/DatabaseObjectCache.swift b/Modules/RSDatabase/Sources/RSDatabase/DatabaseObjectCache.swift index 52834d8d2..e553588a6 100644 --- a/Modules/RSDatabase/Sources/RSDatabase/DatabaseObjectCache.swift +++ b/Modules/RSDatabase/Sources/RSDatabase/DatabaseObjectCache.swift @@ -7,10 +7,10 @@ // import Foundation -import Synchronization +import os public final class DatabaseObjectCache: Sendable { - private let state = Mutex([String: DatabaseObject]()) + private let state = OSAllocatedUnfairLock(initialState: [String: DatabaseObject]()) public init() { // diff --git a/Modules/RSDatabase/Sources/RSDatabase/DatabaseQueue.swift b/Modules/RSDatabase/Sources/RSDatabase/DatabaseQueue.swift index 681c2188b..40e558fd5 100644 --- a/Modules/RSDatabase/Sources/RSDatabase/DatabaseQueue.swift +++ b/Modules/RSDatabase/Sources/RSDatabase/DatabaseQueue.swift @@ -7,7 +7,7 @@ // import Foundation -import Synchronization +import os import os import SQLite3 import RSDatabaseObjC @@ -17,7 +17,7 @@ import RSDatabaseObjC /// On iOS, the queue can be suspended /// in order to support background refreshing. public final class DatabaseQueue: Sendable { - private struct State { + private struct State: @unchecked Sendable { var isCallingDatabase = false var isSuspended = false let database: FMDatabase @@ -27,7 +27,7 @@ public final class DatabaseQueue: Sendable { } } - private let state: Mutex + private let state: OSAllocatedUnfairLock private let databasePath: String private let serialDispatchQueue: DispatchQueue @@ -40,7 +40,7 @@ public final class DatabaseQueue: Sendable { self.databasePath = databasePath let database = FMDatabase(path: databasePath)! - self.state = Mutex(State(database)) + self.state = OSAllocatedUnfairLock(initialState: State(database)) self.state.withLock { openDatabase($0.database) } } diff --git a/Modules/RSDatabase/Sources/RSDatabase/Related Objects/DatabaseLookupTable.swift b/Modules/RSDatabase/Sources/RSDatabase/Related Objects/DatabaseLookupTable.swift index 0eed88910..772898ba4 100644 --- a/Modules/RSDatabase/Sources/RSDatabase/Related Objects/DatabaseLookupTable.swift +++ b/Modules/RSDatabase/Sources/RSDatabase/Related Objects/DatabaseLookupTable.swift @@ -7,7 +7,7 @@ // import Foundation -import Synchronization +import os import RSDatabaseObjC // Implement a lookup table for a many-to-many relationship. @@ -28,7 +28,7 @@ public final class DatabaseLookupTable: Sendable { // the context of a serial dispatch queue. But the Mutex proves // to the compiler that this is Sendable, and the cost of that is so small. // (The Mutex will never face contention.) - private let objectIDsWithNoRelatedObjects = Mutex(Set()) + private let objectIDsWithNoRelatedObjects = OSAllocatedUnfairLock(initialState: Set()) public init(name: String, objectIDKey: String, relatedObjectIDKey: String, relatedTable: DatabaseRelatedObjectsTable, relationshipName: String) { self.name = name diff --git a/Modules/RSMarkdown/Package.swift b/Modules/RSMarkdown/Package.swift index 16a32b69e..42a5cefe3 100644 --- a/Modules/RSMarkdown/Package.swift +++ b/Modules/RSMarkdown/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "RSMarkdown", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library( name: "RSMarkdown", diff --git a/Modules/RSParser/Package.swift b/Modules/RSParser/Package.swift index 2a420bb7b..ade219a4e 100644 --- a/Modules/RSParser/Package.swift +++ b/Modules/RSParser/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "RSParser", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library( name: "RSParser", diff --git a/Modules/RSTree/Package.swift b/Modules/RSTree/Package.swift index 62957b18a..4f6250c16 100644 --- a/Modules/RSTree/Package.swift +++ b/Modules/RSTree/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "RSTree", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library( name: "RSTree", diff --git a/Modules/RSWeb/Package.swift b/Modules/RSWeb/Package.swift index ae0cdfc68..e3663cb9c 100644 --- a/Modules/RSWeb/Package.swift +++ b/Modules/RSWeb/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "RSWeb", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library( name: "RSWeb", diff --git a/Modules/Secrets/Package.swift b/Modules/Secrets/Package.swift index e6038c309..b712e8361 100644 --- a/Modules/Secrets/Package.swift +++ b/Modules/Secrets/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "Secrets", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library( name: "Secrets", diff --git a/Modules/SyncDatabase/Package.swift b/Modules/SyncDatabase/Package.swift index 73fdd6feb..ef392c8d3 100644 --- a/Modules/SyncDatabase/Package.swift +++ b/Modules/SyncDatabase/Package.swift @@ -3,7 +3,7 @@ import PackageDescription let package = Package( name: "SyncDatabase", - platforms: [.macOS(.v15), .iOS(.v26)], + platforms: [.macOS(.v15), .iOS(.v17)], products: [ .library( name: "SyncDatabase", diff --git a/Shared/ArticleStyles/ArticleThemesManager.swift b/Shared/ArticleStyles/ArticleThemesManager.swift index c7078e813..be3af5f97 100644 --- a/Shared/ArticleStyles/ArticleThemesManager.swift +++ b/Shared/ArticleStyles/ArticleThemesManager.swift @@ -7,7 +7,7 @@ // import Foundation -import Synchronization +import os import RSCore public extension Notification.Name { @@ -59,7 +59,7 @@ final class ArticleThemesManager: NSObject, NSFilePresenter, Sendable { var currentTheme = ArticleTheme.defaultTheme var themeNames = [AppDefaults.defaultThemeName] } - private let state = Mutex(State()) + private let state = OSAllocatedUnfairLock(initialState: State()) @MainActor private var didStart = false diff --git a/Shared/ShareExtension/ExtensionFeedAddRequestFile.swift b/Shared/ShareExtension/ExtensionFeedAddRequestFile.swift index f673ea750..4990ecc04 100644 --- a/Shared/ShareExtension/ExtensionFeedAddRequestFile.swift +++ b/Shared/ShareExtension/ExtensionFeedAddRequestFile.swift @@ -7,7 +7,6 @@ // import Foundation -import Synchronization import os import Account @@ -36,21 +35,19 @@ final class ExtensionFeedAddRequestFile: NSObject, NSFilePresenter, Sendable { operationQueue } - private let didStart = Mutex(false) + private let didStart = OSAllocatedUnfairLock(initialState: false) func start() { - var shouldBail = false - didStart.withLock { didStart in + let alreadyStarted = didStart.withLock { didStart -> Bool in if didStart { - shouldBail = true - assertionFailure("start called when already did start") - return + return true } - didStart = true + return false } - if shouldBail { + if alreadyStarted { + assertionFailure("start called when already did start") return } diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index 18bad9d98..faeed1770 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -175,7 +175,9 @@ final class ArticleViewController: UIViewController { override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(true) - navigationController?.navigationBar.topItem?.subtitle = nil + if #available(iOS 26, *) { + navigationController?.navigationBar.topItem?.subtitle = nil + } coordinator.isArticleViewControllerPending = false searchBar.shouldBeginEditing = true if let parentNavController = navigationController?.parent as? UINavigationController { diff --git a/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift index d3dec1474..0ae9cb381 100644 --- a/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift +++ b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewCell.swift @@ -86,7 +86,12 @@ final class MainFeedCollectionViewCell: UICollectionViewCell { } override func updateConfiguration(using state: UICellConfigurationState) { - var backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state) + var backgroundConfig: UIBackgroundConfiguration + if #available(iOS 18, *) { + backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state) + } else { + backgroundConfig = UIBackgroundConfiguration.listGroupedCell().updated(for: state) + } switch (state.isHighlighted || state.isSelected || state.isFocused, traitCollection.userInterfaceIdiom) { case (true, .pad): diff --git a/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift index 26c5fc6f5..4bad2d733 100644 --- a/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift +++ b/iOS/MainFeed/Collection View Cells/MainFeedCollectionViewFolderCell.swift @@ -116,7 +116,12 @@ class MainFeedCollectionViewFolderCell: UICollectionViewCell { } override func updateConfiguration(using state: UICellConfigurationState) { - var backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state) + var backgroundConfig: UIBackgroundConfiguration + if #available(iOS 18, *) { + backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state) + } else { + backgroundConfig = UIBackgroundConfiguration.listGroupedCell().updated(for: state) + } switch (state.isHighlighted || state.isSelected || state.isFocused, traitCollection.userInterfaceIdiom) { case (true, .pad): diff --git a/iOS/MainFeed/RefreshProgressView.swift b/iOS/MainFeed/RefreshProgressView.swift index cd99c5ddd..5654341e8 100644 --- a/iOS/MainFeed/RefreshProgressView.swift +++ b/iOS/MainFeed/RefreshProgressView.swift @@ -14,6 +14,9 @@ final class RefreshProgressView: UIView { private let progressView = UIProgressView(progressViewStyle: .default) private let label = UILabel() + // TODO: Remove testing flag — hardcoded 50% for testing visibility + private let isTesting = true + override init(frame: CGRect) { super.init(frame: frame) setup() @@ -82,14 +85,16 @@ private extension RefreshProgressView { isAccessibilityElement = true accessibilityTraits = [.updatesFrequently, .notEnabled] - - // TODO: Remove — hardcoded 50% for testing visibility - label.isHidden = true - progressView.isHidden = false - progressView.setProgress(0.5, animated: false) } func progressChanged(animated: Bool) { + if isTesting { + label.isHidden = true + progressView.isHidden = false + progressView.setProgress(0.5, animated: false) + return + } + // Layout may crash if not in the view hierarchy. // https://github.com/Ranchero-Software/NetNewsWire/issues/1764 let isInViewHierarchy = self.superview != nil diff --git a/iOS/MainTimeline/Cells/MainTimelineCollectionViewCell.swift b/iOS/MainTimeline/Cells/MainTimelineCollectionViewCell.swift index 785760eee..02d0234ec 100644 --- a/iOS/MainTimeline/Cells/MainTimelineCollectionViewCell.swift +++ b/iOS/MainTimeline/Cells/MainTimelineCollectionViewCell.swift @@ -317,7 +317,12 @@ class MainTimelineCollectionViewCell: UICollectionViewCell { override func updateConfiguration(using state: UICellConfigurationState) { super.updateConfiguration(using: state) - var backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state) + var backgroundConfig: UIBackgroundConfiguration + if #available(iOS 18, *) { + backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state) + } else { + backgroundConfig = UIBackgroundConfiguration.listGroupedCell().updated(for: state) + } backgroundConfig.cornerRadius = 20 backgroundConfig.edgesAddingLayoutMarginsToBackgroundInsets = [.leading, .trailing] diff --git a/iOS/MainTimeline/MainTimelineModernViewController.swift b/iOS/MainTimeline/MainTimelineModernViewController.swift index a0ebbb323..d8861c837 100644 --- a/iOS/MainTimeline/MainTimelineModernViewController.swift +++ b/iOS/MainTimeline/MainTimelineModernViewController.swift @@ -188,7 +188,9 @@ final class MainTimelineModernViewController: UIViewController, UndoableCommandR navigationItem.title = nil // Don’t let "Timeline" accidentally show navigationItem.largeTitleDisplayMode = .never navigationItem.titleView = navigationBarTitleLabel - navigationItem.subtitleView = navigationBarSubtitleTitleLabel + if #available(iOS 26, *) { + navigationItem.subtitleView = navigationBarSubtitleTitleLabel + } // Do any additional setup after loading the view. } @@ -273,7 +275,7 @@ final class MainTimelineModernViewController: UIViewController, UndoableCommandR } func updateNavigationBarSubtitle(_ text: String) { - if let label = navigationItem.subtitleView as? UILabel { + if #available(iOS 26, *), let label = navigationItem.subtitleView as? UILabel { label.text = text label.isUserInteractionEnabled = ((coordinator?.timelineFeed as? PseudoFeed) == nil) label.sizeToFit() @@ -631,7 +633,9 @@ private extension MainTimelineModernViewController { if traitCollection.userInterfaceIdiom == .pad { searchController.searchBar.selectedScopeButtonIndex = 1 - navigationItem.searchBarPlacementAllowsExternalIntegration = true + if #available(iOS 26, *) { + navigationItem.searchBarPlacementAllowsExternalIntegration = true + } } } @@ -848,7 +852,9 @@ private extension MainTimelineModernViewController { func configureToolbar() { if traitCollection.userInterfaceIdiom == .phone { toolbarItems?.insert(.flexibleSpace(), at: 1) - toolbarItems?.insert(navigationItem.searchBarPlacementBarButtonItem, at: 2) + if #available(iOS 26, *) { + toolbarItems?.insert(navigationItem.searchBarPlacementBarButtonItem, at: 2) + } } } @@ -857,7 +863,11 @@ private extension MainTimelineModernViewController { navigationItem.rightBarButtonItem = shouldShowFilterButton ? filterButton : nil if isReadArticlesFiltered { - filterButton.style = .prominent + if #available(iOS 26, *) { + filterButton.style = .prominent + } else { + filterButton.style = .done + } filterButton.tintColor = Assets.Colors.primaryAccent filterButton.accLabelText = NSLocalizedString("Selected - Filter Read Articles", comment: "Selected - Filter Read Articles") } else { diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index feca7e731..470697ed3 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -655,7 +655,9 @@ struct SidebarItemNode: Hashable, Sendable { let refreshText = NSString.localizedStringWithFormat(localizedRefreshText as NSString, refreshed) as String // Update Feeds with Updated text - self.mainFeedCollectionViewController?.navigationItem.subtitle = refreshText + if #available(iOS 26, *) { + self.mainFeedCollectionViewController?.navigationItem.subtitle = refreshText + } // If unread count > 0, add unread string to timeline if timelineFeed != nil, timelineUnreadCount > 0 { @@ -672,7 +674,9 @@ struct SidebarItemNode: Hashable, Sendable { } } else { // Use 'Updated Just Now' while <60s have passed since refresh. - self.mainFeedCollectionViewController?.navigationItem.subtitle = NSLocalizedString("Updated Just Now", comment: "Updated Just Now") + if #available(iOS 26, *) { + self.mainFeedCollectionViewController?.navigationItem.subtitle = NSLocalizedString("Updated Just Now", comment: "Updated Just Now") + } // If unread count > 0, add unread string to timeline if timelineFeed != nil, timelineUnreadCount > 0 { @@ -689,7 +693,9 @@ struct SidebarItemNode: Hashable, Sendable { } } } else { - self.mainFeedCollectionViewController?.navigationItem.subtitle = "" + if #available(iOS 26, *) { + self.mainFeedCollectionViewController?.navigationItem.subtitle = "" + } // If unread count > 0, add unread string to timeline if timelineFeed != nil, timelineUnreadCount > 0 { let localizedUnreadCount = NSLocalizedString("%i Unread", comment: "14 Unread") @@ -706,7 +712,9 @@ struct SidebarItemNode: Hashable, Sendable { } } else { // Updating in progress, apply to both iPhone and iPad Feeds. - self.mainFeedCollectionViewController?.navigationItem.subtitle = NSLocalizedString("Updating…", comment: "Updating…") + if #available(iOS 26, *) { + self.mainFeedCollectionViewController?.navigationItem.subtitle = NSLocalizedString("Updating…", comment: "Updating…") + } } scheduleNavigationBarSubtitleUpdate() diff --git a/iOS/Settings/AboutView.swift b/iOS/Settings/AboutView.swift index 2498d87e6..bb0eb6484 100644 --- a/iOS/Settings/AboutView.swift +++ b/iOS/Settings/AboutView.swift @@ -15,7 +15,7 @@ struct AboutView: View { Image("nnwFeedIcon") .resizable() .frame(width: 100, height: 100) - .clipShape(ConcentricRectangle(corners: .fixed(20))) + .clipShape(RoundedRectangle(cornerRadius: 20)) Text(verbatim: "NetNewsWire") .font(.largeTitle) diff --git a/iOS/Settings/TimelineCustomizerCell.swift b/iOS/Settings/TimelineCustomizerCell.swift index 06e916580..99c3dac85 100644 --- a/iOS/Settings/TimelineCustomizerCell.swift +++ b/iOS/Settings/TimelineCustomizerCell.swift @@ -22,12 +22,16 @@ final class TimelineCustomizerCell: UICollectionViewCell { case .numberOfLines: slider.minimumValue = 1 slider.maximumValue = 6 - slider.trackConfiguration = .init(allowsTickValuesOnly: true, numberOfTicks: 6) + if #available(iOS 26, *) { + slider.trackConfiguration = .init(allowsTickValuesOnly: true, numberOfTicks: 6) + } slider.value = Float(AppDefaults.shared.timelineNumberOfLines) case .iconSize: slider.minimumValue = 1 slider.maximumValue = 3 - slider.trackConfiguration = .init(allowsTickValuesOnly: true, numberOfTicks: 3) + if #available(iOS 26, *) { + slider.trackConfiguration = .init(allowsTickValuesOnly: true, numberOfTicks: 3) + } slider.value = Float(AppDefaults.shared.timelineIconSize.rawValue) case .none: return @@ -48,7 +52,12 @@ final class TimelineCustomizerCell: UICollectionViewCell { } override func updateConfiguration(using state: UICellConfigurationState) { - var backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state) + var backgroundConfig: UIBackgroundConfiguration + if #available(iOS 18, *) { + backgroundConfig = UIBackgroundConfiguration.listCell().updated(for: state) + } else { + backgroundConfig = UIBackgroundConfiguration.listGroupedCell().updated(for: state) + } backgroundConfig.backgroundColor = traitCollection.userInterfaceStyle == .dark ? .secondarySystemBackground : .white backgroundConfig.cornerRadius = 20 self.backgroundConfiguration = backgroundConfig diff --git a/iOS/ShareExtension/ShareViewController.swift b/iOS/ShareExtension/ShareViewController.swift index 2cceface5..1973353dc 100644 --- a/iOS/ShareExtension/ShareViewController.swift +++ b/iOS/ShareExtension/ShareViewController.swift @@ -8,7 +8,7 @@ import UIKit import MobileCoreServices -import Synchronization +import os import UniformTypeIdentifiers import Social import Account @@ -24,7 +24,7 @@ final class ShareViewController: SLComposeServiceViewController, ShareFolderPick private struct State { var url: URL? } - private let state = Mutex(State()) + private let state = OSAllocatedUnfairLock(initialState: State()) nonisolated private var url: URL? { get { diff --git a/xcconfig/NetNewsWire_iOSwidgetextension_target.xcconfig b/xcconfig/NetNewsWire_iOSwidgetextension_target.xcconfig index 8f69a728f..6c9a575e2 100644 --- a/xcconfig/NetNewsWire_iOSwidgetextension_target.xcconfig +++ b/xcconfig/NetNewsWire_iOSwidgetextension_target.xcconfig @@ -3,4 +3,4 @@ CODE_SIGN_ENTITLEMENTS = Widget/NetNewsWire_iOS_WidgetExtension.entitlements INFOPLIST_FILE = Widget/Info.plist PRODUCT_BUNDLE_IDENTIFIER = $(ORGANIZATION_IDENTIFIER).NetNewsWire.iOS$(BUNDLE_ID_SUFFIX).SpringboardWidgets -IPHONEOS_DEPLOYMENT_TARGET = 26.0 +IPHONEOS_DEPLOYMENT_TARGET = 17.0 diff --git a/xcconfig/NetNewsWire_project.xcconfig b/xcconfig/NetNewsWire_project.xcconfig index da955504d..d774bbde9 100644 --- a/xcconfig/NetNewsWire_project.xcconfig +++ b/xcconfig/NetNewsWire_project.xcconfig @@ -47,7 +47,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE GCC_WARN_UNUSED_FUNCTION = YES GCC_WARN_UNUSED_VARIABLE = YES MACOSX_DEPLOYMENT_TARGET = 15.0 -IPHONEOS_DEPLOYMENT_TARGET = 26.0 +IPHONEOS_DEPLOYMENT_TARGET = 17.0 //SDKROOT = macosx SWIFT_EMIT_LOC_STRINGS = YES SWIFT_SWIFT3_OBJC_INFERENCE = Off