From 25d2c2e2c6ff744cf6b0c410d548135bcab154c8 Mon Sep 17 00:00:00 2001 From: Valere Date: Thu, 23 Apr 2020 15:24:32 +0200 Subject: [PATCH] Update design wait for self verification --- CHANGES.md | 1 + .../verification/VerificationBottomSheet.kt | 4 - .../cancel/VerificationCancelController.kt | 2 +- .../epoxy/BottomSheetSelfWaitItem.kt | 30 ++++++ .../request/VerificationRequestController.kt | 24 ++++- .../request/VerificationRequestFragment.kt | 4 + vector/src/main/res/drawable/ic_monitor.xml | 28 ++++++ .../src/main/res/drawable/ic_smartphone.xml | 17 ++++ .../res/layout/item_verification_wait.xml | 94 +++++++++++++++++++ vector/src/main/res/values/strings.xml | 2 +- vector/src/main/res/values/strings_riotX.xml | 7 +- 11 files changed, 201 insertions(+), 12 deletions(-) create mode 100644 vector/src/main/java/im/vector/riotx/features/crypto/verification/epoxy/BottomSheetSelfWaitItem.kt create mode 100644 vector/src/main/res/drawable/ic_monitor.xml create mode 100644 vector/src/main/res/drawable/ic_smartphone.xml create mode 100644 vector/src/main/res/layout/item_verification_wait.xml diff --git a/CHANGES.md b/CHANGES.md index d343dfe5b4..20aef5d77b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,6 +22,7 @@ Improvements πŸ™Œ: - Emoji Verification | It's not the same butterfly! (#1220) - Cross-Signing | Composer decoration: shields (#1077) - Cross-Signing | Migrate existing keybackup to cross signing with 4S from mobile (#1197) + - Cross-Signing | Consider not using a spinner on the 'complete security' prompt (#1271) Bugfix πŸ›: - Fix summary notification staying after "mark as read" diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/verification/VerificationBottomSheet.kt b/vector/src/main/java/im/vector/riotx/features/crypto/verification/VerificationBottomSheet.kt index 695716d386..e07150ed4f 100644 --- a/vector/src/main/java/im/vector/riotx/features/crypto/verification/VerificationBottomSheet.kt +++ b/vector/src/main/java/im/vector/riotx/features/crypto/verification/VerificationBottomSheet.kt @@ -324,10 +324,6 @@ class VerificationBottomSheet : VectorBaseBottomSheetDialogFragment() { } } - override fun dismiss() { - super.dismiss() - } - companion object { const val SECRET_REQUEST_CODE = 101 diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/verification/cancel/VerificationCancelController.kt b/vector/src/main/java/im/vector/riotx/features/crypto/verification/cancel/VerificationCancelController.kt index 49b2f7dce1..73f449a3c3 100644 --- a/vector/src/main/java/im/vector/riotx/features/crypto/verification/cancel/VerificationCancelController.kt +++ b/vector/src/main/java/im/vector/riotx/features/crypto/verification/cancel/VerificationCancelController.kt @@ -76,7 +76,7 @@ class VerificationCancelController @Inject constructor( bottomSheetVerificationActionItem { id("cancel") - title(stringProvider.getString(R.string.cancel)) + title(stringProvider.getString(R.string.skip)) titleColor(colorProvider.getColor(R.color.riotx_destructive_accent)) iconRes(R.drawable.ic_arrow_right) iconColor(colorProvider.getColor(R.color.riotx_destructive_accent)) diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/verification/epoxy/BottomSheetSelfWaitItem.kt b/vector/src/main/java/im/vector/riotx/features/crypto/verification/epoxy/BottomSheetSelfWaitItem.kt new file mode 100644 index 0000000000..6afc330f62 --- /dev/null +++ b/vector/src/main/java/im/vector/riotx/features/crypto/verification/epoxy/BottomSheetSelfWaitItem.kt @@ -0,0 +1,30 @@ +/* + * Copyright 2020 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package im.vector.riotx.features.crypto.verification.epoxy + +import com.airbnb.epoxy.EpoxyModelClass +import im.vector.riotx.R +import im.vector.riotx.core.epoxy.VectorEpoxyHolder +import im.vector.riotx.core.epoxy.VectorEpoxyModel + +/** + * A action for bottom sheet. + */ +@EpoxyModelClass(layout = R.layout.item_verification_wait) +abstract class BottomSheetSelfWaitItem : VectorEpoxyModel() { + class Holder : VectorEpoxyHolder() +} diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/verification/request/VerificationRequestController.kt b/vector/src/main/java/im/vector/riotx/features/crypto/verification/request/VerificationRequestController.kt index 56c76bc2b0..bf506cac24 100644 --- a/vector/src/main/java/im/vector/riotx/features/crypto/verification/request/VerificationRequestController.kt +++ b/vector/src/main/java/im/vector/riotx/features/crypto/verification/request/VerificationRequestController.kt @@ -27,6 +27,7 @@ import im.vector.riotx.core.resources.ColorProvider import im.vector.riotx.core.resources.StringProvider import im.vector.riotx.core.utils.colorizeMatchingText import im.vector.riotx.features.crypto.verification.VerificationBottomSheetViewState +import im.vector.riotx.features.crypto.verification.epoxy.bottomSheetSelfWaitItem import im.vector.riotx.features.crypto.verification.epoxy.bottomSheetVerificationActionItem import im.vector.riotx.features.crypto.verification.epoxy.bottomSheetVerificationNoticeItem import im.vector.riotx.features.crypto.verification.epoxy.bottomSheetVerificationWaitingItem @@ -56,13 +57,12 @@ class VerificationRequestController @Inject constructor( notice(stringProvider.getString(R.string.verification_open_other_to_verify)) } - dividerItem { - id("sep") + bottomSheetSelfWaitItem { + id("waiting") } - bottomSheetVerificationWaitingItem { - id("waiting") - title(stringProvider.getString(R.string.verification_request_waiting, matrixItem.getBestName())) + dividerItem { + id("sep") } bottomSheetVerificationActionItem { @@ -74,6 +74,19 @@ class VerificationRequestController @Inject constructor( iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary)) listener { listener?.onClickRecoverFromPassphrase() } } + + dividerItem { + id("sep1") + } + + bottomSheetVerificationActionItem { + id("skip") + title(stringProvider.getString(R.string.skip)) + titleColor(colorProvider.getColor(R.color.riotx_destructive_accent)) + iconRes(R.drawable.ic_arrow_right) + iconColor(colorProvider.getColor(R.color.riotx_destructive_accent)) + listener { listener?.onClickSkip() } + } } else { val styledText = if (state.isMe) { @@ -153,5 +166,6 @@ class VerificationRequestController @Inject constructor( fun onClickOnWasNotMe() fun onClickRecoverFromPassphrase() fun onClickDismiss() + fun onClickSkip() } } diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/verification/request/VerificationRequestFragment.kt b/vector/src/main/java/im/vector/riotx/features/crypto/verification/request/VerificationRequestFragment.kt index b6c3659988..967f2946c1 100644 --- a/vector/src/main/java/im/vector/riotx/features/crypto/verification/request/VerificationRequestFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/crypto/verification/request/VerificationRequestFragment.kt @@ -70,6 +70,10 @@ class VerificationRequestFragment @Inject constructor( viewModel.handle(VerificationAction.SkipVerification) } + override fun onClickSkip() { + viewModel.queryCancel() + } + override fun onClickOnWasNotMe() { viewModel.itWasNotMe() } diff --git a/vector/src/main/res/drawable/ic_monitor.xml b/vector/src/main/res/drawable/ic_monitor.xml new file mode 100644 index 0000000000..c6bbe52171 --- /dev/null +++ b/vector/src/main/res/drawable/ic_monitor.xml @@ -0,0 +1,28 @@ + + + + + diff --git a/vector/src/main/res/drawable/ic_smartphone.xml b/vector/src/main/res/drawable/ic_smartphone.xml new file mode 100644 index 0000000000..3f1072ce16 --- /dev/null +++ b/vector/src/main/res/drawable/ic_smartphone.xml @@ -0,0 +1,17 @@ + + + + diff --git a/vector/src/main/res/layout/item_verification_wait.xml b/vector/src/main/res/layout/item_verification_wait.xml new file mode 100644 index 0000000000..6ef3269b7e --- /dev/null +++ b/vector/src/main/res/layout/item_verification_wait.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index b37e7fd729..d49d6ea310 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -2166,7 +2166,7 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming Selected Option Creates a simple poll - Use a recovery method + Use a Recovery Passphrase or Key If you can’t access an existing session New Sign In diff --git a/vector/src/main/res/values/strings_riotX.xml b/vector/src/main/res/values/strings_riotX.xml index 3e23f61acf..3f03bdc59d 100644 --- a/vector/src/main/res/values/strings_riotX.xml +++ b/vector/src/main/res/values/strings_riotX.xml @@ -6,7 +6,12 @@ - + Monitor + Smartphone + Riot Web\nRiot Desktop + Riot iOS\nRiot X for Android + or another cross-signing capable Matrix client + Use the latest Riot on your other devices: