From 13871495f3e3656a10378cab39d0c68410582e6e Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Wed, 20 Mar 2024 20:54:21 -0700 Subject: [PATCH] Update iOS code to handle module changes. --- Account/Sources/Account/Account.swift | 2 +- iOS/Add/AddFeedViewController.swift | 1 + iOS/AppDelegate.swift | 14 ++++++++++---- iOS/Feeds/FeedsViewController+Drop.swift | 1 + iOS/SceneCoordinator.swift | 1 + iOS/Settings/AddAccountViewController.swift | 1 + iOS/Timeline/Cell/TimelineCellData.swift | 2 +- 7 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Account/Sources/Account/Account.swift b/Account/Sources/Account/Account.swift index d39162704..231ed896a 100644 --- a/Account/Sources/Account/Account.swift +++ b/Account/Sources/Account/Account.swift @@ -646,7 +646,7 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container, fetchUnreadCounts(for: feeds, completion: completion) } - public func articles(for fetchType: FetchType) async throws -> Set
{ + @MainActor public func articles(for fetchType: FetchType) async throws -> Set
{ switch fetchType { diff --git a/iOS/Add/AddFeedViewController.swift b/iOS/Add/AddFeedViewController.swift index 8c7afd699..0d468dd45 100644 --- a/iOS/Add/AddFeedViewController.swift +++ b/iOS/Add/AddFeedViewController.swift @@ -10,6 +10,7 @@ import UIKit import Account import RSTree import RSParser +import Core enum AddFeedType { case web diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index 3a887d9d3..6eab50d98 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -434,11 +434,14 @@ private extension AppDelegate { resumeDatabaseProcessingIfNecessary() - guard let account = accountManager.existingAccount(with: articlePathInfo.accountID) else { + guard let accountID = articlePathInfo.accountID, let account = accountManager.existingAccount(with: accountID) else { os_log(.debug, "No account found from notification.") return } - let articleID = articlePathInfo.articleID + guard let articleID = articlePathInfo.articleID else { + os_log(.debug, "No articleID found from notification.") + return + } Task { @MainActor in guard let articles = try? await account.articles(for: .articleIDs([articleID])) else { @@ -468,11 +471,14 @@ private extension AppDelegate { resumeDatabaseProcessingIfNecessary() - guard let account = accountManager.existingAccount(with: articlePathInfo.accountID) else { + guard let accountID = articlePathInfo.accountID, let account = accountManager.existingAccount(with: accountID) else { os_log(.debug, "No account found from notification.") return } - let articleID = articlePathInfo.articleID + guard let articleID = articlePathInfo.articleID else { + os_log(.debug, "No articleID found from notification.") + return + } Task { @MainActor in diff --git a/iOS/Feeds/FeedsViewController+Drop.swift b/iOS/Feeds/FeedsViewController+Drop.swift index 1bf52e5a4..f5312ed2c 100644 --- a/iOS/Feeds/FeedsViewController+Drop.swift +++ b/iOS/Feeds/FeedsViewController+Drop.swift @@ -9,6 +9,7 @@ import UIKit import Account import RSTree +import Core extension SidebarViewController: UITableViewDropDelegate { diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 7b03a1c58..1ec79a024 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -13,6 +13,7 @@ import Articles import RSTree import SafariServices import SwiftUI +import Core protocol MainControllerIdentifiable { var mainControllerIdentifier: MainControllerIdentifier { get } diff --git a/iOS/Settings/AddAccountViewController.swift b/iOS/Settings/AddAccountViewController.swift index be930ca05..42a1b2a35 100644 --- a/iOS/Settings/AddAccountViewController.swift +++ b/iOS/Settings/AddAccountViewController.swift @@ -8,6 +8,7 @@ import Account import UIKit +import Core protocol AddAccountDismissDelegate: UIViewController { func dismiss() diff --git a/iOS/Timeline/Cell/TimelineCellData.swift b/iOS/Timeline/Cell/TimelineCellData.swift index e778ffdd7..84c5c1c27 100644 --- a/iOS/Timeline/Cell/TimelineCellData.swift +++ b/iOS/Timeline/Cell/TimelineCellData.swift @@ -9,7 +9,7 @@ import UIKit import Articles -struct TimelineCellData { +@MainActor struct TimelineCellData { private static let noText = NSLocalizedString("(No Text)", comment: "No Text")