mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Removes usage of for await notification handling
This removes the 70+ warnings
This commit is contained in:
@@ -50,11 +50,9 @@ struct AddExtensionListView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
.task {
|
||||
for await _ in NotificationCenter.default.notifications(named: .ActiveExtensionPointsDidChange) {
|
||||
await MainActor.run(body: { dismiss() })
|
||||
}
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .ActiveExtensionPointsDidChange), perform: { _ in
|
||||
dismiss()
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,11 +32,9 @@ struct EnableExtensionPointView: View {
|
||||
.navigationTitle(extensionPoint.title)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.dismissOnExternalContextLaunch()
|
||||
.task {
|
||||
for await _ in NotificationCenter.default.notifications(named: .ActiveExtensionPointsDidChange) {
|
||||
await MainActor.run { dismiss() }
|
||||
}
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .ActiveExtensionPointsDidChange), perform: { _ in
|
||||
dismiss()
|
||||
})
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
}
|
||||
|
||||
|
||||
@@ -51,12 +51,9 @@ struct ExtensionsManagementView: View {
|
||||
} message: {
|
||||
Text("This action cannot be undone.", comment: "Alert message: confirmation that deactivation of extension cannot be undone.")
|
||||
}
|
||||
.task {
|
||||
for await _ in NotificationCenter.default.notifications(named: .ActiveExtensionPointsDidChange) {
|
||||
await MainActor.run { availableExtensionPointTypes = ExtensionPointManager.shared.availableExtensionPointTypes.sorted(by: { $0.title < $1.title }) }
|
||||
}
|
||||
}
|
||||
|
||||
.onReceive(NotificationCenter.default.publisher(for: .ActiveExtensionPointsDidChange), perform: { _ in
|
||||
availableExtensionPointTypes = ExtensionPointManager.shared.availableExtensionPointTypes.sorted(by: { $0.title < $1.title })
|
||||
})
|
||||
}
|
||||
|
||||
private var activeExtensionsSection: some View {
|
||||
|
||||
@@ -28,33 +28,25 @@ struct NewArticleNotificationsView: View, Logging {
|
||||
|
||||
}
|
||||
.tint(Color(uiColor: AppAssets.primaryAccentColor))
|
||||
.task {
|
||||
for await notification in NotificationCenter.default.notifications(named: .FaviconDidBecomeAvailable) {
|
||||
await MainActor.run {
|
||||
guard let faviconURLString = notification.userInfo?["faviconURL"] as? String,
|
||||
let faviconHost = URL(string: faviconURLString)?.host else {
|
||||
return
|
||||
}
|
||||
activeAccounts.forEach { account in
|
||||
for feed in Array(account.flattenedWebFeeds()) {
|
||||
if let feedURLHost = URL(string: feed.url)?.host {
|
||||
if faviconHost == feedURLHost {
|
||||
feed.objectWillChange.send()
|
||||
}
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .FaviconDidBecomeAvailable), perform: { notification in
|
||||
guard let faviconURLString = notification.userInfo?["faviconURL"] as? String,
|
||||
let faviconHost = URL(string: faviconURLString)?.host else {
|
||||
return
|
||||
}
|
||||
activeAccounts.forEach { account in
|
||||
for feed in Array(account.flattenedWebFeeds()) {
|
||||
if let feedURLHost = URL(string: feed.url)?.host {
|
||||
if faviconHost == feedURLHost {
|
||||
feed.objectWillChange.send()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.task {
|
||||
for await notification in NotificationCenter.default.notifications(named: .WebFeedIconDidBecomeAvailable) {
|
||||
await MainActor.run {
|
||||
guard let webFeed = notification.userInfo?[UserInfoKey.webFeed] as? WebFeed else { return }
|
||||
webFeed.objectWillChange.send()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.onReceive(NotificationCenter.default.publisher(for: .WebFeedIconDidBecomeAvailable), perform: { notification in
|
||||
guard let webFeed = notification.userInfo?[UserInfoKey.webFeed] as? WebFeed else { return }
|
||||
webFeed.objectWillChange.send()
|
||||
})
|
||||
}
|
||||
|
||||
private func sortedWebFeedsForAccount(_ account: Account) -> [WebFeed] {
|
||||
|
||||
Reference in New Issue
Block a user