mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Merge branch 'develop' into feature/update_shield_logic
This commit is contained in:
commit
75e66a6550
7 changed files with 41 additions and 24 deletions
|
@ -8,6 +8,7 @@ Features ✨:
|
|||
Improvements 🙌:
|
||||
- Verification DM / Handle concurrent .start after .ready (#794)
|
||||
- CrossSigning / Update Shield Logic for DM (#963)
|
||||
- Xsigning | Complete security new session design update (#1135)
|
||||
|
||||
Bugfix 🐛:
|
||||
- Missing avatar/displayname after verification request message (#841)
|
||||
|
|
|
@ -69,7 +69,7 @@ data class VerificationBottomSheetViewState(
|
|||
|
||||
class VerificationBottomSheetViewModel @AssistedInject constructor(
|
||||
@Assisted initialState: VerificationBottomSheetViewState,
|
||||
@Assisted args: VerificationBottomSheet.VerificationArgs,
|
||||
@Assisted val args: VerificationBottomSheet.VerificationArgs,
|
||||
private val session: Session,
|
||||
private val supportedVerificationMethodsProvider: SupportedVerificationMethodsProvider)
|
||||
: VectorViewModel<VerificationBottomSheetViewState, VerificationAction, VerificationBottomSheetViewEvents>(initialState),
|
||||
|
@ -142,14 +142,19 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||
args: VerificationBottomSheet.VerificationArgs): VerificationBottomSheetViewModel
|
||||
}
|
||||
|
||||
fun queryCancel() = withState {
|
||||
if (it.userThinkItsNotHim) {
|
||||
fun queryCancel() = withState { state ->
|
||||
if (state.userThinkItsNotHim) {
|
||||
setState {
|
||||
copy(userThinkItsNotHim = false)
|
||||
}
|
||||
} else {
|
||||
setState {
|
||||
copy(userWantsToCancel = true)
|
||||
// if the verification is already done you can't cancel anymore
|
||||
if (state.pendingRequest.invoke()?.cancelConclusion != null || state.sasTransactionState is VerificationTxState.TerminalTxState) {
|
||||
// you cannot cancel anymore
|
||||
} else {
|
||||
setState {
|
||||
copy(userWantsToCancel = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -447,7 +452,10 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||
|| pr.localId == state.pendingRequest.invoke()?.localId
|
||||
|| state.pendingRequest.invoke()?.transactionId == pr.transactionId) {
|
||||
setState {
|
||||
copy(pendingRequest = Success(pr))
|
||||
copy(
|
||||
transactionId = args.verificationId ?: pr.transactionId,
|
||||
pendingRequest = Success(pr)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,13 @@
|
|||
|
||||
package im.vector.riotx.features.crypto.verification.cancel
|
||||
|
||||
import androidx.core.text.toSpannable
|
||||
import com.airbnb.epoxy.EpoxyController
|
||||
import im.vector.riotx.R
|
||||
import im.vector.riotx.core.epoxy.dividerItem
|
||||
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.bottomSheetVerificationActionItem
|
||||
import im.vector.riotx.features.crypto.verification.epoxy.bottomSheetVerificationNoticeItem
|
||||
|
@ -56,9 +58,15 @@ class VerificationCancelController @Inject constructor(
|
|||
}
|
||||
}
|
||||
} else {
|
||||
val otherUserID = state.otherUserMxItem?.id ?: ""
|
||||
val otherDisplayName = state.otherUserMxItem?.displayName ?: ""
|
||||
bottomSheetVerificationNoticeItem {
|
||||
id("notice")
|
||||
notice(stringProvider.getString(R.string.verify_cancel_self_verification_from_untrusted))
|
||||
notice(
|
||||
stringProvider.getString(R.string.verify_cancel_other, otherDisplayName, otherUserID)
|
||||
.toSpannable()
|
||||
.colorizeMatchingText(otherUserID, colorProvider.getColorFromAttribute(R.attr.vctr_notice_text_color))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,15 +74,6 @@ class VerificationRequestController @Inject constructor(
|
|||
iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||
listener { listener?.onClickRecoverFromPassphrase() }
|
||||
}
|
||||
bottomSheetVerificationActionItem {
|
||||
id("skip")
|
||||
title(stringProvider.getString(R.string.skip))
|
||||
titleColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||
// subTitle(stringProvider.getString(R.string.verification_use_passphrase))
|
||||
iconRes(R.drawable.ic_arrow_right)
|
||||
iconColor(colorProvider.getColor(R.color.riotx_destructive_accent))
|
||||
listener { listener?.onClickDismiss() }
|
||||
}
|
||||
} else {
|
||||
val styledText =
|
||||
if (state.isMe) {
|
||||
|
|
|
@ -29,6 +29,7 @@ import androidx.drawerlayout.widget.DrawerLayout
|
|||
import androidx.lifecycle.Observer
|
||||
import im.vector.matrix.android.api.MatrixCallback
|
||||
import im.vector.matrix.android.api.session.Session
|
||||
import im.vector.matrix.android.api.util.toMatrixItem
|
||||
import im.vector.matrix.android.internal.crypto.model.CryptoDeviceInfo
|
||||
import im.vector.matrix.android.internal.crypto.model.MXUsersDevicesMap
|
||||
import im.vector.riotx.R
|
||||
|
@ -41,8 +42,8 @@ import im.vector.riotx.core.platform.VectorBaseActivity
|
|||
import im.vector.riotx.core.pushers.PushersManager
|
||||
import im.vector.riotx.features.disclaimer.showDisclaimerDialog
|
||||
import im.vector.riotx.features.notifications.NotificationDrawerManager
|
||||
import im.vector.riotx.features.popup.DefaultVectorAlert
|
||||
import im.vector.riotx.features.popup.PopupAlertManager
|
||||
import im.vector.riotx.features.popup.VerificationVectorAlert
|
||||
import im.vector.riotx.features.rageshake.VectorUncaughtExceptionHandler
|
||||
import im.vector.riotx.features.settings.VectorPreferences
|
||||
import im.vector.riotx.features.workers.signout.SignOutViewModel
|
||||
|
@ -126,6 +127,12 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
|
|||
waiting_view.isVisible = true
|
||||
}
|
||||
})
|
||||
|
||||
// Ask again if the app is relaunched
|
||||
if (!sharedActionViewModel.hasDisplayedCompleteSecurityPrompt
|
||||
&& activeSessionHolder.getSafeActiveSession()?.hasAlreadySynced() == true) {
|
||||
promptCompleteSecurityIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
private fun promptCompleteSecurityIfNeeded() {
|
||||
|
@ -152,13 +159,14 @@ class HomeActivity : VectorBaseActivity(), ToolbarConfigurable {
|
|||
// We need to ask
|
||||
sharedActionViewModel.hasDisplayedCompleteSecurityPrompt = true
|
||||
popupAlertManager.postVectorAlert(
|
||||
DefaultVectorAlert(
|
||||
VerificationVectorAlert(
|
||||
uid = "completeSecurity",
|
||||
title = getString(R.string.new_signin),
|
||||
description = getString(R.string.complete_security),
|
||||
title = getString(R.string.complete_security),
|
||||
description = getString(R.string.crosssigning_verify_this_session),
|
||||
iconId = R.drawable.ic_shield_warning
|
||||
).apply {
|
||||
colorInt = ContextCompat.getColor(this@HomeActivity, R.color.riotx_destructive_accent)
|
||||
matrixItem = session.getUser(session.myUserId)?.toMatrixItem()
|
||||
colorInt = ContextCompat.getColor(this@HomeActivity, R.color.riotx_positive_accent)
|
||||
contentAction = Runnable {
|
||||
(weakCurrentActivity?.get() as? VectorBaseActivity)?.let {
|
||||
it.navigator.waitSessionVerification(it)
|
||||
|
|
|
@ -2126,7 +2126,7 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming
|
|||
<string name="crosssigning_other_user_not_trust">Other users may not trust it</string>
|
||||
<string name="complete_security">Complete Security</string>
|
||||
|
||||
<string name="verification_open_other_to_verify">Open an existing session & use it to verify this one, granting it access to encrypted messages.</string>
|
||||
<string name="verification_open_other_to_verify">Use an existing session to verify this one, granting it access to encrypted messages.</string>
|
||||
|
||||
|
||||
<string name="verification_profile_verify">Verify</string>
|
||||
|
@ -2166,8 +2166,8 @@ Not all features in Riot are implemented in RiotX yet. Main missing (and coming
|
|||
</plurals>
|
||||
<string name="poll_item_selected_aria">Selected Option</string>
|
||||
<string name="command_description_poll">Creates a simple poll</string>
|
||||
<string name="verification_cannot_access_other_session">Can‘t access an existing session?</string>
|
||||
<string name="verification_use_passphrase">Use your recovery key or passphrase</string>
|
||||
<string name="verification_cannot_access_other_session">Use a recovery method</string>
|
||||
<string name="verification_use_passphrase">If you can’t access an existing session</string>
|
||||
|
||||
<string name="new_signin">New Sign In</string>
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
<string name="verify_cancel_self_verification_from_untrusted">If you cancel, you won’t be able to read encrypted messages on this device, and other users won’t trust it</string>
|
||||
<string name="verify_cancel_self_verification_from_trusted">If you cancel, you won’t be able to read encrypted messages on your new device, and other users won’t trust it</string>
|
||||
<string name="verify_cancel_other">You won’t verify %1$s (%2$s) if you cancel now. Start again in their user profile.</string>
|
||||
|
||||
<string name="verify_not_me_self_verification">
|
||||
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.
|
||||
|
|
Loading…
Reference in a new issue