Fix sas match action

This commit is contained in:
Valere 2022-11-21 18:54:49 +01:00
parent 4ce6a25c70
commit 5b3e3a7019
3 changed files with 20 additions and 6 deletions

View File

@ -24,6 +24,7 @@ import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.R
import im.vector.app.core.extensions.commitTransaction
@ -72,10 +73,23 @@ class UserVerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSh
super.onViewCreated(view, savedInstanceState)
viewModel.observeViewEvents { event ->
when (event) {
VerificationBottomSheetViewEvents.AccessSecretStore -> TODO()
VerificationBottomSheetViewEvents.Dismiss -> TODO()
VerificationBottomSheetViewEvents.GoToSettings -> TODO()
is VerificationBottomSheetViewEvents.ModalError -> TODO()
VerificationBottomSheetViewEvents.AccessSecretStore -> {
// nop for user verification?
}
VerificationBottomSheetViewEvents.Dismiss -> {
dismiss()
}
VerificationBottomSheetViewEvents.GoToSettings -> {
// nop for user verificaiton
}
is VerificationBottomSheetViewEvents.ModalError -> {
MaterialAlertDialogBuilder(requireContext())
.setTitle(getString(R.string.dialog_title_error))
.setMessage(event.errorMessage)
.setCancelable(false)
.setPositiveButton(R.string.ok, null)
.show()
}
}
}
}

View File

@ -85,7 +85,7 @@ class UserVerificationFragment : VectorBaseFragment<BottomSheetVerificationChild
}
override fun onDone(b: Boolean) {
// viewModel.handle(VerificationAction.)
viewModel.handle(VerificationAction.GotItConclusion(true))
}
override fun onDoNotMatchButtonTapped() {

View File

@ -365,7 +365,7 @@ class UserVerificationViewModel @AssistedInject constructor(
viewModelScope.launch {
val transaction = session.cryptoService().verificationService()
.getExistingTransaction(state.otherUserId, state.transactionId.orEmpty())
(transaction as? SasVerificationTransaction)?.shortCodeDoesNotMatch()
(transaction as? SasVerificationTransaction)?.userHasVerifiedShortCode()
}
}
}