Tell the views when a credential is replaced

Signing in again as a different person on the same server changes
neither the account ID, the context, nor usually the status — so nothing
the views observe moved, and the previous user's subscriptions and feed
stayed on screen while actions went out under the new credential. There
is now a notification for exactly that, and the subscriptions view and
the instance browser discard and reload on it.

An account deleted after its instance disappeared retires its legacy
Keychain item too. Identifying that item needs the instance, but
checking it does not: the adoption marker is specific to service,
account, scope and the exact secret, so asking both managers retires it
if either owns it and does nothing otherwise.
This commit is contained in:
Arkadiusz Fal
2026-08-28 23:58:20 +02:00
parent 8ee0e38fbd
commit 9a93b0347e
4 changed files with 34 additions and 0 deletions

View File

@@ -527,6 +527,12 @@ struct SubscriptionsView: View {
.onReceive(NotificationCenter.default.publisher(for: .instancesDidChange)) { _ in
reloadIfEffectiveContextMoved()
}
// Signing in again keeps the same account and context, so
// nothing above would fire — but the data on screen may now
// belong to a different person on that server.
.onReceive(NotificationCenter.default.publisher(for: .accountCredentialDidChange)) { _ in
reloadForContextChange()
}
.task(id: instanceConfigurationID) {
LoggingService.shared.debug("SubscriptionsView task triggered, instanceConfigurationID: \(instanceConfigurationID)", category: .general)
await loadSubscriptionsAsync()