mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-28 16:26:04 +00:00
Rewrite `encode()`: - Remove file removal checks, writing data will replace - Compare existing widget data to new data and determine which widgets actually need refreshed Refactor `flushSharedContainer` to `removeStaleFaviconsFromSharedContainer`: - No longer nuked in full - Only favicons not accessed in the last seven days are deleted (in DEBUG builds this is 30 seconds) Improve `writeImageDataToSharedContainer`: - Favicons now use their md5 digest instead of a UUID (thus one image per feed, instead of one image per article) - If the favicon exists it is not rewritten Add `reloadTimelines`: - Compares existing article arrays to new article arrays and will only reload specific widget timelines where there is a difference. - `LatestArticle` now conforms to `Hashable` to make this possible. Improve `SceneDelegate` selection logic: - select the correct feed before selecting the article
29 lines
676 B
Swift
29 lines
676 B
Swift
//
|
|
// WidgetData.swift
|
|
// NetNewsWire
|
|
//
|
|
// Created by Stuart Breckenridge on 18/11/20.
|
|
// Copyright © 2020 Ranchero Software. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
struct WidgetData: Codable {
|
|
let currentUnreadCount: Int
|
|
let currentTodayCount: Int
|
|
let currentStarredCount: Int
|
|
let unreadArticles: [LatestArticle]
|
|
let starredArticles: [LatestArticle]
|
|
let todayArticles: [LatestArticle]
|
|
let lastUpdateTime: Date
|
|
}
|
|
|
|
struct LatestArticle: Codable, Identifiable, Hashable {
|
|
var id: String
|
|
let feedTitle: String
|
|
let articleTitle: String?
|
|
let articleSummary: String?
|
|
let feedIconPath: String? // Path to image data in shared container.
|
|
let pubDate: String
|
|
}
|