T-iOS-15: AppEnvironment production DI (real Keychain/probe/transports), EventFanOut (engine.events → TerminalVM + GateVM + activity bridge), scenePhase lifecycle (.background→close, suspend→rebuild+reopen reclaims size), privacy shade on != .active, spike screen deleted, cold-start routing Walkthrough proxies: hosted live-server smoke over the production DI graph (probe→store→ attach→echo→close) + real-Keychain kSecAttrAccessible assertion (closes T-iOS-7 deferral) Deviation closed: TerminalViewModel.lastSentDims (valid-only) + alive-engine .active → notifyForegrounded(dims:) (orchestrator fix on behalf of T-iOS-11 owner) Env finding: repo under ~/Documents → TCC blocks sim-spawned node; SimServerHarness dual-mode (self-bootstrap / WEBTERM_SERVER_URL via simctl launchctl setenv) Verified: 214 pkg + 76 app + 10 integration tests green; verify agent 8/8 PASS
33 lines
1.2 KiB
Swift
33 lines
1.2 KiB
Swift
import Foundation
|
|
import HostRegistry
|
|
|
|
/// T-iOS-15 · Cold-start selection logic, kept pure for unit tests
|
|
/// (ColdStartPolicyTests): which root screen boots, and whether the session
|
|
/// list highlights "继续上次" for the active host.
|
|
enum ColdStartPolicy {
|
|
enum RootRoute: Equatable {
|
|
/// Host store not read yet.
|
|
case loading
|
|
/// No paired host → pairing is the only next step (plan §7 step 1).
|
|
case pairing
|
|
/// At least one paired host → the merged chooser/dashboard list.
|
|
case sessions
|
|
}
|
|
|
|
static func initialRoute(pairedHostCount: Int) -> RootRoute {
|
|
pairedHostCount == 0 ? .pairing : .sessions
|
|
}
|
|
|
|
/// The "继续上次" target for the list's highlight banner: the last
|
|
/// server-adopted session persisted for the ACTIVE host (nil = no banner).
|
|
/// Persistence side: `SessionActivityBridge` (adopted → set, exited →
|
|
/// cleared), so a returned id was live when last seen.
|
|
static func continueLastSessionId(
|
|
activeHost: HostRegistry.Host?,
|
|
store: any LastSessionStore
|
|
) -> UUID? {
|
|
guard let activeHost else { return nil }
|
|
return store.lastSessionId(host: activeHost.id)
|
|
}
|
|
}
|