Handle an API change where QR code logins now return a task. (#6354)

Quick workaround for now, proper task cancellation will follow.
This commit is contained in:
Doug
2026-10-16 16:20:51 +01:00
committed by GitHub
parent 074a2d7910
commit 4b948fe108
2 changed files with 3 additions and 3 deletions
@@ -230,7 +230,7 @@ class AuthenticationService: AuthenticationServiceProtocol {
do {
let client = try await makeClient(serverNameOrBaseURL: scannedServerNameOrBaseURL)
let qrCodeHandler = client.newLoginWithQrCodeHandler(oauthConfiguration: appSettings.oAuthConfiguration.rustValue)
try await qrCodeHandler.scan(qrCodeData: qrData, progressListener: listener)
try await qrCodeHandler.scan(qrCodeData: qrData, progressListener: listener).wait()
switch await userSession(for: client) {
case .success(let userSession):
@@ -77,7 +77,7 @@ class LinkNewDeviceService: LinkNewDeviceServiceProtocol {
defer { progressContinuation.finish() }
do {
// Note: The SDK doesn't provide us with a way to cancel the grant if the user hit the cancel button 🤷‍♂️
try await grantLoginHandler.generate(progressListener: listener) // The success state is handled by the listener.
try await grantLoginHandler.generate(progressListener: listener).wait() // The success state is handled by the listener.
// We send the .done progress in case the listener didn't get a chance to pass it on from the SDK before being deallocated
progressSubject.send(LinkMobileProgress.done)
} catch let error as HumanQrGrantLoginError {
@@ -131,7 +131,7 @@ class LinkNewDeviceService: LinkNewDeviceServiceProtocol {
defer { progressContinuation.finish() }
do {
// Note: The SDK doesn't provide us with a way to cancel the grant if the user hit the cancel button 🤷‍♂️
try await grantLoginHandler.scan(qrCodeData: qrCodeData, progressListener: listener) // The success state is handled by the listener.
try await grantLoginHandler.scan(qrCodeData: qrCodeData, progressListener: listener).wait() // The success state is handled by the listener.
// We send the .done progress in case the listener didn't get a chance to pass it on from the SDK before being deallocated
progressSubject.send(LinkDesktopProgress.done)
} catch let error as HumanQrGrantLoginError {