mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-22 23:58:36 +01:00
Make DownloadProgress and CombinedRefreshProgress MainActor.
This commit is contained in:
parent
83a067bda7
commit
1c9452a1c5
@ -119,7 +119,7 @@ private extension CloudKitSendStatusOperation {
|
||||
return CloudKitArticleStatusUpdate(articleID: key, statuses: value, article: articlesDict[key])
|
||||
}
|
||||
|
||||
@Sendable func done(_ stop: Bool) {
|
||||
@MainActor func done(_ stop: Bool) {
|
||||
// Don't clear the last one since we might have had additional ticks added
|
||||
if self.showProgress && self.refreshProgress?.numberRemaining ?? 0 > 1 {
|
||||
self.refreshProgress?.completeTask()
|
||||
|
@ -12,7 +12,7 @@ import Web
|
||||
// Combines the refresh progress of multiple accounts into one struct,
|
||||
// for use by refresh status view and so on.
|
||||
|
||||
public struct CombinedRefreshProgress {
|
||||
@MainActor public struct CombinedRefreshProgress {
|
||||
|
||||
public let numberOfTasks: Int
|
||||
public let numberRemaining: Int
|
||||
|
@ -8,14 +8,12 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
// Main thread only.
|
||||
|
||||
public extension Notification.Name {
|
||||
|
||||
static let DownloadProgressDidChange = Notification.Name(rawValue: "DownloadProgressDidChange")
|
||||
}
|
||||
|
||||
public final class DownloadProgress {
|
||||
@MainActor public final class DownloadProgress {
|
||||
|
||||
public var numberOfTasks = 0 {
|
||||
didSet {
|
||||
@ -94,9 +92,9 @@ public final class DownloadProgress {
|
||||
// MARK: - Private
|
||||
|
||||
private extension DownloadProgress {
|
||||
|
||||
|
||||
func postDidChangeNotification() {
|
||||
DispatchQueue.main.async {
|
||||
Task { @MainActor in
|
||||
NotificationCenter.default.post(name: .DownloadProgressDidChange, object: self)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user