mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-12 00:13:38 +00:00
Fix open group member count display
This commit is contained in:
parent
11bf0a06a8
commit
f599238b03
@ -50,17 +50,17 @@ class ConversationActionBarView : LinearLayout {
|
||||
mediator.attach()
|
||||
}
|
||||
|
||||
fun bind(recipient: Recipient, delegate: ConversationActionBarDelegate) {
|
||||
fun bind(delegate: ConversationActionBarDelegate, recipient: Recipient, openGroup: OpenGroup? = null) {
|
||||
this.delegate = delegate
|
||||
update(recipient)
|
||||
update(recipient, openGroup)
|
||||
}
|
||||
|
||||
fun update(recipient: Recipient) {
|
||||
fun update(recipient: Recipient, openGroup: OpenGroup? = null) {
|
||||
binding.conversationTitleView.text = when {
|
||||
recipient.isLocalNumber -> context.getString(R.string.note_to_self)
|
||||
else -> recipient.toShortString()
|
||||
}
|
||||
updateSubtitle(recipient)
|
||||
updateSubtitle(recipient, openGroup)
|
||||
}
|
||||
|
||||
fun updateSubtitle(recipient: Recipient, openGroup: OpenGroup? = null) {
|
||||
@ -88,15 +88,16 @@ class ConversationActionBarView : LinearLayout {
|
||||
)
|
||||
}
|
||||
if (recipient.isGroupRecipient) {
|
||||
val title = if (recipient.isOpenGroupRecipient) {
|
||||
val userCount = openGroup?.let { lokiApiDb.getUserCount(it.room, it.server) } ?: 0
|
||||
context.getString(R.string.ConversationActivity_active_member_count, userCount)
|
||||
} else {
|
||||
val userCount = groupDb.getGroupMemberAddresses(recipient.address.toGroupString(), true).size
|
||||
context.getString(R.string.ConversationActivity_member_count, userCount)
|
||||
}
|
||||
settings.add(
|
||||
ConversationSetting(
|
||||
openGroup?.let {
|
||||
val userCount = lokiApiDb.getUserCount(it.room, it.server) ?: 0
|
||||
context.getString(R.string.ConversationActivity_active_member_count, userCount)
|
||||
} ?: run {
|
||||
val userCount = groupDb.getGroupMemberAddresses(recipient.address.toGroupString(), true).size
|
||||
context.getString(R.string.ConversationActivity_member_count, userCount)
|
||||
},
|
||||
title,
|
||||
ConversationSettingType.MEMBER_COUNT,
|
||||
)
|
||||
)
|
||||
|
@ -456,7 +456,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
actionBar.title = ""
|
||||
actionBar.setDisplayHomeAsUpEnabled(true)
|
||||
actionBar.setHomeButtonEnabled(true)
|
||||
binding!!.toolbarContent.bind(recipient, this)
|
||||
binding!!.toolbarContent.bind(this, recipient, viewModel.openGroup)
|
||||
maybeUpdateToolbar(recipient)
|
||||
}
|
||||
|
||||
@ -647,7 +647,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
}
|
||||
|
||||
private fun maybeUpdateToolbar(recipient: Recipient) {
|
||||
binding?.toolbarContent?.update(recipient)
|
||||
binding?.toolbarContent?.update(recipient, viewModel.openGroup)
|
||||
val profilePictureView = overflowMenuItem?.actionView?.findViewById<ProfilePictureView>(R.id.profilePictureView)
|
||||
profilePictureView?.glide = glide
|
||||
MentionManagerUtilities.populateUserPublicKeyCacheIfNeeded(viewModel.threadId, this)
|
||||
|
Loading…
x
Reference in New Issue
Block a user