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 {