Respect unread count display setting in widgets.

This commit is contained in:
Brent Simmons committed 2026-10-06 11:00:33 -07:00
1 parent c4d88f466a
commit bfd62718e4
8 files changed
+46 -8

No files matched your search

+14 -1
View File
@@ -44,6 +44,12 @@ import Account
Self.logger.error("WidgetDataEncoder: unable to create folder for images")
return nil
}
NotificationCenter.default.addObserver(self, selector: #selector(handleUnreadCountDisplaySettingDidChange(_:)), name: .unreadCountDisplaySettingDidChange, object: nil)
}
@objc func handleUnreadCountDisplaySettingDidChange(_ notification: Notification) {
encode()
}
/// Fire-and-forget. Sets `isRunning` synchronously so the background-task wait loop
@@ -96,6 +102,12 @@ import Account
func reloadTimelines(newData: WidgetData, existingData: WidgetData?) {
if let existingData = existingData {
if existingData.effectiveUnreadCountDisplay != newData.effectiveUnreadCountDisplay {
WidgetCenter.shared.reloadAllTimelines()
Self.logger.debug("WidgetDataEncoder: Reloading all widgets because unread count display changed")
return
}
var shouldRefreshSummary = false
if existingData.unreadArticles != newData.unreadArticles {
@@ -148,7 +160,8 @@ import Account
unreadArticles: unreadArticles,
starredArticles: starredArticles,
todayArticles: todayArticles,
lastUpdateTime: Date.now)
lastUpdateTime: Date.now,
unreadCountDisplay: AppDefaults.shared.unreadCountDisplay)
return latestData
}