changes the behaviour of the today widget

This commit is contained in:
Stuart Breckenridge 2020-11-19 20:21:04 +08:00
parent 1a65211f19
commit b34510eb5c
No known key found for this signature in database
GPG Key ID: 1F11FD62007DC331
3 changed files with 5 additions and 5 deletions

View File

@ -50,7 +50,7 @@ struct WidgetDataEncoder {
} }
// Today Articles // Today Articles
let todayArticles = try SmartFeedsController.shared.todayFeed.fetchArticles().sorted(by: { $0.datePublished ?? .distantPast > $1.datePublished ?? .distantPast }) let todayArticles = try SmartFeedsController.shared.todayFeed.fetchArticles().sorted(by: { $0.datePublished ?? .distantPast > $1.datePublished ?? .distantPast }).filter({ $0.status.read == false })
var today = [LatestArticle]() var today = [LatestArticle]()
for article in todayArticles { for article in todayArticles {
let latestArticle = LatestArticle(id: article.sortableArticleID, let latestArticle = LatestArticle(id: article.sortableArticleID,
@ -64,7 +64,7 @@ struct WidgetDataEncoder {
} }
let latestData = WidgetData(currentUnreadCount: SmartFeedsController.shared.unreadFeed.unreadCount, let latestData = WidgetData(currentUnreadCount: SmartFeedsController.shared.unreadFeed.unreadCount,
currentTodayCount: try! SmartFeedsController.shared.todayFeed.fetchArticles().count, currentTodayCount: try! SmartFeedsController.shared.todayFeed.fetchArticles().filter({ $0.status.read == false }).count,
currentStarredCount: try! SmartFeedsController.shared.starredFeed.fetchArticles().count, currentStarredCount: try! SmartFeedsController.shared.starredFeed.fetchArticles().count,
unreadArticles: unread, unreadArticles: unread,
starredArticles: starred, starredArticles: starred,

View File

@ -51,9 +51,9 @@
<key>zero</key> <key>zero</key>
<string>No more recent articles</string> <string>No more recent articles</string>
<key>one</key> <key>one</key>
<string>+ 1 more recent article</string> <string>+ 1 more recent unread article</string>
<key>other</key> <key>other</key>
<string>+ %u more recent articles</string> <string>+ %u more recent unread articles</string>
</dict> </dict>
</dict> </dict>
</dict> </dict>

View File

@ -41,7 +41,7 @@ struct TodayWidget: Widget {
}) })
.configurationDisplayName("Your Today Articles") .configurationDisplayName("Your Today Articles")
.description("A sneak peak at recently published articles.") .description("A sneak peak at unread recently published articles.")
.supportedFamilies([.systemMedium, .systemLarge]) .supportedFamilies([.systemMedium, .systemLarge])
} }