gitbay/Push/PushRouter.swift

v1.11.0
gitbay-ios/gitbay/Push/PushRouter.swift history · blame · raw

23 lines · 852 bytes

 1import Foundation
 2import Observation
 3
 4/// Carries a tapped notification's destination into the view tree.
 5///
 6/// Owned by `gitbayApp`, above `ContentView`. The `TabView` inside
 7/// `ContentView` carries `.id(account.id)`, so the account switch a
 8/// cross-account tap performs tears that subtree down and rebuilds it.
 9/// A target held inside would go with it; held here, the rebuilt tree
10/// drains it.
11///
12/// The `.id` is on the `TabView`, not on `ContentView` itself, so
13/// `ContentView`'s own `@State` survives the switch — which is why the
14/// Dashboard path is reset explicitly in the drain rather than by
15/// identity.
16@Observable
17@MainActor
18final class PushRouter {
19    var pending: PushTarget?
20    /// A universal link to route, held for the same reason, and across
21    /// sign-in when it arrives signed out.
22    var pendingLink: URL?
23}