From 0d4697b7e1b7e7581308df4b67b76fe552a24573 Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Thu, 21 Jul 2022 15:55:51 +0300 Subject: [PATCH] Show call icon if there is an active element call widget. --- .../app/features/home/room/detail/RoomDetailViewState.kt | 3 ++- .../vector/app/features/home/room/detail/TimelineFragment.kt | 4 ++-- .../vector/app/features/home/room/detail/TimelineViewModel.kt | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewState.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewState.kt index 7aa7d5a877..b47b46c152 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewState.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/RoomDetailViewState.kt @@ -93,7 +93,8 @@ data class RoomDetailViewState( return asyncRoomSummary.invoke()?.isDirect ?: true || // When there is only one member, a warning will be displayed when the user // clicks on the menu item to start a call - asyncRoomSummary.invoke()?.joinedMembersCount == 1 + asyncRoomSummary.invoke()?.joinedMembersCount == 1 || + hasActiveElementCallWidget() } fun isSearchAvailable() = asyncRoomSummary()?.isEncrypted == false diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt index 1d77e4c83a..27ba12e4d7 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt @@ -1088,8 +1088,8 @@ class TimelineFragment @Inject constructor( val hasCallInRoom = callManager.getCallsByRoomId(state.roomId).isNotEmpty() || state.jitsiState.hasJoined val callButtonsEnabled = !hasCallInRoom && when (state.asyncRoomSummary.invoke()?.joinedMembersCount) { 1 -> false - 2 -> state.isAllowedToStartWebRTCCall - else -> state.isAllowedToManageWidgets + 2 -> state.isAllowedToStartWebRTCCall || state.hasActiveElementCallWidget() + else -> state.isAllowedToManageWidgets || state.hasActiveElementCallWidget() } setOf(R.id.voice_call, R.id.video_call).forEach { menu.findItem(it).icon?.alpha = if (callButtonsEnabled) 0xFF else 0x40 diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt index e3ea8a0826..71b6b22aed 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineViewModel.kt @@ -752,7 +752,7 @@ class TimelineViewModel @AssistedInject constructor( R.id.timeline_setting -> true R.id.invite -> state.canInvite 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 // 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