diff --git a/ElementX/Sources/Screens/Onboarding/SessionVerificationScreen/SessionVerificationScreenViewModel.swift b/ElementX/Sources/Screens/Onboarding/SessionVerificationScreen/SessionVerificationScreenViewModel.swift index 84896a447..6740eea8d 100644 --- a/ElementX/Sources/Screens/Onboarding/SessionVerificationScreen/SessionVerificationScreenViewModel.swift +++ b/ElementX/Sources/Screens/Onboarding/SessionVerificationScreen/SessionVerificationScreenViewModel.swift @@ -166,7 +166,8 @@ class SessionVerificationScreenViewModel: SessionVerificationViewModelType, Sess switch await sessionVerificationControllerProxy.acceptVerificationRequest() { case .success: - stateMachine.processEvent(.didAcceptVerificationRequest) + // Need to wait for the callback from the remote + break case .failure: stateMachine.processEvent(.didFail) } diff --git a/ElementX/Sources/Services/SessionVerification/SessionVerificationControllerProxy.swift b/ElementX/Sources/Services/SessionVerification/SessionVerificationControllerProxy.swift index 2406e357a..83eed825a 100644 --- a/ElementX/Sources/Services/SessionVerification/SessionVerificationControllerProxy.swift +++ b/ElementX/Sources/Services/SessionVerification/SessionVerificationControllerProxy.swift @@ -85,6 +85,10 @@ class SessionVerificationControllerProxy: SessionVerificationControllerProxyProt do { try await sessionVerificationController.acceptVerificationRequest() + + MXLog.info("Accepted verification request") + actions.send(.acceptedVerificationRequest) + return .success(()) } catch { MXLog.error("Failed requesting session verification with error: \(error)") @@ -179,9 +183,10 @@ class SessionVerificationControllerProxy: SessionVerificationControllerProxyProt } fileprivate func didAcceptVerificationRequest() { - MXLog.info("Accepted verification request") - - actions.send(.acceptedVerificationRequest) + // Noop because the rust side state machine changes states before sending + // the actual request, leading to race conditions with the SAS verification + // startup. The `acceptedVerificationRequest` is now called from the `startSasVerification` + // method above. } fileprivate func didStartSasVerification() {