UX cleanup: DM details screen (#2820)
* UX cleanup: user profile. - Move send DM to a CTA button. - Add 'Call' CTA button too when there is a DM with that user and a call is possible. - Add missing tests. * Update screenshots * Add tests for clicking on the avatar --------- Co-authored-by: ElementBot <benoitm+elementbot@element.io>
This commit is contained in:
parent
17f5b0fe77
commit
2e93d842c7
38 changed files with 396 additions and 56 deletions
|
|
@ -188,6 +188,10 @@ class RoomDetailsFlowNode @AssistedInject constructor(
|
|||
override fun onStartDM(roomId: RoomId) {
|
||||
plugins<RoomDetailsEntryPoint.Callback>().forEach { it.onOpenRoom(roomId) }
|
||||
}
|
||||
|
||||
override fun onStartCall(roomId: RoomId) {
|
||||
ElementCallActivity.start(context, CallType.RoomCall(roomId = roomId, sessionId = room.sessionId))
|
||||
}
|
||||
}
|
||||
val plugins = listOf(RoomMemberDetailsNode.RoomMemberDetailsInput(navTarget.roomMemberId), callback)
|
||||
createNode<RoomMemberDetailsNode>(buildContext, plugins)
|
||||
|
|
|
|||
|
|
@ -76,6 +76,10 @@ class RoomMemberDetailsNode @AssistedInject constructor(
|
|||
callback.onStartDM(roomId)
|
||||
}
|
||||
|
||||
fun onStartCall(roomId: RoomId) {
|
||||
callback.onStartCall(roomId)
|
||||
}
|
||||
|
||||
val state = presenter.present()
|
||||
|
||||
LaunchedEffect(state.startDmActionState) {
|
||||
|
|
@ -89,7 +93,8 @@ class RoomMemberDetailsNode @AssistedInject constructor(
|
|||
modifier = modifier,
|
||||
goBack = this::navigateUp,
|
||||
onShareUser = ::onShareUser,
|
||||
onDMStarted = ::onStartDM,
|
||||
onDmStarted = ::onStartDM,
|
||||
onStartCall = ::onStartCall,
|
||||
openAvatarPreview = callback::openAvatarPreview,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ class RoomMemberDetailsPresenter @AssistedInject constructor(
|
|||
var userProfile by remember { mutableStateOf<MatrixUser?>(null) }
|
||||
val startDmActionState: MutableState<AsyncAction<RoomId>> = remember { mutableStateOf(AsyncAction.Uninitialized) }
|
||||
val isBlocked: MutableState<AsyncData<Boolean>> = remember { mutableStateOf(AsyncData.Uninitialized) }
|
||||
val isCurrentUser = remember { client.isMe(roomMemberId) }
|
||||
val dmRoomId by userProfilePresenterHelper.getDmRoomId()
|
||||
val canCall by userProfilePresenterHelper.getCanCall(dmRoomId)
|
||||
LaunchedEffect(Unit) {
|
||||
client.ignoredUsersFlow
|
||||
.map { ignoredUsers -> roomMemberId in ignoredUsers }
|
||||
|
|
@ -158,7 +161,9 @@ class RoomMemberDetailsPresenter @AssistedInject constructor(
|
|||
isBlocked = isBlocked.value,
|
||||
startDmActionState = startDmActionState.value,
|
||||
displayConfirmationDialog = confirmationDialog,
|
||||
isCurrentUser = client.isMe(roomMemberId),
|
||||
isCurrentUser = isCurrentUser,
|
||||
dmRoomId = dmRoomId,
|
||||
canCall = canCall,
|
||||
eventSink = ::handleEvents
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ class RoomMemberDetailsPresenterTests {
|
|||
assertThat(initialState.userName).isEqualTo(roomMember.displayName)
|
||||
assertThat(initialState.avatarUrl).isEqualTo(roomMember.avatarUrl)
|
||||
assertThat(initialState.isBlocked).isEqualTo(AsyncData.Success(roomMember.isIgnored))
|
||||
assertThat(initialState.dmRoomId).isEqualTo(A_ROOM_ID)
|
||||
assertThat(initialState.canCall).isFalse()
|
||||
skipItems(1)
|
||||
val loadedState = awaitItem()
|
||||
assertThat(loadedState.userName).isEqualTo("A custom name")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue