Skip to content

Commit 25edcaf

Browse files
authored
Merge pull request #7950 from vector-im/feature/ons/dismiss_verification_bottomsheet
Make verification bottom sheet cancellable on tap outside (PSG-1139)
2 parents 1b192ea + 4a49f2f commit 25edcaf

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

changelog.d/4025.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix can't get out of a verification dialog

vector/src/main/java/im/vector/app/features/crypto/verification/VerificationBottomSheet.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ package im.vector.app.features.crypto.verification
1717

1818
import android.app.Activity
1919
import android.app.Dialog
20+
import android.content.DialogInterface
2021
import android.os.Bundle
2122
import android.os.Parcelable
2223
import android.view.KeyEvent
@@ -84,10 +85,6 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
8485
return BottomSheetVerificationBinding.inflate(inflater, container, false)
8586
}
8687

87-
init {
88-
isCancelable = false
89-
}
90-
9188
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
9289
super.onViewCreated(view, savedInstanceState)
9390

@@ -210,6 +207,8 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
210207
return@withState
211208
}
212209

210+
isCancelable = state.isVerificationRequired.not()
211+
213212
// Did the request result in a SAS transaction?
214213
if (state.sasTransactionState != null) {
215214
when (state.sasTransactionState) {
@@ -396,6 +395,11 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment<BottomSheetV
396395

397396
const val WAITING_SELF_VERIF_TAG: String = "WAITING_SELF_VERIF_TAG"
398397
}
398+
399+
override fun onCancel(dialog: DialogInterface) {
400+
super.onCancel(dialog)
401+
viewModel.confirmCancel()
402+
}
399403
}
400404

401405
// fun View.getParentCoordinatorLayout(): CoordinatorLayout? {

0 commit comments

Comments
 (0)