Merge branch 'main' into ios-ui-settings-localised

# Conflicts:
#	iOS/Settings/ArticleThemesTableViewController.swift
This commit is contained in:
Stuart Breckenridge
2023-04-07 18:56:02 +04:00
16 changed files with 31 additions and 29 deletions

View File

@@ -8,7 +8,7 @@
import AppKit
final class BuiltinSmartFeedInspectorViewController: NSViewController, Inspector {
@MainActor final class BuiltinSmartFeedInspectorViewController: NSViewController, Inspector {
@IBOutlet var nameTextField: NSTextField?
@IBOutlet weak var smartFeedImageView: NSImageView!

View File

@@ -10,7 +10,7 @@ import AppKit
import Account
import RSCore
final class FolderInspectorViewController: NSViewController, Inspector {
@MainActor final class FolderInspectorViewController: NSViewController, Inspector {
@IBOutlet var nameTextField: NSTextField?
@IBOutlet weak var folderImageView: NSImageView!

View File

@@ -8,7 +8,7 @@
import AppKit
protocol Inspector: AnyObject {
@MainActor protocol Inspector: AnyObject {
var objects: [Any]? { get set }
var isFallbackInspector: Bool { get } // Can handle nothing-to-inspect or unexpected type of objects.
@@ -20,7 +20,7 @@ protocol Inspector: AnyObject {
typealias InspectorViewController = Inspector & NSViewController
final class InspectorWindowController: NSWindowController {
@MainActor final class InspectorWindowController: NSWindowController {
class var shouldOpenAtStartup: Bool {
return UserDefaults.standard.bool(forKey: DefaultsKey.windowIsOpen)

View File

@@ -8,7 +8,7 @@
import AppKit
final class NothingInspectorViewController: NSViewController, Inspector {
@MainActor final class NothingInspectorViewController: NSViewController, Inspector {
@IBOutlet var nothingTextField: NSTextField?
@IBOutlet var multipleTextField: NSTextField?

View File

@@ -11,7 +11,7 @@ import Articles
import Account
import UserNotifications
final class WebFeedInspectorViewController: NSViewController, Inspector {
@MainActor final class WebFeedInspectorViewController: NSViewController, Inspector {
@IBOutlet weak var iconView: IconView!
@IBOutlet weak var nameTextField: NSTextField?

View File

@@ -57,7 +57,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
var isSyncArticleStatusRunning = false
var isWaitingForSyncTasks = false
override init() {
@MainActor override init() {
super.init()
appDelegate = self
@@ -76,7 +76,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
NotificationCenter.default.addObserver(self, selector: #selector(unreadCountDidChange(_:)), name: .UnreadCountDidChange, object: nil)
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
@MainActor func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
AppDefaults.registerDefaults()
let isFirstRun = AppDefaults.shared.isFirstRun
@@ -124,7 +124,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
@MainActor func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
DispatchQueue.main.async {
self.resumeDatabaseProcessingIfNecessary()
AccountManager.shared.receiveRemoteNotification(userInfo: userInfo) {
@@ -134,17 +134,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}
}
func applicationWillTerminate(_ application: UIApplication) {
@MainActor func applicationWillTerminate(_ application: UIApplication) {
shuttingDown = true
}
func applicationDidEnterBackground(_ application: UIApplication) {
@MainActor func applicationDidEnterBackground(_ application: UIApplication) {
IconImageCache.shared.emptyCache()
}
// MARK: Notifications
@objc func unreadCountDidChange(_ note: Notification) {
@MainActor @objc func unreadCountDidChange(_ note: Notification) {
if note.object is AccountManager {
unreadCount = AccountManager.shared.unreadCount
}
@@ -152,21 +152,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
// MARK: - API
func manualRefresh(errorHandler: @escaping (Error) -> ()) {
@MainActor func manualRefresh(errorHandler: @escaping (Error) -> ()) {
UIApplication.shared.connectedScenes.compactMap( { $0.delegate as? SceneDelegate } ).forEach {
$0.cleanUp(conditional: true)
}
AccountManager.shared.refreshAll(errorHandler: errorHandler)
}
func resumeDatabaseProcessingIfNecessary() {
@MainActor func resumeDatabaseProcessingIfNecessary() {
if AccountManager.shared.isSuspended {
AccountManager.shared.resumeAll()
logger.info("Application processing resumed.")
}
}
func prepareAccountsForBackground() {
@MainActor func prepareAccountsForBackground() {
extensionFeedAddRequestFile.suspend()
syncTimer?.invalidate()
scheduleBackgroundFeedRefresh()
@@ -175,7 +175,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
waitForSyncTasksToFinish()
}
func prepareAccountsForForeground() {
@MainActor func prepareAccountsForForeground() {
extensionFeedAddRequestFile.resume()
syncTimer?.update()
@@ -215,7 +215,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
}
func presentThemeImportError(_ error: Error) {
@MainActor func presentThemeImportError(_ error: Error) {
let windowScene = {
let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }
return scenes.filter { $0.activationState == .foregroundActive }.first ?? scenes.first
@@ -228,7 +228,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
// MARK: App Initialization
private extension AppDelegate {
@MainActor private extension AppDelegate {
private func initializeDownloaders() {
let tempDir = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first!

View File

@@ -15,7 +15,7 @@ enum KeyboardType: String {
case detail = "DetailKeyboardShortcuts"
}
class KeyboardManager {
@MainActor final class KeyboardManager {
private(set) var _keyCommands: [UIKeyCommand]
var keyCommands: [UIKeyCommand] {

View File

@@ -15,7 +15,7 @@ protocol MasterFeedTableViewCellDelegate: AnyObject {
func masterFeedTableViewCellDisclosureDidToggle(_ sender: MasterFeedTableViewCell, expanding: Bool)
}
class MasterFeedTableViewCell : VibrantTableViewCell {
@MainActor final class MasterFeedTableViewCell : VibrantTableViewCell {
weak var delegate: MasterFeedTableViewCellDelegate?

View File

@@ -9,7 +9,7 @@
import UIKit
import RSCore
struct MasterFeedTableViewCellLayout {
@MainActor struct MasterFeedTableViewCellLayout {
private static let indentWidth = CGFloat(integerLiteral: 15)
private static let editingControlIndent = CGFloat(integerLiteral: 40)

View File

@@ -9,7 +9,7 @@
import UIKit
import RSCore
struct MasterFeedTableViewSectionHeaderLayout {
@MainActor struct MasterFeedTableViewSectionHeaderLayout {
private static let labelMarginRight = CGFloat(integerLiteral: 8)
private static let disclosureButtonSize = CGSize(width: 44, height: 44)

View File

@@ -8,7 +8,7 @@
import UIKit
class MasterFeedUnreadCountView : UIView {
@MainActor class MasterFeedUnreadCountView : UIView {
var padding: UIEdgeInsets {
return UIEdgeInsets(top: 1.0, left: 9.0, bottom: 1.0, right: 9.0)

View File

@@ -10,7 +10,7 @@
import SwiftUI
import Account
struct RefreshProgressView: View {
@MainActor struct RefreshProgressView: View {
static let width: CGFloat = 100
static let height: CGFloat = 5

View File

@@ -8,7 +8,7 @@
import UIKit
class MasterTimelineUnreadCountView: MasterFeedUnreadCountView {
@MainActor final class MasterTimelineUnreadCountView: MasterFeedUnreadCountView {
override var padding: UIEdgeInsets {
return UIEdgeInsets(top: 2.0, left: 9.0, bottom: 2.0, right: 9.0)

View File

@@ -9,7 +9,7 @@
import UIKit
import Account
class RootSplitViewController: UISplitViewController {
final class RootSplitViewController: UISplitViewController {
var coordinator: SceneCoordinator!

View File

@@ -53,7 +53,7 @@ struct FeedNode: Hashable {
}
}
class SceneCoordinator: NSObject, UndoableCommandRunner, Logging {
final class SceneCoordinator: NSObject, UndoableCommandRunner, Logging {
var undoableCommands = [UndoableCommand]()
var undoManager: UndoManager? {

View File

@@ -12,7 +12,7 @@ import Account
import Zip
import RSCore
class SceneDelegate: UIResponder, UIWindowSceneDelegate, Logging {
@MainActor final class SceneDelegate: UIResponder, UIWindowSceneDelegate, Logging {
var window: UIWindow?
var coordinator: SceneCoordinator!
@@ -195,7 +195,9 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, Logging {
do {
try ArticleThemeDownloader.shared.handleFile(at: location)
} catch {
self.presentError(error)
Task { @MainActor in
self.presentError(error)
}
}
}
task.resume()