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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user