mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-28 13:29:32 +00:00
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:
@@ -230,7 +230,7 @@ class AuthenticationService: AuthenticationServiceProtocol {
|
|||||||
do {
|
do {
|
||||||
let client = try await makeClient(serverNameOrBaseURL: scannedServerNameOrBaseURL)
|
let client = try await makeClient(serverNameOrBaseURL: scannedServerNameOrBaseURL)
|
||||||
let qrCodeHandler = client.newLoginWithQrCodeHandler(oauthConfiguration: appSettings.oAuthConfiguration.rustValue)
|
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) {
|
switch await userSession(for: client) {
|
||||||
case .success(let userSession):
|
case .success(let userSession):
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class LinkNewDeviceService: LinkNewDeviceServiceProtocol {
|
|||||||
defer { progressContinuation.finish() }
|
defer { progressContinuation.finish() }
|
||||||
do {
|
do {
|
||||||
// Note: The SDK doesn't provide us with a way to cancel the grant if the user hit the cancel button 🤷♂️
|
// 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
|
// 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)
|
progressSubject.send(LinkMobileProgress.done)
|
||||||
} catch let error as HumanQrGrantLoginError {
|
} catch let error as HumanQrGrantLoginError {
|
||||||
@@ -131,7 +131,7 @@ class LinkNewDeviceService: LinkNewDeviceServiceProtocol {
|
|||||||
defer { progressContinuation.finish() }
|
defer { progressContinuation.finish() }
|
||||||
do {
|
do {
|
||||||
// Note: The SDK doesn't provide us with a way to cancel the grant if the user hit the cancel button 🤷♂️
|
// 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
|
// 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)
|
progressSubject.send(LinkDesktopProgress.done)
|
||||||
} catch let error as HumanQrGrantLoginError {
|
} catch let error as HumanQrGrantLoginError {
|
||||||
|
|||||||
Reference in New Issue
Block a user