Merge pull request #7950 from vector-im/feature/ons/dismiss_verification_bottomsheet

Make verification bottom sheet cancellable on tap outside (PSG-1139)
This commit is contained in:
Onuray Sahin 2023-01-13 19:50:33 +03:00 committed by GitHub
commit 25edcaf5d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

1
changelog.d/4025.bugfix Normal file
View File

@ -0,0 +1 @@
Fix can't get out of a verification dialog

View File

@ -17,6 +17,7 @@ package im.vector.app.features.crypto.verification
import android.app.Activity
import android.app.Dialog
import android.content.DialogInterface
import android.os.Bundle
import android.os.Parcelable
import android.view.KeyEvent
@ -84,10 +85,6 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
return BottomSheetVerificationBinding.inflate(inflater, container, false)
}
init {
isCancelable = false
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
@ -210,6 +207,8 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
return@withState
}
isCancelable = state.isVerificationRequired.not()
// Did the request result in a SAS transaction?
if (state.sasTransactionState != null) {
when (state.sasTransactionState) {
@ -396,6 +395,11 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
const val WAITING_SELF_VERIF_TAG: String = "WAITING_SELF_VERIF_TAG"
}
override fun onCancel(dialog: DialogInterface) {
super.onCancel(dialog)
viewModel.confirmCancel()
}
}
// fun View.getParentCoordinatorLayout(): CoordinatorLayout? {