Show cancelled screen instead of dismissing

This commit is contained in:
Valere 2020-03-24 17:38:46 +01:00
parent ee7828a445
commit c4388348f7
4 changed files with 44 additions and 8 deletions

View File

@ -36,6 +36,7 @@ import im.vector.matrix.android.api.session.Session
import im.vector.matrix.android.api.session.crypto.crosssigning.MASTER_KEY_SSSS_NAME
import im.vector.matrix.android.api.session.crypto.crosssigning.SELF_SIGNING_KEY_SSSS_NAME
import im.vector.matrix.android.api.session.crypto.crosssigning.USER_SIGNING_KEY_SSSS_NAME
import im.vector.matrix.android.api.session.crypto.verification.CancelCode
import im.vector.matrix.android.api.session.crypto.verification.VerificationTxState
import im.vector.riotx.R
import im.vector.riotx.core.di.ScreenComponent
@ -263,7 +264,14 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment() {
// Transaction has not yet started
if (state.pendingRequest.invoke()?.cancelConclusion != null) {
// The request has been declined, we should dismiss
dismiss()
otherUserNameText.text = getString(R.string.verification_cancelled)
showFragment(VerificationConclusionFragment::class, Bundle().apply {
putParcelable(MvRx.KEY_ARG, VerificationConclusionFragment.Args(
false,
state.pendingRequest.invoke()?.cancelConclusion?.value ?: CancelCode.User.value,
state.isMe))
})
return@withState
}
// If it's an outgoing
@ -308,6 +316,10 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment() {
}
}
override fun dismiss() {
super.dismiss()
}
companion object {
const val SECRET_REQUEST_CODE = 101

View File

@ -58,6 +58,8 @@ class VerificationConclusionController @Inject constructor(
id("image")
imageRes(R.drawable.ic_shield_trusted)
}
bottomDone()
}
ConclusionState.WARNING -> {
bottomSheetVerificationNoticeItem {
@ -74,14 +76,38 @@ class VerificationConclusionController @Inject constructor(
id("warning_notice")
notice(eventHtmlRenderer.render(stringProvider.getString(R.string.verification_conclusion_compromised)))
}
bottomDone()
}
else -> Unit
ConclusionState.CANCELLED -> {
bottomSheetVerificationNoticeItem {
id("notice_cancelled")
notice(stringProvider.getString(R.string.verify_cancelled_notice))
}
dividerItem {
id("sep0")
}
bottomSheetVerificationActionItem {
id("got_it")
title(stringProvider.getString(R.string.sas_got_it))
titleColor(colorProvider.getColor(R.color.riotx_accent))
iconRes(R.drawable.ic_arrow_right)
iconColor(colorProvider.getColor(R.color.riotx_accent))
listener { listener?.onButtonTapped() }
}
}
}
}
private fun bottomDone() {
dividerItem {
id("sep0")
}
bottomSheetVerificationActionItem {
id("done")
title(stringProvider.getString(R.string.done))

View File

@ -66,13 +66,8 @@ class VerificationConclusionFragment @Inject constructor(
}
override fun invalidate() = withState(viewModel) { state ->
if (state.conclusionState == ConclusionState.CANCELLED) {
// Just dismiss in this case
sharedViewModel.handle(VerificationAction.GotItConclusion)
} else {
controller.update(state)
}
}
override fun onButtonTapped() {
sharedViewModel.handle(VerificationAction.GotItConclusion)

View File

@ -28,6 +28,9 @@
One of the following may be compromised:\n\n- Your password\n- Your homeserver\n- This device, or the other device\n- The internet connection either device is using\n\nWe recommend you change your password & recovery key in Settings immediately.
</string>
<string name="verify_cancelled_notice">Verify your devices from Settings.</string>
<string name="verification_cancelled">Verification Cancelled</string>
<!-- END Strings added by Valere -->