From f10b76d430d926f51a5afc6c1fae20ca6e738403 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Thu, 14 Jul 2022 15:50:35 +0200 Subject: [PATCH] check talk-polls capability Signed-off-by: Marcel Hibbe --- .../nextcloud/talk/ui/dialog/AttachmentDialog.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/AttachmentDialog.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/AttachmentDialog.kt index 2da8b2d76..13a0564fb 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/AttachmentDialog.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/AttachmentDialog.kt @@ -43,6 +43,12 @@ class AttachmentDialog(val activity: Activity, var chatController: ChatControlle setContentView(dialogAttachmentBinding.root) window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) + initItemsStrings() + initItemsVisibility() + initItemsClickListeners() + } + + private fun initItemsStrings() { var serverName = CapabilitiesUtilNew.getServerName(chatController.conversationUser) dialogAttachmentBinding.txtAttachFileFromCloud.text = chatController.resources?.let { if (serverName.isNullOrEmpty()) { @@ -50,7 +56,9 @@ class AttachmentDialog(val activity: Activity, var chatController: ChatControlle } String.format(it.getString(R.string.nc_upload_from_cloud), serverName) } + } + private fun initItemsVisibility() { if (!CapabilitiesUtilNew.hasSpreedFeatureCapability( chatController.conversationUser, "geo-location-sharing" @@ -59,6 +67,12 @@ class AttachmentDialog(val activity: Activity, var chatController: ChatControlle dialogAttachmentBinding.menuShareLocation.visibility = View.GONE } + if (!CapabilitiesUtilNew.hasSpreedFeatureCapability(chatController.conversationUser, "talk-polls")) { + dialogAttachmentBinding.menuAttachPoll.visibility = View.GONE + } + } + + private fun initItemsClickListeners() { dialogAttachmentBinding.menuShareLocation.setOnClickListener { chatController.showShareLocationScreen() dismiss()