fix(home): simplify transient Flow status card
CI / Validate manifests (push) Has been cancelled
CI / SwiftLint (push) Has been cancelled
CI / iOS / Extension (push) Has been cancelled
CI / macOS (push) Has been cancelled

Show only connection state while Flow is preparing or unavailable, and remove the card entirely once the session is healthy.
This commit is contained in:
Rocky
2026-08-20 20:26:09 +08:00
parent 10bc457c72
commit 1ad22b8697
2 changed files with 110 additions and 118 deletions
@@ -82,6 +82,40 @@ final class FlowHomePiPStatusPolicyTests: XCTestCase {
)
}
func testConnectionCardDisappearsWhenSessionIsHealthy() {
XCTAssertFalse(
shouldShowConnectionCard(
lifecycle: .active,
isHostReady: true
)
)
}
func testConnectionCardRemainsVisibleWhilePreparingOrFailed() {
XCTAssertTrue(
shouldShowConnectionCard(
lifecycle: .preparing(attempt: 1, total: 3),
isHostReady: false
)
)
XCTAssertTrue(
shouldShowConnectionCard(
lifecycle: .failed(.timedOut),
isHostReady: false
)
)
}
func testNormalRecordingDoesNotBringConnectionCardBack() {
XCTAssertFalse(
shouldShowConnectionCard(
lifecycle: .active,
isRecording: true,
isHostReady: false
)
)
}
private func descriptor(
for lifecycle: FlowPiPLifecycleState
) -> FlowHomePiPStatusDescriptor {
@@ -94,4 +128,20 @@ final class FlowHomePiPStatusPolicyTests: XCTestCase {
isHostReady: false
)
}
private func shouldShowConnectionCard(
lifecycle: FlowPiPLifecycleState,
isRecording: Bool = false,
isHostReady: Bool
) -> Bool {
FlowHomePiPStatusPolicy.shouldShowConnectionCard(
lifecycle: lifecycle,
needsPermissionSetup: false,
needsAPIKeySetup: false,
hasSessionWarning: false,
isRecording: isRecording,
isProcessing: false,
isHostReady: isHostReady
)
}
}