Show call icon if there is an active element call widget.

This commit is contained in:
Onuray Sahin 2022-07-21 15:55:51 +03:00
parent 7dfe5264cd
commit 0d4697b7e1
3 changed files with 5 additions and 4 deletions

View File

@ -93,7 +93,8 @@ data class RoomDetailViewState(
return asyncRoomSummary.invoke()?.isDirect ?: true || return asyncRoomSummary.invoke()?.isDirect ?: true ||
// When there is only one member, a warning will be displayed when the user // When there is only one member, a warning will be displayed when the user
// clicks on the menu item to start a call // clicks on the menu item to start a call
asyncRoomSummary.invoke()?.joinedMembersCount == 1 asyncRoomSummary.invoke()?.joinedMembersCount == 1 ||
hasActiveElementCallWidget()
} }
fun isSearchAvailable() = asyncRoomSummary()?.isEncrypted == false fun isSearchAvailable() = asyncRoomSummary()?.isEncrypted == false

View File

@ -1088,8 +1088,8 @@ class TimelineFragment @Inject constructor(
val hasCallInRoom = callManager.getCallsByRoomId(state.roomId).isNotEmpty() || state.jitsiState.hasJoined val hasCallInRoom = callManager.getCallsByRoomId(state.roomId).isNotEmpty() || state.jitsiState.hasJoined
val callButtonsEnabled = !hasCallInRoom && when (state.asyncRoomSummary.invoke()?.joinedMembersCount) { val callButtonsEnabled = !hasCallInRoom && when (state.asyncRoomSummary.invoke()?.joinedMembersCount) {
1 -> false 1 -> false
2 -> state.isAllowedToStartWebRTCCall 2 -> state.isAllowedToStartWebRTCCall || state.hasActiveElementCallWidget()
else -> state.isAllowedToManageWidgets else -> state.isAllowedToManageWidgets || state.hasActiveElementCallWidget()
} }
setOf(R.id.voice_call, R.id.video_call).forEach { setOf(R.id.voice_call, R.id.video_call).forEach {
menu.findItem(it).icon?.alpha = if (callButtonsEnabled) 0xFF else 0x40 menu.findItem(it).icon?.alpha = if (callButtonsEnabled) 0xFF else 0x40

View File

@ -752,7 +752,7 @@ class TimelineViewModel @AssistedInject constructor(
R.id.timeline_setting -> true R.id.timeline_setting -> true
R.id.invite -> state.canInvite R.id.invite -> state.canInvite
R.id.open_matrix_apps -> true R.id.open_matrix_apps -> true
R.id.voice_call -> state.isCallOptionAvailable() R.id.voice_call -> state.isCallOptionAvailable() || state.hasActiveElementCallWidget()
R.id.video_call -> state.isCallOptionAvailable() || state.jitsiState.confId == null || state.jitsiState.hasJoined R.id.video_call -> state.isCallOptionAvailable() || state.jitsiState.confId == null || state.jitsiState.hasJoined
// Show Join conference button only if there is an active conf id not joined. Otherwise fallback to default video disabled. ^ // Show Join conference button only if there is an active conf id not joined. Otherwise fallback to default video disabled. ^
R.id.join_conference -> !state.isCallOptionAvailable() && state.jitsiState.confId != null && !state.jitsiState.hasJoined R.id.join_conference -> !state.isCallOptionAvailable() && state.jitsiState.confId != null && !state.jitsiState.hasJoined