Compare commits

...

25 Commits

Author SHA1 Message Date
Brent Simmons 30e961bfe4 Fix warning about unused @preconcurrency. 2024-05-04 15:19:48 -07:00
Brent Simmons bf02d1d86a Use targeted concurrency for the app. Remaining concurrency warnings will probably have to wait for future updates from Apple. 2024-05-04 15:19:30 -07:00
Brent Simmons 16cebcd60a Fix some concurrency warnings. 2024-05-04 11:05:45 -07:00
Brent Simmons 7f042b5d07 Fix concurrency warning. 2024-05-03 23:17:54 -07:00
Brent Simmons 19a39ac295 Make TimelineTitleView final. 2024-05-03 23:17:04 -07:00
Brent Simmons 3f8724c9d1 Silence concurrency warning. 2024-05-03 23:16:55 -07:00
Brent Simmons 1e80253018 Fix some concurrency warnings. 2024-05-03 23:10:57 -07:00
Brent Simmons 83298770c2 Fix concurrency warning. 2024-05-03 23:04:13 -07:00
Brent Simmons 7f545c5a23 Fix some concurrency warnings. 2024-05-03 23:03:31 -07:00
Brent Simmons db9a8c7feb Fix some concurrency warnings. 2024-05-03 23:01:35 -07:00
Brent Simmons 4ea66ee11e Fix some concurrency warnings. 2024-05-03 22:57:10 -07:00
Brent Simmons ea0a827024 Fix some concurrency warnings. 2024-05-03 22:56:42 -07:00
Brent Simmons fdbcf0d84e Fix concurrency warning. 2024-05-03 22:55:29 -07:00
Brent Simmons 7d04021415 Fix some concurrency warnings. 2024-05-03 22:49:27 -07:00
Brent Simmons 87fe78f598 Fix concurrency warning. 2024-05-03 22:47:14 -07:00
Brent Simmons 9dcfc2b09c Fix concurrency warning. 2024-05-03 22:35:20 -07:00
Brent Simmons 22d184c5f6 Fix concurrency warning. 2024-05-03 22:33:21 -07:00
Brent Simmons 09cf212057 Fix some concurrency warnings. 2024-05-03 22:32:48 -07:00
Brent Simmons 07091e0d3e Fix concurrency warning. 2024-05-03 22:28:26 -07:00
Brent Simmons 0a2b4f7008 Silence concurrency warning. 2024-05-03 22:25:14 -07:00
Brent Simmons 9403d81550 Fix concurrency warning. 2024-05-03 22:24:07 -07:00
Brent Simmons 78a64c3146 Make WebViewController fina. 2024-05-03 22:23:55 -07:00
Brent Simmons 18d0b0e1e7 Fix concurrency warning in SendToCommand. 2024-05-03 22:05:35 -07:00
Brent Simmons 2418076364 Fix some concurrency warnings. 2024-05-03 22:00:35 -07:00
Brent Simmons a9d50f3a14 Make some things private in UserApp. 2024-05-03 21:40:46 -07:00
28 changed files with 66 additions and 52 deletions

View File

