-
Notifications
You must be signed in to change notification settings - Fork 178
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
Room member details presenter improvement #2721
Room member details presenter improvement #2721
Conversation
This will also ensure that blocking a user will work even if the user is not a member of the room (preparatory work for user permalink)
… is not a member of the room. This can be displayed when the user click on a non-member user permalink.
📱 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 #2721 +/- ##
===========================================
- Coverage 73.15% 73.14% -0.01%
===========================================
Files 1480 1480
Lines 35803 35799 -4
Branches 6876 6873 -3
===========================================
- Hits 26192 26186 -6
+ Misses 6052 6051 -1
- Partials 3559 3562 +3 ☔ View full report in Codecov by Sentry. |
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.
Some remarks otherwise LGTM
mutableStateOf(AsyncData.Success(isIgnored)) | ||
} | ||
val isBlocked: MutableState<AsyncData<Boolean>> = remember { mutableStateOf(AsyncData.Uninitialized) } | ||
LaunchedEffect(Unit) { |
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'd use collectAsState
instead
@@ -56,21 +60,24 @@ class RoomMemberDetailsPresenter @AssistedInject constructor( | |||
val coroutineScope = rememberCoroutineScope() | |||
var confirmationDialog by remember { mutableStateOf<ConfirmationDialog?>(null) } | |||
val roomMember by room.getRoomMemberAsState(roomMemberId) | |||
var userProfile by remember { mutableStateOf<MatrixUser?>(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.
Use produceByState
:
val userProfile by produceState<MatrixUser?>(initialValue = null) {
value = client.getProfile(roomMemberId).getOrNull()
}
room.userAvatarUrl(roomMemberId).onSuccess { avatarUrl -> | ||
if (avatarUrl != null) value = avatarUrl | ||
} | ||
var userAvatar: String? by remember { mutableStateOf(roomMember?.avatarUrl ?: userProfile?.avatarUrl) } |
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.
Keep produceState as it makes the var a val (and it's cleaner IMO)
val userName by produceState(initialValue = roomMember?.displayName ?: userProfile?.displayName, roomMember, userProfile){
value = room.userDisplayName(roomMemberId)
.fold(
onSuccess = { it },
onFailure = { userProfile?.displayName }
)
}
|
Type of change
Content
First commit: ensure that "ignore" user state is live by observing
ignoredUsersFlow
Second commit: fallback to userProfile data, if the member is not a user of the room. (I am adding a test about it).
For instance, when clicking on
https://matrix.to/#/@Giom:matrix.org
when the user is not a member of the room:Motivation and context
Screenshots / GIFs
Tests
Tested devices
Checklist