mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-16 02:05:06 +08:00
Merge pull request #5141 from vector-im/feature/mna/4641-remove-room-search-menu
Issue-4641: Show search menu item only if available
This commit is contained in:
commit
cd6ba5265b
1
changelog.d/4641.misc
Normal file
1
changelog.d/4641.misc
Normal file
@ -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 isWebRTCCallOptionAvailable() = (asyncRoomSummary.invoke()?.joinedMembersCount ?: 0) <= 2
|
||||||
|
|
||||||
|
fun isSearchAvailable() = asyncRoomSummary()?.isEncrypted == false
|
||||||
|
|
||||||
// This checks directly on the active room widgets.
|
// This checks directly on the active room widgets.
|
||||||
// It can differs for a short period of time on the JitsiState as its computed async.
|
// 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()
|
fun hasActiveJitsiWidget() = activeRoomWidgets()?.any { it.type == WidgetType.Jitsi && it.isActive }.orFalse()
|
||||||
|
@ -1141,16 +1141,12 @@ class TimelineFragment @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun handleSearchAction() {
|
private fun handleSearchAction() {
|
||||||
if (session.getRoom(timelineArgs.roomId)?.isEncrypted() == false) {
|
navigator.openSearch(
|
||||||
navigator.openSearch(
|
context = requireContext(),
|
||||||
context = requireContext(),
|
roomId = timelineArgs.roomId,
|
||||||
roomId = timelineArgs.roomId,
|
roomDisplayName = timelineViewModel.getRoomSummary()?.displayName,
|
||||||
roomDisplayName = timelineViewModel.getRoomSummary()?.displayName,
|
roomAvatarUrl = timelineViewModel.getRoomSummary()?.avatarUrl
|
||||||
roomAvatarUrl = timelineViewModel.getRoomSummary()?.avatarUrl
|
)
|
||||||
)
|
|
||||||
} else {
|
|
||||||
showDialogWithMessage(getString(R.string.search_is_not_supported_in_e2e_room))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun displayDisabledIntegrationDialog() {
|
private fun displayDisabledIntegrationDialog() {
|
||||||
@ -1926,7 +1922,7 @@ class TimelineFragment @Inject constructor(
|
|||||||
timelineViewModel.handle(action)
|
timelineViewModel.handle(action)
|
||||||
}
|
}
|
||||||
is EncryptedEventContent -> {
|
is EncryptedEventContent -> {
|
||||||
timelineViewModel.handle(RoomDetailAction.TapOnFailedToDecrypt(informationData.eventId))
|
timelineViewModel.handle(RoomDetailAction.TapOnFailedToDecrypt(informationData.eventId))
|
||||||
}
|
}
|
||||||
is MessageLocationContent -> {
|
is MessageLocationContent -> {
|
||||||
handleShowLocationPreview(messageContent, informationData.senderId)
|
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
|
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. ^
|
// 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.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.menu_timeline_thread_list -> vectorPreferences.areThreadMessagesEnabled()
|
||||||
R.id.dev_tools -> vectorPreferences.developerMode()
|
R.id.dev_tools -> vectorPreferences.developerMode()
|
||||||
else -> false
|
else -> false
|
||||||
|
@ -1064,6 +1064,7 @@
|
|||||||
<string name="tab_title_search_messages">MESSAGES</string>
|
<string name="tab_title_search_messages">MESSAGES</string>
|
||||||
<string name="tab_title_search_people">PEOPLE</string>
|
<string name="tab_title_search_people">PEOPLE</string>
|
||||||
<string name="tab_title_search_files">FILES</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>
|
<string name="search_is_not_supported_in_e2e_room">Searching in encrypted rooms is not supported yet.</string>
|
||||||
|
|
||||||
<!-- Directory -->
|
<!-- Directory -->
|
||||||
|
Loading…
Reference in New Issue
Block a user