Merge branch 'main' into super-cut

This commit is contained in:
Maurice Parker
2023-04-16 14:13:06 -05:00
73 changed files with 195 additions and 319 deletions

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 ArticleExtractorButtonState {
case off
}
class ArticleExtractorButton: UIButton {
@MainActor class ArticleExtractorButton: UIButton {
private var animatedLayer: CALayer?

View File

@@ -9,7 +9,7 @@
import UIKit
import Articles
class ContextMenuPreviewViewController: UIViewController {
@MainActor class ContextMenuPreviewViewController: UIViewController {
@IBOutlet weak var blogNameLabel: UILabel!
@IBOutlet weak var blogAuthorLabel: UILabel!

View File

@@ -8,7 +8,7 @@
import UIKit
class ImageTransition: NSObject, UIViewControllerAnimatedTransitioning {
@MainActor final class ImageTransition: NSObject, UIViewControllerAnimatedTransitioning {
private weak var webViewController: WebViewController?
private let duration = 0.4

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

@@ -12,7 +12,7 @@ protocol MasterFeedTableViewSectionHeaderDelegate {
func masterFeedTableViewSectionHeaderDisclosureDidToggle(_ sender: MasterFeedTableViewSectionHeader)
}
class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
@MainActor class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
var delegate: MasterFeedTableViewSectionHeaderDelegate?

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

@@ -9,7 +9,7 @@
import UIKit
import RSCore
struct MasterTimelineAccessibilityCellLayout: MasterTimelineCellLayout {
@MainActor struct MasterTimelineAccessibilityCellLayout: MasterTimelineCellLayout {
let height: CGFloat
let unreadIndicatorRect: CGRect

View File

@@ -9,7 +9,7 @@
import UIKit
import Articles
struct MasterTimelineCellData {
@MainActor struct MasterTimelineCellData {
private static let noText = NSLocalizedString("(No Text)", comment: "No Text")

View File

@@ -21,7 +21,7 @@ protocol MasterTimelineCellLayout {
}
extension MasterTimelineCellLayout {
@MainActor extension MasterTimelineCellLayout {
static func rectForUnreadIndicator(_ point: CGPoint) -> CGRect {
var r = CGRect.zero

View File

@@ -9,7 +9,7 @@
import UIKit
import RSCore
struct MasterTimelineDefaultCellLayout: MasterTimelineCellLayout {
@MainActor struct MasterTimelineDefaultCellLayout: MasterTimelineCellLayout {
static let cellPadding = UIEdgeInsets(top: 12, left: 8, bottom: 12, right: 20)

View File

@@ -9,7 +9,7 @@
import UIKit
import RSCore
class MasterTimelineTableViewCell: VibrantTableViewCell {
@MainActor class MasterTimelineTableViewCell: VibrantTableViewCell {
private let titleView = MasterTimelineTableViewCell.multiLineUILabel()
private let summaryView = MasterTimelineTableViewCell.multiLineUILabel()

View File

@@ -8,7 +8,7 @@
import UIKit
class MasterUnreadIndicatorView: UIView {
@MainActor class MasterUnreadIndicatorView: UIView {
override func layoutSubviews() {
super.layoutSubviews()

View File

@@ -26,7 +26,7 @@ struct TextFieldSizeInfo {
let numberOfLinesUsed: Int // A two-line text field may only use one line, for instance. This would equal 1, then.
}
final class MultilineUILabelSizer {
@MainActor final class MultilineUILabelSizer {
private let numberOfLines: Int
private let font: UIFont

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]()

View File

@@ -15,7 +15,7 @@ extension UIView: MarkAsReadAlertControllerSourceType {}
extension UIBarButtonItem: MarkAsReadAlertControllerSourceType {}
struct MarkAsReadAlertController {
@MainActor struct MarkAsReadAlertController {
static func confirm<T>(_ controller: UIViewController?,
coordinator: SceneCoordinator?,

View File

@@ -8,7 +8,7 @@
import UIKit
class MasterTimelineDataSource<SectionIdentifierType, ItemIdentifierType>: UITableViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType> where SectionIdentifierType : Hashable, ItemIdentifierType : Hashable {
@MainActor final class MasterTimelineDataSource<SectionIdentifierType, ItemIdentifierType>: UITableViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType> where SectionIdentifierType : Hashable, ItemIdentifierType : Hashable {
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true

View File

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

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

@@ -52,7 +52,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()

View File

@@ -114,7 +114,7 @@ extension ArticleThemesTableViewController: UIDocumentPickerDelegate {
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
guard let url = urls.first else { return }
try ArticleThemeImporter.importTheme(controller: self, filename: url.standardizedFileURL.path)
ArticleThemeImporter.importTheme(controller: self, filename: url.standardizedFileURL.path)
}
}

View File

@@ -29,8 +29,6 @@ class TitleActivityItemSource: NSObject, UIActivityItemSource {
switch activityType.rawValue {
case "com.omnigroup.OmniFocus3.iOS.QuickEntry",
"com.culturedcode.ThingsiPhone.ShareExtension",
"com.tapbots.Tweetbot4.shareextension",
"com.tapbots.Tweetbot6.shareextension",
"com.buffer.buffer.Buffer":
return title
default: