fix: standardise call menu recipient function to share with the new action bar to center better. issue with closed group creation on multi device potentially

This commit is contained in:
0x330a 2023-01-16 16:54:16 +11:00
parent dd51c9ab41
commit ba87cbc070
No known key found for this signature in database
GPG Key ID: 267811D6E6A2698C
5 changed files with 17 additions and 4 deletions

View File

@ -100,6 +100,15 @@ class ConversationActionBarView : LinearLayout {
else -> recipient.toShortString()
}
updateSubtitle(recipient, openGroup, config)
val marginEnd = if (recipient.showCallMenu()) {
0
} else {
binding.profilePictureView.root.width
}
val lp = binding.conversationTitleContainer.layoutParams as MarginLayoutParams
lp.marginEnd = marginEnd
binding.conversationTitleContainer.layoutParams = lp
}
fun updateSubtitle(recipient: Recipient, openGroup: OpenGroup? = null, config: ExpirationConfiguration? = null) {

View File

@ -18,7 +18,6 @@ import androidx.core.content.pm.ShortcutInfoCompat
import androidx.core.content.pm.ShortcutManagerCompat
import androidx.core.graphics.drawable.IconCompat
import network.loki.messenger.R
import org.session.libsession.messaging.messages.ExpirationConfiguration
import org.session.libsession.messaging.sending_receiving.MessageSender
import org.session.libsession.messaging.sending_receiving.leave
import org.session.libsession.utilities.GroupUtil.doubleDecodeGroupID
@ -85,7 +84,7 @@ object ConversationMenuHelper {
inflater.inflate(R.menu.menu_conversation_notification_settings, menu)
}
if (!thread.isGroupRecipient && thread.hasApprovedMe()) {
if (thread.showCallMenu()) {
inflater.inflate(R.menu.menu_conversation_call, menu)
}

View File

@ -13,6 +13,7 @@
android:layout_height="@dimen/medium_profile_picture_size" />
<LinearLayout
android:id="@+id/conversationTitleContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal|center_vertical"

View File

@ -173,7 +173,7 @@ private fun handleConfigurationMessage(message: ConfigurationMessage) {
if (allClosedGroupPublicKeys.contains(closedGroup.publicKey)) {
// just handle the closed group encryption key pairs to avoid sync'd devices getting out of sync
storage.addClosedGroupEncryptionKeyPair(closedGroup.encryptionKeyPair!!, closedGroup.publicKey)
} else if (firstTimeSync) {
} else {
// only handle new closed group if it's first time sync
handleNewClosedGroup(message.sender!!, message.sentTimestamp!!, closedGroup.publicKey, closedGroup.name,
closedGroup.encryptionKeyPair!!, closedGroup.members, closedGroup.admins, message.sentTimestamp!!, closedGroup.expirationTimer)
@ -502,7 +502,7 @@ private fun MessageReceiver.handleClosedGroupControlMessage(message: ClosedGroup
private fun MessageReceiver.handleNewClosedGroup(message: ClosedGroupControlMessage) {
val kind = message.kind!! as? ClosedGroupControlMessage.Kind.New ?: return
val recipient = Recipient.from(MessagingModuleConfiguration.shared.context, Address.fromSerialized(message.sender!!), false)
if (!recipient.isApproved) return
if (!recipient.isApproved && !recipient.isLocalNumber) return
val groupPublicKey = kind.publicKey.toByteArray().toHexString()
val members = kind.members.map { it.toByteArray().toHexString() }
val admins = kind.admins.map { it.toByteArray().toHexString() }

View File

@ -750,6 +750,10 @@ public class Recipient implements RecipientModifiedListener {
return this;
}
public synchronized boolean showCallMenu() {
return !isGroupRecipient() && hasApprovedMe();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;