mirror of
https://github.com/yattee/yattee.git
synced 2026-11-01 01:17:20 +00:00
Separate account status from the account list, and stop stranding accounts
Recomputing statuses reads the Keychain, which cannot know that a server rejected a credential or failed to answer — and it ran in reaction to the same notification those verdicts were announced with, so it erased them as they were recorded. Status changes now have their own notification. With that separation `unreachable` no longer has to be preserved to survive: it is transient, and preserving it stopped every read from reaching the server, so nothing would ever discover that the network had come back. A fetch already running when its provider is discarded now has its result dropped. Signing in again — or switching Apple account — changes neither the context nor the account ID, so the previous login's channels would otherwise arrive as the current account's. Caches with no recorded owner are discarded rather than adopted. The first launch after upgrading finds feeds written before anyone recorded whose they were, and the Apple account may have changed since. The legacy validator's auto-correction moves the data context with it, and Manage Channels reloads on the context rather than the legacy value — it could list one account's channels while unsubscribes went to another.
This commit is contained in:
@@ -150,6 +150,7 @@ final class SubscriptionAccountValidator {
|
||||
// Find first available account to switch to
|
||||
if let newAccount = availableAccounts.first {
|
||||
settingsManager.subscriptionAccount = newAccount
|
||||
adoptCorrectedSelection(newAccount)
|
||||
feedCache.handleAccountChange()
|
||||
|
||||
let newName = displayName(for: newAccount)
|
||||
@@ -166,6 +167,7 @@ final class SubscriptionAccountValidator {
|
||||
// No valid accounts available - set to local anyway
|
||||
// The feed will show an appropriate error state
|
||||
settingsManager.subscriptionAccount = .local
|
||||
adoptCorrectedSelection(.local)
|
||||
feedCache.handleAccountChange()
|
||||
|
||||
LoggingService.shared.warning(
|
||||
@@ -175,6 +177,20 @@ final class SubscriptionAccountValidator {
|
||||
}
|
||||
}
|
||||
|
||||
/// Moves the data context with a correction made to the legacy setting.
|
||||
///
|
||||
/// Reads and writes resolve through the context now, so correcting only the
|
||||
/// legacy value would leave the picker naming one account while the data
|
||||
/// came from another.
|
||||
private func adoptCorrectedSelection(_ account: SubscriptionAccount) {
|
||||
guard let accountsManager else { return }
|
||||
|
||||
let context = accountsManager.context(forLegacyInstanceID: account.instanceID)
|
||||
guard context != accountsManager.currentContext else { return }
|
||||
|
||||
accountsManager.setContext(context)
|
||||
}
|
||||
|
||||
// MARK: - Display Names
|
||||
|
||||
/// Returns a display name for the given subscription account.
|
||||
|
||||
Reference in New Issue
Block a user