From 4b948fe10858e04f247ed0f80c4ef530281f3386 Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Fri, 16 Oct 2026 16:20:51 +0100 Subject: [PATCH] Handle an API change where QR code logins now return a task. (#6354) Quick workaround for now, proper task cancellation will follow. --- .../Services/Authentication/AuthenticationService.swift | 2 +- .../Services/Authentication/LinkNewDeviceService.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ElementX/Sources/Services/Authentication/AuthenticationService.swift b/ElementX/Sources/Services/Authentication/AuthenticationService.swift index 3d12770be..f4de7b3a2 100644 --- a/ElementX/Sources/Services/Authentication/AuthenticationService.swift +++ b/ElementX/Sources/Services/Authentication/AuthenticationService.swift @@ -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): diff --git a/ElementX/Sources/Services/Authentication/LinkNewDeviceService.swift b/ElementX/Sources/Services/Authentication/LinkNewDeviceService.swift index ade3b113d..c061297c7 100644 --- a/ElementX/Sources/Services/Authentication/LinkNewDeviceService.swift +++ b/ElementX/Sources/Services/Authentication/LinkNewDeviceService.swift @@ -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 {