Skip to content

Commit

Permalink
Address PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Feb 10, 2025
1 parent 3dcae93 commit 171a9a9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,15 @@ class SessionVerificationScreenViewModel: SessionVerificationViewModelType, Sess
case (.initial, .acceptVerificationRequest, .acceptingVerificationRequest):
acceptVerificationRequest()
case (.initial, .requestVerification, .requestingVerification):
requestVerification()
Task {
switch await self.requestVerification() {
case .success:
// Need to wait for the callback from the remote
break
case .failure:
self.stateMachine.processEvent(.didFail)
}
}
case (.verificationRequestAccepted, .startSasVerification, .startingSasVerification):
startSasVerification()
case (.showingChallenge, .acceptChallenge, .acceptingChallenge):
Expand Down Expand Up @@ -166,28 +174,14 @@ class SessionVerificationScreenViewModel: SessionVerificationViewModelType, Sess
}
}

private func requestVerification() {
Task {
switch flow {
case .deviceInitiator:
switch await sessionVerificationControllerProxy.requestDeviceVerification() {
case .success:
// Need to wait for the callback from the remote
break
case .failure:
stateMachine.processEvent(.didFail)
}
case .userIntiator(let userID):
switch await sessionVerificationControllerProxy.requestUserVerification(userID) {
case .success:
// Need to wait for the callback from the remote
break
case .failure:
stateMachine.processEvent(.didFail)
}
default:
fatalError("Incorrect API usage.")
}
private func requestVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
switch flow {
case .deviceInitiator:
return await sessionVerificationControllerProxy.requestDeviceVerification()
case .userIntiator(let userID):
return await sessionVerificationControllerProxy.requestUserVerification(userID)
default:
fatalError("Incorrect API usage.")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ struct SessionVerificationRequestDetailsView: View {
}

.font(.compound.bodyMDSemibold)

Text(L10n.screenSessionVerificationRequestFooter)
.font(.compound.bodyMDSemibold)
.foregroundColor(.compound.textPrimary)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct SessionVerificationScreen: View {
// MARK: - Private

private var toolbar: some ToolbarContent {
ToolbarItem(placement: .navigationBarLeading) {
ToolbarItem(placement: .cancellationAction) {
switch context.viewState.flow {
case .userIntiator, .userResponder:
Button(L10n.actionCancel) {
Expand Down

0 comments on commit 171a9a9

Please sign in to comment.