Keep destination checkmarks in sync with the main subscribe button

The main button's subscribe/unsubscribe never told the destination
membership loader, so "Subscribe On…" kept a stale checkmark for the
current account — and tapping that row would do the opposite of what
the mark promised.

Also: the menu item and success toast now name the account the write
lands on when more than one destination is offered, and "Subscribe On…"
no longer waits for the channel request — the cached header stands in
until the load answers.
This commit is contained in:
Arkadiusz Fal
2026-09-19 23:51:19 +02:00
parent 7db03f2392
commit 01ff78aaa6
3 changed files with 107 additions and 9 deletions

View File

@@ -85,6 +85,14 @@ final class SubscriptionDestinationMembershipLoader {
func isSubscribed(on context: DataContext) -> Bool? { membership.isSubscribed(on: context) }
/// The main subscribe button wrote to `context` behind these rows' back;
/// without being told, the row for that context keeps the mark from before
/// the write — and a tap on it would then do the opposite of what the mark
/// promises.
func noteToggled(_ context: DataContext, subscribed: Bool) {
membership.record(subscribed, for: context, generation: membership.generation)
}
func isBusy(_ context: DataContext) -> Bool { busy.contains(context) }
/// Asks about `channel`, from a place the SwiftUI lifecycle reaches.