Issue-4641: Show search menu item only if available
This commit is contained in:
parent
3e212655eb
commit
8e0f7ca373
|
@ -0,0 +1 @@
|
|||
Remove Search from room options if not available
|
|
@ -85,6 +85,8 @@ data class RoomDetailViewState(
|
|||
|
||||
fun isWebRTCCallOptionAvailable() = (asyncRoomSummary.invoke()?.joinedMembersCount ?: 0) <= 2
|
||||
|
||||
fun isSearchAvailable() = asyncRoomSummary()?.isEncrypted == false
|
||||
|
||||
// This checks directly on the active room widgets.
|
||||
// It can differs for a short period of time on the JitsiState as its computed async.
|
||||
fun hasActiveJitsiWidget() = activeRoomWidgets()?.any { it.type == WidgetType.Jitsi && it.isActive }.orFalse()
|
||||
|
|
|
@ -1141,16 +1141,12 @@ class TimelineFragment @Inject constructor(
|
|||
}
|
||||
|
||||
private fun handleSearchAction() {
|
||||
if (session.getRoom(timelineArgs.roomId)?.isEncrypted() == false) {
|
||||
navigator.openSearch(
|
||||
context = requireContext(),
|
||||
roomId = timelineArgs.roomId,
|
||||
roomDisplayName = timelineViewModel.getRoomSummary()?.displayName,
|
||||
roomAvatarUrl = timelineViewModel.getRoomSummary()?.avatarUrl
|
||||
)
|
||||
} else {
|
||||
showDialogWithMessage(getString(R.string.search_is_not_supported_in_e2e_room))
|
||||
}
|
||||
navigator.openSearch(
|
||||
context = requireContext(),
|
||||
roomId = timelineArgs.roomId,
|
||||
roomDisplayName = timelineViewModel.getRoomSummary()?.displayName,
|
||||
roomAvatarUrl = timelineViewModel.getRoomSummary()?.avatarUrl
|
||||
)
|
||||
}
|
||||
|
||||
private fun displayDisabledIntegrationDialog() {
|
||||
|
@ -1926,7 +1922,7 @@ class TimelineFragment @Inject constructor(
|
|||
timelineViewModel.handle(action)
|
||||
}
|
||||
is EncryptedEventContent -> {
|
||||
timelineViewModel.handle(RoomDetailAction.TapOnFailedToDecrypt(informationData.eventId))
|
||||
timelineViewModel.handle(RoomDetailAction.TapOnFailedToDecrypt(informationData.eventId))
|
||||
}
|
||||
is MessageLocationContent -> {
|
||||
handleShowLocationPreview(messageContent, informationData.senderId)
|
||||
|
|
|
@ -720,7 +720,7 @@ class TimelineViewModel @AssistedInject constructor(
|
|||
R.id.video_call -> state.isWebRTCCallOptionAvailable() || 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.isWebRTCCallOptionAvailable() && state.jitsiState.confId != null && !state.jitsiState.hasJoined
|
||||
R.id.search -> true
|
||||
R.id.search -> state.isSearchAvailable()
|
||||
R.id.menu_timeline_thread_list -> vectorPreferences.areThreadMessagesEnabled()
|
||||
R.id.dev_tools -> vectorPreferences.developerMode()
|
||||
else -> false
|
||||
|
|
|
@ -1064,6 +1064,7 @@
|
|||
<string name="tab_title_search_messages">MESSAGES</string>
|
||||
<string name="tab_title_search_people">PEOPLE</string>
|
||||
<string name="tab_title_search_files">FILES</string>
|
||||
<!-- TODO TO BE REMOVED -->
|
||||
<string name="search_is_not_supported_in_e2e_room">Searching in encrypted rooms is not supported yet.</string>
|
||||
|
||||
<!-- Directory -->
|
||||
|
|
Loading…
Reference in New Issue