mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Use MainActor Task instead of GCD.
This commit is contained in:
@@ -66,11 +66,11 @@ import RSParser
|
||||
}
|
||||
|
||||
account.createFeed(url: url.absoluteString, name: title, container: container, validateFeed: true) { result in
|
||||
|
||||
DispatchQueue.main.async {
|
||||
|
||||
Task { @MainActor in
|
||||
self.endShowingProgress()
|
||||
}
|
||||
|
||||
|
||||
switch result {
|
||||
case .success(let feed):
|
||||
NotificationCenter.default.post(name: .UserDidAddFeed, object: self, userInfo: [UserInfoKey.feed: feed])
|
||||
@@ -81,7 +81,7 @@ import RSParser
|
||||
case AccountError.createErrorNotFound:
|
||||
self.showNoFeedsErrorMessage()
|
||||
default:
|
||||
DispatchQueue.main.async {
|
||||
Task { @MainActor in
|
||||
NSApplication.shared.presentError(error)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,11 +106,10 @@ enum TimelineSourceMode {
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(articleThemeNamesDidChangeNotification(_:)), name: .ArticleThemeNamesDidChangeNotification, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(currentArticleThemeDidChangeNotification(_:)), name: .CurrentArticleThemeDidChangeNotification, object: nil)
|
||||
|
||||
DispatchQueue.main.async {
|
||||
|
||||
Task { @MainActor in
|
||||
self.updateWindowTitle()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - API
|
||||
|
||||
@@ -88,7 +88,7 @@ import Account
|
||||
|
||||
panel.beginSheetModal(for: hostWindow!) { result in
|
||||
if result == NSApplication.ModalResponse.OK, let url = panel.url {
|
||||
DispatchQueue.main.async {
|
||||
Task { @MainActor in
|
||||
let filename = url.lastPathComponent
|
||||
let opmlString = OPMLExporter.OPMLString(with: account, title: filename)
|
||||
do {
|
||||
|
||||
@@ -320,7 +320,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
|
||||
if let selectedIndex = articles.firstIndex(where: { $0.articleID == articleID }) {
|
||||
tableView.selectRow(selectedIndex)
|
||||
DispatchQueue.main.async {
|
||||
Task { @MainActor in
|
||||
self.tableView.scrollTo(row: selectedIndex)
|
||||
}
|
||||
focus()
|
||||
|
||||
Reference in New Issue
Block a user