fix: hide add to group button when not subscribed

This commit is contained in:
Bnyro 2024-06-21 15:57:35 +02:00
parent bf33dcd054
commit d7abfcfe7f
2 changed files with 5 additions and 2 deletions

View File

@ -26,9 +26,10 @@ fun TextView.setupSubscriptionButton(
CoroutineScope(Dispatchers.IO).launch {
subscribed = isSubscribed ?: SubscriptionHelper.isSubscribed(channelId)
subscribed?.let { subscribed -> onIsSubscribedChange(subscribed) }
withContext(Dispatchers.Main) {
subscribed?.let { subscribed -> onIsSubscribedChange(subscribed) }
if (subscribed == true) {
this@setupSubscriptionButton.text = context.getString(R.string.unsubscribe)
} else {

View File

@ -160,7 +160,9 @@ class ChannelFragment : DynamicLayoutManagerFragment() {
channelId,
channelName,
binding.notificationBell
)
) { isSubscribed ->
_binding?.addToGroup?.isVisible = isSubscribed
}
binding.channelShare.setOnClickListener {
val bundle = bundleOf(