Make app run on iOS 17 and up.

This commit is contained in:
Brent Simmons committed 2026-03-29 21:31:02 -07:00
1 parent 9e277236cf
commit 4a2c62cc6c
43 files changed
+127 -82

No files matched your search

@@ -8,7 +8,7 @@
import AppKit
import UserNotifications
import Synchronization
import os
import Articles
import Account
+2 -2
View File
@@ -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 {
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
@@ -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<State>
private let state: OSAllocatedUnfairLock<State>
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
}
@@ -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
+1 -1
View File
@@ -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",
@@ -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)
@@ -7,7 +7,6 @@
//
import Foundation
import Synchronization
import RSCore
import RSDatabase
import RSDatabaseObjC
@@ -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<ArticleStatus> {
state.withLock { Set($0.dictionary.values) }
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
@@ -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<Credentials?>(nil)
private let credentialsLock = OSAllocatedUnfairLock<Credentials?>(initialState: nil)
public var credentials: Credentials? {
get { credentialsLock.withLock { $0 }}
set { credentialsLock.withLock { $0 = newValue }}
+1 -1
View File
@@ -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"]),
@@ -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
+2 -2
View File
@@ -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<T: CacheRecord>: 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
@@ -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 {
+1 -1
View File
@@ -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",
@@ -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() {
//
@@ -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<State>
private let state: OSAllocatedUnfairLock<State>
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) }
}
@@ -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<String>())
private let objectIDsWithNoRelatedObjects = OSAllocatedUnfairLock(initialState: Set<String>())
public init(name: String, objectIDKey: String, relatedObjectIDKey: String, relatedTable: DatabaseRelatedObjectsTable, relationshipName: String) {
self.name = name
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
+1 -1
View File
@@ -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",
@@ -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
@@ -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
}
+3 -1
View File
@@ -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 {
@@ -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):
@@ -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):
+10 -5
View File
@@ -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
@@ -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]
@@ -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 {
+12 -4
View File
@@ -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()
+1 -1
View File
@@ -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)
+12 -3
View File
@@ -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
+2 -2
View File
@@ -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 {
@@ -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
+1 -1
View File
@@ -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