-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add user verification and verification state violation badges #4392
base: develop
Are you sure you want to change the base?
Conversation
… `libs:matrixui` module so they can be reused
…f the user is verified or not, but in which state they are
…em in room details screen
…con next to the room members in the room member list screen
…nd withdraw verification button in the room member profile. Generic user profiles won't display verification state anymore since we can't easily track changes in it.
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4392 +/- ##
=========================================
Coverage 80.12% 80.12%
=========================================
Files 2064 2063 -1
Lines 54998 55127 +129
Branches 6742 6757 +15
=========================================
+ Hits 44065 44171 +106
- Misses 8631 8645 +14
- Partials 2302 2311 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, thanks!
I have some first remarks. I have not tested the PR yet.
var dmUserVerificationState by remember { mutableStateOf<IdentityState?>(null) } | ||
|
||
LifecycleResumeEffect(Unit) { | ||
if (room.isDm && room.isEncrypted) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use room.isDm
and room.isEncrypted
as keys of LifecycleResumeEffect
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think those can't change, but maybe I should use the RoomInfo.isDm
and RoomInfo.isEncrypted
instead (once the 2nd one is available) 🤔 .
LifecycleResumeEffect(Unit) { | ||
if (room.isDm && room.isEncrypted) { | ||
localCoroutineScope.launch { | ||
val dmUserId = room.getMembers().getOrNull()?.find { it.userId != room.sessionId }?.userId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if getMembers will always returns the whole member list. Maybe for DM this is OK.
Else you may want to use
val membersState by room.membersStateFlow.collectAsState()
val otherMember = room.getDirectRoomMember(membersState)
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right, I just noticed the warning in its docs:
Get the members of the room. Note: generally this should not be used, please use [membersStateFlow] and [updateMembers] instead.
@@ -188,6 +190,7 @@ fun MessagesView( | |||
roomAvatar = state.roomAvatar.dataOrNull(), | |||
heroes = state.heroes, | |||
roomCallState = state.roomCallState, | |||
isDmUserVerified = state.dmUserVerificationState == IdentityState.Verified, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not confortable with this comparison because isDmUserVerified
will be false when the room is not a DM. If later we decide to render something else when this is a DM and the other user is not verified, we will have some trouble.
Since dmUserVerificationState
is nullable, can you change this to
isDmUserVerified = state.dmUserVerificationState == IdentityState.Verified, | |
isDmUserVerified = state.dmUserVerificationState?.let { it == IdentityState.Verified }, |
isDmUserVerified
will need to be nullable as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I mean if it's not a DM for sure the DM user is not verified (since there isn't one 😅 ) but maybe with the null value it'll be clearer.
|
||
if (isDmUserVerified) { | ||
Icon(imageVector = CompoundIcons.Verified(), tint = ElementTheme.colors.iconSuccessPrimary, contentDescription = null) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
): T { | ||
currentComposer.startProvider(LocalLifecycleOwner provides lifecycleOwner) | ||
val state = block() | ||
currentComposer.endProviders() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentComposer.endProviders() | |
currentComposer.endProvider() |
Seems to be more appropriate. endProviders()
has to be used when startProviders()
has been called. This is probably equivalent though.
style = ElementTheme.typography.fontBodySmRegular, | ||
color = ElementTheme.colors.textSecondary, | ||
) | ||
trailingContent = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content
observerRoomMemberIdentityStateChanges
and associated classes fromMessageComposer
to:libraries:matrixui
so we can reuse it in several places.Motivation and context
Closes #4240
Screenshots / GIFs
There are quite a few in the PR.
Tests
Just test the changes mentioned above, if possible.
Tested devices
Checklist