Feed resilience, clearer empty states, and read/unread
- Don't blank the feed on refresh: keep current stories until new data arrives, and ignore benign URLError.cancelled (-999) so a network blip no longer wipes the list. Coalesce WebSocket story.created bursts into a single debounced refresh. - Empty state now distinguishes polling, couldn't-reach-server (with the error + host + Retry), offline, and genuinely-empty. - Track read stories in SwiftData (ReadStory); mark a story read when opened and drop/dim its signal stripe across the feed and Latest/Saved/Search. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,13 @@ enum APIError: Error, LocalizedError {
|
||||
case .networkError(let e): return e.localizedDescription
|
||||
}
|
||||
}
|
||||
|
||||
/// A benign URLSession cancellation (-999), e.g. a request superseded or
|
||||
/// dropped on a network-path change. Should not be shown or wipe state.
|
||||
var isCancelled: Bool {
|
||||
if case .networkError(let e) = self { return (e as? URLError)?.code == .cancelled }
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
private struct APIErrorResponse: Decodable {
|
||||
|
||||
Reference in New Issue
Block a user