mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
Merge pull request #2249 from vector-im/feature/fga/hide_cross_signing_no_session
Feature/fga/hide cross signing no session
This commit is contained in:
commit
5d59b445fd
3 changed files with 30 additions and 14 deletions
|
@ -19,6 +19,7 @@ Improvements 🙌:
|
|||
- Implement "Jump to read receipt" and "Mention" actions on the room member profile screen
|
||||
- Add Sygnal API implementation to test is Push are correctly received
|
||||
- Add PushGateway API implementation to test if Push are correctly received
|
||||
- Cross signing: shouldn't offer to verify with other session when there is not. (#2227)
|
||||
|
||||
Bugfix 🐛:
|
||||
- Improve support for image/audio/video/file selection with intent changes (#1376)
|
||||
|
|
|
@ -76,7 +76,8 @@ data class VerificationBottomSheetViewState(
|
|||
val userWantsToCancel: Boolean = false,
|
||||
val userThinkItsNotHim: Boolean = false,
|
||||
val quadSContainsSecrets: Boolean = true,
|
||||
val quadSHasBeenReset: Boolean = false
|
||||
val quadSHasBeenReset: Boolean = false,
|
||||
val hasAnyOtherSession: Boolean = false
|
||||
) : MvRxState
|
||||
|
||||
class VerificationBottomSheetViewModel @AssistedInject constructor(
|
||||
|
@ -119,6 +120,12 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||
session.cryptoService().verificationService().getExistingTransaction(args.otherUserId, it) as? QrCodeVerificationTransaction
|
||||
}
|
||||
|
||||
val hasAnyOtherSession = session.cryptoService()
|
||||
.getCryptoDeviceInfo(session.myUserId)
|
||||
.any {
|
||||
it.deviceId != session.sessionParams.deviceId
|
||||
}
|
||||
|
||||
setState {
|
||||
copy(
|
||||
otherUserMxItem = userItem?.toMatrixItem(),
|
||||
|
@ -130,7 +137,8 @@ class VerificationBottomSheetViewModel @AssistedInject constructor(
|
|||
roomId = args.roomId,
|
||||
isMe = args.otherUserId == session.myUserId,
|
||||
currentDeviceCanCrossSign = session.cryptoService().crossSigningService().canCrossSign(),
|
||||
quadSContainsSecrets = session.sharedSecretStorageService.isRecoverySetup()
|
||||
quadSContainsSecrets = session.sharedSecretStorageService.isRecoverySetup(),
|
||||
hasAnyOtherSession = hasAnyOtherSession
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -52,25 +52,32 @@ class VerificationRequestController @Inject constructor(
|
|||
val matrixItem = viewState?.otherUserMxItem ?: return
|
||||
|
||||
if (state.selfVerificationMode) {
|
||||
bottomSheetVerificationNoticeItem {
|
||||
id("notice")
|
||||
notice(stringProvider.getString(R.string.verification_open_other_to_verify))
|
||||
}
|
||||
if (state.hasAnyOtherSession) {
|
||||
bottomSheetVerificationNoticeItem {
|
||||
id("notice")
|
||||
notice(stringProvider.getString(R.string.verification_open_other_to_verify))
|
||||
}
|
||||
|
||||
bottomSheetSelfWaitItem {
|
||||
id("waiting")
|
||||
}
|
||||
bottomSheetSelfWaitItem {
|
||||
id("waiting")
|
||||
}
|
||||
|
||||
dividerItem {
|
||||
id("sep")
|
||||
dividerItem {
|
||||
id("sep")
|
||||
}
|
||||
}
|
||||
|
||||
if (state.quadSContainsSecrets) {
|
||||
val subtitle = if (state.hasAnyOtherSession) {
|
||||
stringProvider.getString(R.string.verification_use_passphrase)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
bottomSheetVerificationActionItem {
|
||||
id("passphrase")
|
||||
title(stringProvider.getString(R.string.verification_cannot_access_other_session))
|
||||
titleColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||
subTitle(stringProvider.getString(R.string.verification_use_passphrase))
|
||||
subTitle(subtitle)
|
||||
iconRes(R.drawable.ic_arrow_right)
|
||||
iconColor(colorProvider.getColorFromAttribute(R.attr.riotx_text_primary))
|
||||
listener { listener?.onClickRecoverFromPassphrase() }
|
||||
|
@ -122,13 +129,13 @@ class VerificationRequestController @Inject constructor(
|
|||
listener { listener?.onClickOnVerificationStart() }
|
||||
}
|
||||
}
|
||||
is Loading -> {
|
||||
is Loading -> {
|
||||
bottomSheetVerificationWaitingItem {
|
||||
id("waiting")
|
||||
title(stringProvider.getString(R.string.verification_request_waiting_for, matrixItem.getBestName()))
|
||||
}
|
||||
}
|
||||
is Success -> {
|
||||
is Success -> {
|
||||
if (!pr.invoke().isReady) {
|
||||
if (state.isMe) {
|
||||
bottomSheetVerificationWaitingItem {
|
||||
|
|
Loading…
Reference in a new issue