Continue fixing concurrency warnings.

This commit is contained in:
Brent Simmons
2024-03-19 23:05:30 -07:00
parent 6ab10e871c
commit d0760f3d12
64 changed files with 444 additions and 459 deletions

View File

@@ -11,7 +11,7 @@ import RSCore
// image - title - unreadCount
struct SidebarCellLayout {
@MainActor struct SidebarCellLayout {
let faviconRect: CGRect
let titleRect: CGRect

View File

@@ -10,7 +10,7 @@ import AppKit
import RSTree
import Account
enum SidebarDeleteItemsAlert {
@MainActor struct SidebarDeleteItemsAlert {
/// Builds a delete confirmation dialog for the supplied nodes
static func build(_ nodes: [Node]) -> NSAlert {

View File

@@ -12,7 +12,7 @@ import Articles
import RSCore
import Account
@objc final class SidebarOutlineDataSource: NSObject, NSOutlineViewDataSource {
@objc @MainActor final class SidebarOutlineDataSource: NSObject, NSOutlineViewDataSource {
let treeController: TreeController
static let dragOperationNone = NSDragOperation(rawValue: 0)

View File

@@ -17,13 +17,13 @@ extension Notification.Name {
}
protocol SidebarDelegate: AnyObject {
func sidebarSelectionDidChange(_: SidebarViewController, selectedObjects: [AnyObject]?)
func unreadCount(for: AnyObject) -> Int
func sidebarInvalidatedRestorationState(_: SidebarViewController)
@MainActor func sidebarSelectionDidChange(_: SidebarViewController, selectedObjects: [AnyObject]?)
@MainActor func unreadCount(for: AnyObject) -> Int
@MainActor func sidebarInvalidatedRestorationState(_: SidebarViewController)
}
@objc class SidebarViewController: NSViewController, NSOutlineViewDelegate, NSMenuDelegate, UndoableCommandRunner {
@objc @MainActor class SidebarViewController: NSViewController, NSOutlineViewDelegate, NSMenuDelegate, UndoableCommandRunner {
@IBOutlet weak var outlineView: NSOutlineView!
weak var delegate: SidebarDelegate?
@@ -483,9 +483,9 @@ protocol SidebarDelegate: AnyObject {
revealAndSelectRepresentedObject(feed as AnyObject)
}
func deepLinkRevealAndSelect(for userInfo: [AnyHashable : Any]) {
guard let accountNode = findAccountNode(userInfo),
let feedNode = findFeedNode(userInfo, beginningAt: accountNode),
func deepLinkRevealAndSelect(for articlePathInfo: ArticlePathInfo) {
guard let accountNode = findAccountNode(articlePathInfo),
let feedNode = findFeedNode(articlePathInfo, beginningAt: accountNode),
let feed = feedNode.representedObject as? SidebarItem else {
return
}
@@ -738,16 +738,17 @@ private extension SidebarViewController {
return nil
}
func findAccountNode(_ userInfo: [AnyHashable : Any]?) -> Node? {
guard let accountID = userInfo?[ArticlePathKey.accountID] as? String else {
func findAccountNode(_ articlePathInfo: ArticlePathInfo) -> Node? {
guard let accountID = articlePathInfo.accountID else {
return nil
}
if let node = treeController.rootNode.descendantNode(where: { ($0.representedObject as? Account)?.accountID == accountID }) {
return node
}
guard let accountName = userInfo?[ArticlePathKey.accountName] as? String else {
guard let accountName = articlePathInfo.accountName else {
return nil
}
@@ -758,8 +759,8 @@ private extension SidebarViewController {
return nil
}
func findFeedNode(_ userInfo: [AnyHashable : Any]?, beginningAt startingNode: Node) -> Node? {
guard let feedID = userInfo?[ArticlePathKey.feedID] as? String else {
func findFeedNode(_ articlePathInfo: ArticlePathInfo, beginningAt startingNode: Node) -> Node? {
guard let feedID = articlePathInfo.feedID else {
return nil
}
if let node = startingNode.descendantNode(where: { ($0.representedObject as? Feed)?.feedID == feedID }) {

View File

@@ -8,7 +8,7 @@
import AppKit
class UnreadCountView : NSView {
@MainActor final class UnreadCountView : NSView {
struct Appearance {
static let padding = NSEdgeInsets(top: 1.0, left: 7.0, bottom: 1.0, right: 7.0)