Handle OIDC cancellation and workaround missing progress when linking a new device. (#4935)

* Fix a bug where the link device flow wasn't dismissed when complete.

* Listen for cancellation of the WAS when linking a device (dismissing the QR screen when it happens).

* Add CustomStringConvertible conformances to QRCodeLoginScreen actions.
This commit is contained in:
Doug
2026-01-09 14:08:05 +00:00
committed by GitHub
parent 15eae621b2
commit 082a2f850e
10 changed files with 122 additions and 38 deletions

View File

@@ -150,7 +150,7 @@ final class QRCodeLoginScreenViewModelTests: XCTestCase {
try await deferredFailure.fulfill()
deferredAction = deferFulfillment(viewModel.actionsPublisher) { action in
guard case .dismiss = action else { return false }
guard case .linkedDevice = action else { return false }
return true
}
linkDesktopProgressSubject.send(.done)
@@ -179,17 +179,18 @@ final class QRCodeLoginScreenViewModelTests: XCTestCase {
linkMobileProgressSubject.send(.waitingForAuthorisation(verificationURL: .homeDirectory))
try await deferredAction.fulfill()
let currentState = context.viewState.state
let deferredFailure = deferFailure(context.$viewState, timeout: 1) { $0.state != currentState }
linkMobileProgressSubject.send(.syncingSecrets)
try await deferredFailure.fulfill()
// Note: The SDK rarely sends the done action, so this test has been updated for the workaround of finishing early.
deferredAction = deferFulfillment(viewModel.actionsPublisher) { action in
guard case .dismiss = action else { return false }
guard case .linkedDevice = action else { return false }
return true
}
linkMobileProgressSubject.send(.done)
linkMobileProgressSubject.send(.syncingSecrets)
try await deferredAction.fulfill()
let currentState = context.viewState.state
let deferredFailure = deferFailure(context.$viewState, timeout: 1) { $0.state != currentState }
linkMobileProgressSubject.send(.done)
try await deferredFailure.fulfill()
}
// MARK: - Helpers