mirror of
https://github.com/yattee/yattee.git
synced 2026-10-23 21:22:53 +00:00
Let the banner speak only for what it answers
Standing the feed error down under the context banner was aimed at one sentence and hit every one. The fallback to local reads asks for a Yattee Server nobody configured, and that question the banner already answers — but a local refresh that failed on the way out answers nothing, and it was being swallowed too. With the banner up, an offline refresh left the last feed on screen with no explanation and no retry: the state said error, the view said nothing. The decision now names the errors the banner covers. `yatteeServerRequired` and `notAuthenticated` are the account the banner is already talking about and stand down; a `networkError` is news the banner does not carry and keeps its own message and its retry button. It lives on `FeedLoadState` as `displayedError(contextBannerVisible:)` so the rule is one function rather than a guard in a view property, and so it can be tested.
This commit is contained in:
@@ -165,20 +165,10 @@ struct SubscriptionsView: View {
|
||||
}
|
||||
#endif
|
||||
|
||||
/// The feed error worth showing, if any.
|
||||
///
|
||||
/// Nothing while the context banner is up: a selected account that cannot be
|
||||
/// used reads local data, and the local feed then reports the Yattee Server
|
||||
/// it has no reason to have — "add a subscriptions account in Settings"
|
||||
/// under a banner saying *this* account needs signing in again is two
|
||||
/// answers to one question. The banner names the cause, so it is the one
|
||||
/// that stays.
|
||||
/// The feed error worth showing, if any — the banner takes over only for
|
||||
/// the errors it is already the answer to.
|
||||
private var displayedFeedError: FeedLoadState.FeedLoadError? {
|
||||
guard contextUnavailability == nil,
|
||||
case let .error(error) = feedCache.feedLoadState
|
||||
else { return nil }
|
||||
|
||||
return error
|
||||
feedCache.feedLoadState.displayedError(contextBannerVisible: contextUnavailability != nil)
|
||||
}
|
||||
|
||||
private var isShowingFullScreenError: Bool {
|
||||
|
||||
Reference in New Issue
Block a user