Merge pull request #4423 from element-hq/fix/display-user-verification-violation-on-top-app-bar-of-room-screen
Display user verification violation icon in DM rooms too
This commit is contained in:
commit
43cf8a11dd
10 changed files with 45 additions and 20 deletions
|
|
@ -187,13 +187,17 @@ class MessagesPresenter @AssistedInject constructor(
|
|||
|
||||
val membersState by room.membersStateFlow.collectAsState()
|
||||
val dmRoomMember by room.getDirectRoomMember(membersState)
|
||||
val roomMemberIdentityStateChanges = identityChangeState.roomMemberIdentityStateChanges
|
||||
|
||||
// TODO use `RoomInfo.isEncrypted` as a key here once it's available
|
||||
LifecycleResumeEffect(dmRoomMember) {
|
||||
LifecycleResumeEffect(dmRoomMember, roomMemberIdentityStateChanges) {
|
||||
if (room.isEncrypted) {
|
||||
val dmRoomMemberId = dmRoomMember?.userId
|
||||
localCoroutineScope.launch {
|
||||
dmRoomMemberId?.let { dmUserVerificationState = encryptionService.getUserIdentity(it).getOrNull() }
|
||||
dmRoomMemberId?.let { userId ->
|
||||
dmUserVerificationState = roomMemberIdentityStateChanges.find { it.identityRoomMember.userId == userId }?.identityState
|
||||
?: encryptionService.getUserIdentity(userId).getOrNull()
|
||||
}
|
||||
}
|
||||
}
|
||||
onPauseOrDispose {}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,8 @@ open class MessagesStateProvider : PreviewParameterProvider<MessagesState> {
|
|||
currentPinnedMessageIndex = 0,
|
||||
),
|
||||
),
|
||||
aMessagesState(roomName = AsyncData.Success("A DM with a very looong name"), dmUserVerificationState = IdentityState.Verified)
|
||||
aMessagesState(roomName = AsyncData.Success("A DM with a very looong name"), dmUserVerificationState = IdentityState.Verified),
|
||||
aMessagesState(roomName = AsyncData.Success("A DM with a very looong name"), dmUserVerificationState = IdentityState.VerificationViolation),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ fun MessagesView(
|
|||
roomAvatar = state.roomAvatar.dataOrNull(),
|
||||
heroes = state.heroes,
|
||||
roomCallState = state.roomCallState,
|
||||
isDmUserVerified = state.dmUserVerificationState?.let { it == IdentityState.Verified },
|
||||
dmUserIdentityState = state.dmUserVerificationState,
|
||||
onBackClick = { hidingKeyboard { onBackClick() } },
|
||||
onRoomDetailsClick = { hidingKeyboard { onRoomDetailsClick() } },
|
||||
onJoinCallClick = onJoinCallClick,
|
||||
|
|
@ -458,7 +458,7 @@ private fun MessagesViewTopBar(
|
|||
roomAvatar: AvatarData?,
|
||||
heroes: ImmutableList<AvatarData>,
|
||||
roomCallState: RoomCallState,
|
||||
isDmUserVerified: Boolean?,
|
||||
dmUserIdentityState: IdentityState?,
|
||||
onRoomDetailsClick: () -> Unit,
|
||||
onJoinCallClick: () -> Unit,
|
||||
onBackClick: () -> Unit,
|
||||
|
|
@ -490,13 +490,24 @@ private fun MessagesViewTopBar(
|
|||
)
|
||||
}
|
||||
|
||||
if (isDmUserVerified == true) {
|
||||
Icon(
|
||||
modifier = Modifier.requiredWidthIn(min = 24.dp),
|
||||
imageVector = CompoundIcons.Verified(),
|
||||
tint = ElementTheme.colors.iconSuccessPrimary,
|
||||
contentDescription = null
|
||||
)
|
||||
when (dmUserIdentityState) {
|
||||
IdentityState.Verified -> {
|
||||
Icon(
|
||||
modifier = Modifier.requiredWidthIn(min = 16.dp),
|
||||
imageVector = CompoundIcons.Verified(),
|
||||
tint = ElementTheme.colors.iconSuccessPrimary,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
IdentityState.VerificationViolation -> {
|
||||
Icon(
|
||||
modifier = Modifier.requiredWidthIn(min = 16.dp),
|
||||
imageVector = CompoundIcons.ErrorSolid(),
|
||||
tint = ElementTheme.colors.iconCriticalPrimary,
|
||||
contentDescription = null,
|
||||
)
|
||||
}
|
||||
else -> Unit
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import androidx.compose.foundation.layout.Row
|
|||
import androidx.compose.foundation.layout.consumeWindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyListScope
|
||||
import androidx.compose.foundation.lazy.items
|
||||
|
|
@ -319,6 +320,7 @@ private fun RoomMemberListItem(
|
|||
when (roomMemberWithIdentity.identityState) {
|
||||
IdentityState.Verified -> {
|
||||
Icon(
|
||||
modifier = Modifier.size(20.dp),
|
||||
imageVector = CompoundIcons.Verified(),
|
||||
contentDescription = stringResource(CommonStrings.common_verified),
|
||||
tint = ElementTheme.colors.iconSuccessPrimary
|
||||
|
|
@ -326,6 +328,7 @@ private fun RoomMemberListItem(
|
|||
}
|
||||
IdentityState.VerificationViolation -> {
|
||||
Icon(
|
||||
modifier = Modifier.size(20.dp),
|
||||
imageVector = CompoundIcons.ErrorSolid(),
|
||||
contentDescription = stringResource(
|
||||
CommonStrings.crypto_identity_change_profile_pin_violation,
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:250111eb95059839f71392dbfe683e7141825bb901b880ab402a412eb0a2edc0
|
||||
size 60477
|
||||
oid sha256:b3387b50f6e1c50831f802140d125e633c028183a26527a67b2eeb11b17b94a0
|
||||
size 60224
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bc7b967eb01668be02cab6ce6f77994622e94cf7d44da0e6b5996d2348f43108
|
||||
size 60118
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:70f7e53cdeebda6fcbf0b9e542323eff9333f01acb822607b1bfeb784a5a61c2
|
||||
size 59960
|
||||
oid sha256:8a0a77633d8d2bfe5f29cd772525769e4dfa613518408db8dfe8a27cf680da9f
|
||||
size 59715
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e7b1d184e7ef2e9324bd5e4b1e6b6e27521a9d9a50c12210b55594919670ee24
|
||||
size 59657
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a532a73c1c1d7c72503ca75f3f9863a3e4e073a0cc780ec05483e5c3001bd405
|
||||
size 45665
|
||||
oid sha256:dc12de5ab3944ab1e5ac3d352bbac286d44ed4a5e67cd040309a7a32b1cbd9d1
|
||||
size 45438
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:af97cc1cda5eab600630181788cbbd7ce6f4db3c18d6f6b5c44519f1a4e0b1e0
|
||||
size 45622
|
||||
oid sha256:d24fb38f4cf8e0c8194abbbe1feca02b9515f4fe12db03f05730c2aab2a0c1e9
|
||||
size 45433
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue