Cross signing: we should not show the verify with other sessions when there is not
This commit is contained in:
parent
40aa012588
commit
69e624df41
|
@ -76,7 +76,8 @@ data class VerificationBottomSheetViewState(
|
||||||
val userWantsToCancel: Boolean = false,
|
val userWantsToCancel: Boolean = false,
|
||||||
val userThinkItsNotHim: Boolean = false,
|
val userThinkItsNotHim: Boolean = false,
|
||||||
val quadSContainsSecrets: Boolean = true,
|
val quadSContainsSecrets: Boolean = true,
|
||||||
val quadSHasBeenReset: Boolean = false
|
val quadSHasBeenReset: Boolean = false,
|
||||||
|
val hasAnyOtherSession: Boolean = false
|
||||||
) : MvRxState
|
) : MvRxState
|
||||||
|
|
||||||
class VerificationBottomSheetViewModel @AssistedInject constructor(
|
class VerificationBottomSheetViewModel @AssistedInject constructor(
|
||||||
|
@ -119,6 +120,12 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
||||||
session.cryptoService().verificationService().getExistingTransaction(args.otherUserId, it) as? QrCodeVerificationTransaction
|
session.cryptoService().verificationService().getExistingTransaction(args.otherUserId, it) as? QrCodeVerificationTransaction
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val hasAnyOtherSession = session.cryptoService()
|
||||||
|
.getCryptoDeviceInfo(session.myUserId)
|
||||||
|
.any {
|
||||||
|
it.deviceId != session.sessionParams.deviceId
|
||||||
|
}
|
||||||
|
|
||||||
setState {
|
setState {
|
||||||
copy(
|
copy(
|
||||||
otherUserMxItem = userItem?.toMatrixItem(),
|
otherUserMxItem = userItem?.toMatrixItem(),
|
||||||
|
@ -130,7 +137,8 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
||||||
roomId = args.roomId,
|
roomId = args.roomId,
|
||||||
isMe = args.otherUserId == session.myUserId,
|
isMe = args.otherUserId == session.myUserId,
|
||||||
currentDeviceCanCrossSign = session.cryptoService().crossSigningService().canCrossSign(),
|
currentDeviceCanCrossSign = session.cryptoService().crossSigningService().canCrossSign(),
|
||||||
quadSContainsSecrets = session.sharedSecretStorageService.isRecoverySetup()
|
quadSContainsSecrets = session.sharedSecretStorageService.isRecoverySetup(),
|
||||||
|
hasAnyOtherSession = hasAnyOtherSession
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,25 +52,33 @@ class VerificationRequestController @Inject constructor(
|
||||||
val matrixItem = viewState?.otherUserMxItem ?: return
|
val matrixItem = viewState?.otherUserMxItem ?: return
|
||||||
|
|
||||||
if (state.selfVerificationMode) {
|
if (state.selfVerificationMode) {
|
||||||
bottomSheetVerificationNoticeItem {
|
if (state.hasAnyOtherSession) {
|
||||||
id("notice")
|
|
||||||
notice(stringProvider.getString(R.string.verification_open_other_to_verify))
|
|
||||||
}
|
|
||||||
|
|
||||||
bottomSheetSelfWaitItem {
|
bottomSheetVerificationNoticeItem {
|
||||||
id("waiting")
|
id("notice")
|
||||||
}
|
notice(stringProvider.getString(R.string.verification_open_other_to_verify))
|
||||||
|
}
|
||||||
|
|
||||||
dividerItem {
|
bottomSheetSelfWaitItem {
|
||||||
id("sep")
|
id("waiting")
|
||||||
|
}
|
||||||
|
|
||||||
|
dividerItem {
|
||||||
|
id("sep")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.quadSContainsSecrets) {
|
if (state.quadSContainsSecrets) {
|
||||||
|
val subtitle = if (state.hasAnyOtherSession) {
|
||||||
|
stringProvider.getString(R.string.verification_use_passphrase)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
bottomSheetVerificationActionItem {
|
bottomSheetVerificationActionItem {
|
||||||
id("passphrase")
|
id("passphrase")
|
||||||
title(stringProvider.getString(R.string.verification_cannot_access_other_session))
|
title(stringProvider.getString(R.string.verification_cannot_access_other_session))
|
||||||
titleColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
titleColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
subTitle(stringProvider.getString(R.string.verification_use_passphrase))
|
subTitle(subtitle)
|
||||||
iconRes(R.drawable.ic_arrow_right)
|
iconRes(R.drawable.ic_arrow_right)
|
||||||
iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||||
listener { listener?.onClickRecoverFromPassphrase() }
|
listener { listener?.onClickRecoverFromPassphrase() }
|
||||||
|
@ -122,13 +130,13 @@ class VerificationRequestController @Inject constructor(
|
||||||
listener { listener?.onClickOnVerificationStart() }
|
listener { listener?.onClickOnVerificationStart() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Loading -> {
|
is Loading -> {
|
||||||
bottomSheetVerificationWaitingItem {
|
bottomSheetVerificationWaitingItem {
|
||||||
id("waiting")
|
id("waiting")
|
||||||
title(stringProvider.getString(R.string.verification_request_waiting_for, matrixItem.getBestName()))
|
title(stringProvider.getString(R.string.verification_request_waiting_for, matrixItem.getBestName()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is Success -> {
|
is Success -> {
|
||||||
if (!pr.invoke().isReady) {
|
if (!pr.invoke().isReady) {
|
||||||
if (state.isMe) {
|
if (state.isMe) {
|
||||||
bottomSheetVerificationWaitingItem {
|
bottomSheetVerificationWaitingItem {
|
||||||
|
|
Loading…
Reference in New Issue