From 4482ac728c176bb321b795fc509b9879b86d6001 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Wed, 2 Oct 2024 14:01:35 +0200 Subject: [PATCH 1/2] fix availability of search feature. Hide search feature if room is federated. Also, for conversation list the check for federation inside isUnifiedSearchAvailable makes no sense. Signed-off-by: Marcel Hibbe --- app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt | 4 +++- .../main/java/com/nextcloud/talk/utils/CapabilitiesUtil.kt | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt index 503bd9c5c..d7e55fa7f 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -2810,7 +2810,9 @@ class ChatActivity : } val searchItem = menu.findItem(R.id.conversation_search) - searchItem.isVisible = CapabilitiesUtil.isUnifiedSearchAvailable(spreedCapabilities) + + searchItem.isVisible = CapabilitiesUtil.isUnifiedSearchAvailable(spreedCapabilities) && + currentConversation!!.remoteServer.isNullOrEmpty() if (currentConversation!!.remoteServer != null || !CapabilitiesUtil.isSharedItemsAvailable(spreedCapabilities) diff --git a/app/src/main/java/com/nextcloud/talk/utils/CapabilitiesUtil.kt b/app/src/main/java/com/nextcloud/talk/utils/CapabilitiesUtil.kt index 7329b085a..0a02bd914 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/CapabilitiesUtil.kt +++ b/app/src/main/java/com/nextcloud/talk/utils/CapabilitiesUtil.kt @@ -161,9 +161,6 @@ object CapabilitiesUtil { } fun isUnifiedSearchAvailable(spreedCapabilities: SpreedCapability): Boolean { - if (!hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.FEDERATION_V1)) { - return false - } return hasSpreedFeatureCapability(spreedCapabilities, SpreedFeatures.UNIFIED_SEARCH) } From 87d03a359bc3089bf5e67c6a1044d26137ff98cc Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Wed, 2 Oct 2024 14:03:11 +0200 Subject: [PATCH 2/2] center search results in chat Signed-off-by: Marcel Hibbe --- app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt index d7e55fa7f..e193c5b50 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -2059,7 +2059,7 @@ class ChatActivity : private fun onMessageSearchResult(intent: Intent?) { val messageId = intent?.getStringExtra(MessageSearchActivity.RESULT_KEY_MESSAGE_ID) messageId?.let { id -> - scrollToMessageWithId(id) + scrollToAndCenterMessageWithId(id) } }