hide archivedFilterChip when capability is not available

Otherwise it would be shown for older NC versions without to be useful

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2024-11-08 14:46:56 +01:00
parent 6092523146
commit 2a2f8a8148
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B

View file

@ -22,6 +22,8 @@ import com.nextcloud.talk.conversationlist.ConversationsListActivity
import com.nextcloud.talk.databinding.DialogFilterConversationBinding import com.nextcloud.talk.databinding.DialogFilterConversationBinding
import com.nextcloud.talk.ui.theme.ViewThemeUtils import com.nextcloud.talk.ui.theme.ViewThemeUtils
import com.nextcloud.talk.users.UserManager import com.nextcloud.talk.users.UserManager
import com.nextcloud.talk.utils.CapabilitiesUtil.hasSpreedFeatureCapability
import com.nextcloud.talk.utils.SpreedFeatures
import com.nextcloud.talk.utils.UserIdUtils import com.nextcloud.talk.utils.UserIdUtils
import javax.inject.Inject import javax.inject.Inject
@ -104,7 +106,14 @@ class FilterConversationFragment : DialogFragment() {
private fun setUpChips() { private fun setUpChips() {
binding.unreadFilterChip.isChecked = filterState[UNREAD]!! binding.unreadFilterChip.isChecked = filterState[UNREAD]!!
binding.mentionedFilterChip.isChecked = filterState[MENTION]!! binding.mentionedFilterChip.isChecked = filterState[MENTION]!!
binding.archivedFilterChip.isChecked = filterState[ARCHIVE]!!
binding.archivedFilterChip.visibility = View.GONE
userManager.currentUser.blockingGet().capabilities?.spreedCapability?.let {
if (hasSpreedFeatureCapability(it, SpreedFeatures.ARCHIVE_CONVERSATIONS)) {
binding.archivedFilterChip.visibility = View.VISIBLE
binding.archivedFilterChip.isChecked = filterState[ARCHIVE]!!
}
}
} }
private fun processSubmit() { private fun processSubmit() {