@ -12,13 +12,10 @@ import AppKit
///
/// The app may or may not be running. It may or may not exist.
@MainActor public final class UserApp {
public final class UserApp {
public let bundleID: String
public var icon: NSImage? = nil
public var existsOnDisk = false
public var path: String? = nil
public var runningApplication: NSRunningApplication? = nil
public var isRunning: Bool {
@ -29,6 +26,10 @@ import AppKit
return false
}
private var icon: NSImage? = nil
private var path: String? = nil
private var runningApplication: NSRunningApplication? = nil
public init(bundleID: String) {
self.bundleID = bundleID

View File

@ -29,7 +29,7 @@ public protocol SendToCommand {
/// The image for the command.
///
/// Often the icon of the target application.
var image: RSImage? { get }
@MainActor var image: RSImage? { get }
/// Determine whether an object can be sent to the target application.
///

View File

@ -9,7 +9,7 @@
import AppKit
import Articles
import Core
import AppKitExtras
@preconcurrency import AppKitExtras
@MainActor final class SendToMarsEditCommand: SendToCommand {

View File

@ -9,7 +9,7 @@
import AppKit
import Articles
import Core
import AppKitExtras
@preconcurrency import AppKitExtras
// Not undoable.

View File

@ -12,9 +12,9 @@ import Web
struct CacheCleaner {
static let log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "CacheCleaner")
nonisolated(unsafe) static let log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "CacheCleaner")
static func purgeIfNecessary() {
@MainActor static func purgeIfNecessary() {
guard let flushDate = AppDefaults.shared.lastImageCacheFlushDate else {
AppDefaults.shared.lastImageCacheFlushDate = Date()

View File

@ -10,7 +10,7 @@ import Foundation
struct ShareDefaultContainer {
static func defaultContainer(containers: ExtensionContainers) -> ExtensionContainer? {
@MainActor static func defaultContainer(containers: ExtensionContainers) -> ExtensionContainer? {
if let accountID = AppDefaults.shared.addFeedAccountID, let account = containers.accounts.first(where: { $0.accountID == accountID }) {
if let folderName = AppDefaults.shared.addFeedFolderName, let folder = account.folders.first(where: { $0.name == folderName }) {
@ -26,7 +26,7 @@ struct ShareDefaultContainer {
}
static func saveDefaultContainer(_ container: ExtensionContainer) {
@MainActor static func saveDefaultContainer(_ container: ExtensionContainer) {
AppDefaults.shared.addFeedAccountID = container.accountID
if let folder = container as? ExtensionFolder {
AppDefaults.shared.addFeedFolderName = folder.name

View File

@ -24,7 +24,7 @@ public final class WidgetDataEncoder {
private lazy var containerURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroup)
private lazy var dataURL = containerURL?.appendingPathComponent("widget-data.json")
static let shared = WidgetDataEncoder()
@MainActor static let shared = WidgetDataEncoder()
private init () {}
func encodeWidgetData() throws {

View File

@ -11,10 +11,11 @@ import Account
import Core
protocol AddFeedFolderViewControllerDelegate {
func didSelect(container: Container)
@MainActor func didSelect(container: Container)
}
class AddFeedFolderViewController: UITableViewController {
final class AddFeedFolderViewController: UITableViewController {
var delegate: AddFeedFolderViewControllerDelegate?
var addFeedType = AddFeedType.web

View File

@ -17,7 +17,7 @@ enum AddFeedType {
case web
}
class AddFeedViewController: UITableViewController {
final class AddFeedViewController: UITableViewController {
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
@IBOutlet weak var addButton: UIBarButtonItem!
@ -166,6 +166,7 @@ class AddFeedViewController: UITableViewController {
// MARK: AddFeedFolderViewControllerDelegate
extension AddFeedViewController: AddFeedFolderViewControllerDelegate {
func didSelect(container: Container) {
self.container = container
updateFolderLabel()

View File

@ -31,7 +31,7 @@ final class AppDefaults {
static let defaultThemeName = "Defaults"
static let shared = AppDefaults()
nonisolated(unsafe) static let shared = AppDefaults()
private init() {}
static let store: UserDefaults = {

View File

@ -37,7 +37,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}
}
var log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "Application")
nonisolated(unsafe) let log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "Application")
var userNotificationManager: UserNotificationManager!
var faviconDownloader: FaviconDownloader!
@ -204,11 +204,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}
}
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
nonisolated func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler([.list, .banner, .badge, .sound])
}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
defer { completionHandler() }
let userInfo = response.notification.request.content.userInfo
@ -390,7 +391,9 @@ private extension AppDelegate {
do {
try BGTaskScheduler.shared.submit(request)
} catch {
os_log(.error, log: self.log, "Could not schedule app refresh: %@", error.localizedDescription)
Task { @MainActor in
os_log(.error, log: self.log, "Could not schedule app refresh: %@", error.localizedDescription)
}
}
}
}

View File

@ -8,7 +8,7 @@
import Foundation
import WebKit
import Images
@preconcurrency import Images
protocol ArticleIconSchemeHandlerDelegate: AnyObject {

View File

@ -8,11 +8,11 @@
import UIKit
@objc protocol SearchBarDelegate: NSObjectProtocol {
@objc optional func nextWasPressed(_ searchBar: ArticleSearchBar)
@objc optional func previousWasPressed(_ searchBar: ArticleSearchBar)
@objc optional func doneWasPressed(_ searchBar: ArticleSearchBar)
@objc optional func searchBar(_ searchBar: ArticleSearchBar, textDidChange: String)
protocol SearchBarDelegate: AnyObject {
@MainActor func nextWasPressed(_ searchBar: ArticleSearchBar)
@MainActor func previousWasPressed(_ searchBar: ArticleSearchBar)
@MainActor func doneWasPressed(_ searchBar: ArticleSearchBar)
@MainActor func searchBar(_ searchBar: ArticleSearchBar, textDidChange: String)
}
@ -146,7 +146,7 @@ private extension ArticleSearchBar {
private extension ArticleSearchBar {
@objc func textDidChange(_ notification: Notification) {
delegate?.searchBar?(self, textDidChange: searchField.text ?? "")
delegate?.searchBar(self, textDidChange: searchField.text ?? "")
if searchField.text?.isEmpty ?? true {
searchField.rightViewMode = .never
@ -156,21 +156,21 @@ private extension ArticleSearchBar {
}
@objc func nextPressed() {
delegate?.nextWasPressed?(self)
delegate?.nextWasPressed(self)
}
@objc func previousPressed() {
delegate?.previousWasPressed?(self)
delegate?.previousWasPressed(self)
}
@objc func donePressed(_ _: Any? = nil) {
delegate?.doneWasPressed?(self)
delegate?.doneWasPressed(self)
}
}
extension ArticleSearchBar: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
delegate?.nextWasPressed?(self)
delegate?.nextWasPressed(self)
return false
}
}

View File

@ -9,8 +9,9 @@
import UIKit
@objc public protocol ImageScrollViewDelegate: UIScrollViewDelegate {
func imageScrollViewDidGestureSwipeUp(imageScrollView: ImageScrollView)
func imageScrollViewDidGestureSwipeDown(imageScrollView: ImageScrollView)
@MainActor func imageScrollViewDidGestureSwipeUp(imageScrollView: ImageScrollView)
@MainActor func imageScrollViewDidGestureSwipeDown(imageScrollView: ImageScrollView)
}
open class ImageScrollView: UIScrollView {

View File

@ -42,8 +42,9 @@ class OpenInBrowserActivity: UIActivity {
return
}
UIApplication.shared.open(url, options: [:], completionHandler: nil)
Task { @MainActor in
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
activityDidFinish(true)
}
}

View File

@ -17,10 +17,11 @@ import ArticleExtractor
import Images
protocol WebViewControllerDelegate: AnyObject {
func webViewController(_: WebViewController, articleExtractorButtonStateDidUpdate: ArticleExtractorButtonState)
@MainActor func webViewController(_: WebViewController, articleExtractorButtonStateDidUpdate: ArticleExtractorButtonState)
}
class WebViewController: UIViewController {
final class WebViewController: UIViewController {
private struct MessageName {
static let imageWasClicked = "imageWasClicked"

View File

@ -11,9 +11,10 @@ import os.log
struct ErrorHandler {
private static var log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "Application")
nonisolated(unsafe) private static let log = OSLog(subsystem: Bundle.main.bundleIdentifier!, category: "Application")
public static func present(_ viewController: UIViewController) -> (Error) -> () {
public static func present(_ viewController: UIViewController) -> @MainActor (Error) -> () {
return { @MainActor [weak viewController] error in
if UIApplication.shared.applicationState == .active {
viewController?.presentError(error)

View File

@ -12,7 +12,8 @@ import Tree
import Images
protocol FeedTableViewCellDelegate: AnyObject {
func feedTableViewCellDisclosureDidToggle(_ sender: FeedTableViewCell, expanding: Bool)
@MainActor func feedTableViewCellDisclosureDidToggle(_ sender: FeedTableViewCell, expanding: Bool)
}
class FeedTableViewCell : VibrantTableViewCell {

View File

@ -10,7 +10,8 @@ import UIKit
import UIKitExtras
protocol FeedTableViewSectionHeaderDelegate {
func FeedTableViewSectionHeaderDisclosureDidToggle(_ sender: FeedTableViewSectionHeader)
@MainActor func feedTableViewSectionHeaderDisclosureDidToggle(_ sender: FeedTableViewSectionHeader)
}
class FeedTableViewSectionHeader: UITableViewHeaderFooterView {
@ -139,7 +140,7 @@ class FeedTableViewSectionHeader: UITableViewHeaderFooterView {
private extension FeedTableViewSectionHeader {
@objc func toggleDisclosure() {
delegate?.FeedTableViewSectionHeaderDisclosureDidToggle(self)
delegate?.feedTableViewSectionHeaderDisclosureDidToggle(self)
}
func commonInit() {

View File

@ -669,7 +669,7 @@ extension SidebarViewController: UIContextMenuInteractionDelegate {
extension SidebarViewController: FeedTableViewSectionHeaderDelegate {
func FeedTableViewSectionHeaderDisclosureDidToggle(_ sender: FeedTableViewSectionHeader) {
func feedTableViewSectionHeaderDisclosureDidToggle(_ sender: FeedTableViewSectionHeader) {
toggle(sender)
}

View File

@ -11,7 +11,8 @@ import UIKit
import Core
protocol AddAccountDismissDelegate: UIViewController {
func dismiss()
@MainActor func dismiss()
}
class AddAccountViewController: UITableViewController, AddAccountDismissDelegate {

View File

@ -10,7 +10,8 @@ import UIKit
import Account
protocol ShareFolderPickerControllerDelegate: AnyObject {
func shareFolderPickerDidSelect(_ container: ExtensionContainer)
@MainActor func shareFolderPickerDidSelect(_ container: ExtensionContainer)
}
class ShareFolderPickerController: UITableViewController {

View File

@ -12,7 +12,7 @@ import UIKit
// Uses a cache.
// Main thready only.
final class SingleLineUILabelSizer {
@MainActor final class SingleLineUILabelSizer {
let font: UIFont
private var cache = [String: CGSize]()
@ -36,7 +36,7 @@ final class SingleLineUILabelSizer {
}
static private var sizers = [UIFont: SingleLineUILabelSizer]()
@MainActor static private var sizers = [UIFont: SingleLineUILabelSizer]()
static func sizer(for font: UIFont) -> SingleLineUILabelSizer {

View File

@ -74,7 +74,7 @@ struct TimelineAccessibilityCellLayout: TimelineCellLayout {
private extension TimelineAccessibilityCellLayout {
static func rectForDate(_ cellData: TimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat) -> CGRect {
@MainActor static func rectForDate(_ cellData: TimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat) -> CGRect {
var r = CGRect.zero

View File

@ -94,7 +94,7 @@ extension TimelineCellLayout {
}
static func rectForFeedName(_ cellData: TimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat) -> CGRect {
@MainActor static func rectForFeedName(_ cellData: TimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat) -> CGRect {
var r = CGRect.zero
r.origin = point

View File

@ -109,7 +109,7 @@ struct TimelineDefaultCellLayout: TimelineCellLayout {
extension TimelineDefaultCellLayout {
static func rectForDate(_ cellData: TimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat) -> CGRect {
@MainActor static func rectForDate(_ cellData: TimelineCellData, _ point: CGPoint, _ textAreaWidth: CGFloat) -> CGRect {
var r = CGRect.zero

View File

@ -8,7 +8,7 @@
import UIKit
class TimelineTitleView: UIView {
final class TimelineTitleView: UIView {
@IBOutlet weak var iconView: IconView!
@IBOutlet weak var label: UILabel!

View File

@ -44,7 +44,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 17.0
//SDKROOT = macosx
SWIFT_SWIFT3_OBJC_INFERENCE = Off
SWIFT_VERSION = 5.10
SWIFT_STRICT_CONCURRENCY = complete
SWIFT_STRICT_CONCURRENCY = targeted
ASSETCATALOG_COMPILER_GENERATE_ASSET_SYMBOLS = NO
// https://forums.swift.org/t/swift-packages-in-multiple-targets-results-in-this-will-result-in-duplication-of-library-code-errors/34892/33