Merge pull request #2917 from stuartbreckenridge/widget-fetch-changes

widget and unread badge counts are correct
This commit is contained in:
Maurice Parker 2021-03-26 11:01:48 -05:00 committed by GitHub
commit aaf7b9b38a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,6 @@ public final class WidgetDataEncoder {
feedIcon: article.iconImage()?.image.dataRepresentation(),
pubDate: article.datePublished?.description ?? "")
unread.append(latestArticle)
if unread.count == 7 { break }
}
for article in starredArticles {
@ -60,7 +59,6 @@ public final class WidgetDataEncoder {
feedIcon: article.iconImage()?.image.dataRepresentation(),
pubDate: article.datePublished?.description ?? "")
starred.append(latestArticle)
if starred.count == 7 { break }
}
for article in todayArticles {
@ -71,12 +69,11 @@ public final class WidgetDataEncoder {
feedIcon: article.iconImage()?.image.dataRepresentation(),
pubDate: article.datePublished?.description ?? "")
today.append(latestArticle)
if today.count == 7 { break }
}
let latestData = WidgetData(currentUnreadCount: try! AccountManager.shared.fetchArticles(.unread()).count,
currentTodayCount: try! AccountManager.shared.fetchArticles(.today()).count,
currentStarredCount: try! AccountManager.shared.fetchArticles(.starred()).count,
let latestData = WidgetData(currentUnreadCount: SmartFeedsController.shared.unreadFeed.unreadCount,
currentTodayCount: SmartFeedsController.shared.todayFeed.unreadCount,
currentStarredCount: try! SmartFeedsController.shared.starredFeed.fetchArticles().count,
unreadArticles: unread,
starredArticles: starred,
todayArticles:today,