Merge pull request #3792 from stuartbreckenridge/widget-article-fix

Adds sorting to widget article arrays
This commit is contained in:
Maurice Parker authored and GitHub committed 2023-02-08 16:51:47 -08:00
commit 61333a0c9f
4 files changed
+6 -6

No files matched your search

+3 -3
View File
@@ -143,9 +143,9 @@ public final class WidgetDataEncoder {
let latestData = WidgetData(currentUnreadCount: SmartFeedsController.shared.unreadFeed.unreadCount,
currentTodayCount: SmartFeedsController.shared.todayFeed.unreadCount,
currentStarredCount: (try? AccountManager.shared.fetchCountForStarredArticles()) ?? 0,
unreadArticles: unread,
starredArticles: starred,
todayArticles:today,
unreadArticles: unread.sorted(by: { $0.pubDate > $1.pubDate }),
starredArticles: starred.sorted(by: { $0.pubDate > $1.pubDate }),
todayArticles:today.sorted(by: { $0.pubDate > $1.pubDate }),
lastUpdateTime: Date())
completion(latestData)
}
+1 -1
View File
@@ -37,7 +37,7 @@ struct StarredWidgetView : View {
Spacer()
VStack(alignment:.leading, spacing: 0) {
ForEach(0..<maxCount(), content: { i in
ForEach(0..<maxCount(), id: \.self, content: { i in
if i != 0 {
Divider()
ArticleItemView(article: entry.widgetData.starredArticles[i],
+1 -1
View File
@@ -37,7 +37,7 @@ struct TodayWidgetView : View {
Spacer()
VStack(alignment:.leading, spacing: 0) {
ForEach(0..<maxCount(), content: { i in
ForEach(0..<maxCount(), id: \.self, content: { i in
if i != 0 {
Divider()
ArticleItemView(article: entry.widgetData.todayArticles[i],
+1 -1
View File
@@ -37,7 +37,7 @@ struct UnreadWidgetView : View {
Spacer()
VStack(alignment:.leading, spacing: 0) {
ForEach(0..<maxCount(), content: { i in
ForEach(0..<maxCount(), id: \.self, content: { i in
if i != 0 {
Divider()
ArticleItemView(article: entry.widgetData.unreadArticles[i],