check talk-polls capability

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-07-14 15:50:35 +02:00 committed by Andy Scherzinger (Rebase PR Action)
parent 3b4be83ea7
commit f10b76d430

View File

@ -43,6 +43,12 @@ class AttachmentDialog(val activity: Activity, var chatController: ChatControlle
setContentView(dialogAttachmentBinding.root) setContentView(dialogAttachmentBinding.root)
window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
initItemsStrings()
initItemsVisibility()
initItemsClickListeners()
}
private fun initItemsStrings() {
var serverName = CapabilitiesUtilNew.getServerName(chatController.conversationUser) var serverName = CapabilitiesUtilNew.getServerName(chatController.conversationUser)
dialogAttachmentBinding.txtAttachFileFromCloud.text = chatController.resources?.let { dialogAttachmentBinding.txtAttachFileFromCloud.text = chatController.resources?.let {
if (serverName.isNullOrEmpty()) { 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) String.format(it.getString(R.string.nc_upload_from_cloud), serverName)
} }
}
private fun initItemsVisibility() {
if (!CapabilitiesUtilNew.hasSpreedFeatureCapability( if (!CapabilitiesUtilNew.hasSpreedFeatureCapability(
chatController.conversationUser, chatController.conversationUser,
"geo-location-sharing" "geo-location-sharing"
@ -59,6 +67,12 @@ class AttachmentDialog(val activity: Activity, var chatController: ChatControlle
dialogAttachmentBinding.menuShareLocation.visibility = View.GONE dialogAttachmentBinding.menuShareLocation.visibility = View.GONE
} }
if (!CapabilitiesUtilNew.hasSpreedFeatureCapability(chatController.conversationUser, "talk-polls")) {
dialogAttachmentBinding.menuAttachPoll.visibility = View.GONE
}
}
private fun initItemsClickListeners() {
dialogAttachmentBinding.menuShareLocation.setOnClickListener { dialogAttachmentBinding.menuShareLocation.setOnClickListener {
chatController.showShareLocationScreen() chatController.showShareLocationScreen()
dismiss() dismiss()