You can’t toggle an optional Bool

This commit is contained in:
Stuart Breckenridge 2021-02-02 13:25:06 +08:00
parent aa0a5d2269
commit e88327be78
No known key found for this signature in database
GPG Key ID: 1F11FD62007DC331
1 changed files with 3 additions and 0 deletions

View File

@ -114,6 +114,7 @@ extension SidebarViewController {
self.showNotificationsNotEnabledAlert()
} else if settings.authorizationStatus == .authorized {
DispatchQueue.main.async {
if feed.isNotifyAboutNewArticles == nil { feed.isNotifyAboutNewArticles = false }
feed.isNotifyAboutNewArticles?.toggle()
NotificationCenter.default.post(Notification(name: .DidUpdateFeedPreferencesFromContextMenu))
}
@ -121,6 +122,7 @@ extension SidebarViewController {
UNUserNotificationCenter.current().requestAuthorization(options: [.badge, .sound, .alert]) { (granted, error) in
if granted {
DispatchQueue.main.async {
if feed.isNotifyAboutNewArticles == nil { feed.isNotifyAboutNewArticles = false }
feed.isNotifyAboutNewArticles?.toggle()
NotificationCenter.default.post(Notification(name: .DidUpdateFeedPreferencesFromContextMenu))
NSApplication.shared.registerForRemoteNotifications()
@ -138,6 +140,7 @@ extension SidebarViewController {
let feed = item.representedObject as? WebFeed else {
return
}
if feed.isArticleExtractorAlwaysOn == nil { feed.isArticleExtractorAlwaysOn = false }
feed.isArticleExtractorAlwaysOn?.toggle()
NotificationCenter.default.post(Notification(name: .DidUpdateFeedPreferencesFromContextMenu))
}