Better way to get direct state of the room (using view state)

This commit is contained in:
Benoit Marty 2020-09-30 12:26:25 +02:00
parent 1986de36a6
commit 42a3a64b0d
2 changed files with 16 additions and 10 deletions

View file

@ -704,11 +704,13 @@ class RoomDetailFragment @Inject constructor(
// safeStartCall(it, isVideoCall)
// }
} else if (!state.isAllowedToStartWebRTCCall) {
if (session.getRoom(state.roomId)?.roomSummary()?.isDirect == true) {
showDialogWithMessage(getString(R.string.no_permissions_to_start_webrtc_call_in_direct_room))
} else {
showDialogWithMessage(getString(R.string.no_permissions_to_start_webrtc_call))
}
showDialogWithMessage(getString(
if (state.isDm()) {
R.string.no_permissions_to_start_webrtc_call_in_direct_room
} else {
R.string.no_permissions_to_start_webrtc_call
})
)
} else {
safeStartCall(isVideoCall)
}
@ -718,11 +720,13 @@ class RoomDetailFragment @Inject constructor(
// can you add widgets??
if (!state.isAllowedToManageWidgets) {
// You do not have permission to start a conference call in this room
if (session.getRoom(state.roomId)?.roomSummary()?.isDirect == true) {
showDialogWithMessage(getString(R.string.no_permissions_to_start_conf_call_in_direct_room))
} else {
showDialogWithMessage(getString(R.string.no_permissions_to_start_conf_call))
}
showDialogWithMessage(getString(
if (state.isDm()) {
R.string.no_permissions_to_start_conf_call_in_direct_room
} else {
R.string.no_permissions_to_start_conf_call
}
))
} else {
if (state.activeRoomWidgets()?.filter { it.type == WidgetType.Jitsi }?.any() == true) {
// A conference is already in progress!

View file

@ -77,4 +77,6 @@ data class RoomDetailViewState(
// Also highlight the target event, if any
highlightedEventId = args.eventId
)
fun isDm() = asyncRoomSummary()?.isDirect == true
}