Updated group naming

This commit is contained in:
SessionHero01 2024-10-30 15:04:56 +11:00
parent 2e1f9a3931
commit 1161bac76c
No known key found for this signature in database
2 changed files with 11 additions and 4 deletions

View File

@ -58,14 +58,14 @@ class ProfilePictureView @JvmOverloads constructor(
fun update( fun update(
address: Address, address: Address,
isLegacyClosedGroupRecipient: Boolean = false, isLegacyGroupRecipient: Boolean = false,
isOpenGroupInboxRecipient: Boolean = false isCommunityInboxRecipient: Boolean = false
) { ) {
fun getUserDisplayName(publicKey: String): String = prefs.takeIf { userPublicKey == publicKey }?.getProfileName() fun getUserDisplayName(publicKey: String): String = prefs.takeIf { userPublicKey == publicKey }?.getProfileName()
?: DatabaseComponent.get(context).sessionContactDatabase().getContactWithAccountID(publicKey)?.displayName(Contact.ContactContext.REGULAR) ?: DatabaseComponent.get(context).sessionContactDatabase().getContactWithAccountID(publicKey)?.displayName(Contact.ContactContext.REGULAR)
?: publicKey ?: publicKey
if (isLegacyClosedGroupRecipient) { if (isLegacyGroupRecipient) {
val members = DatabaseComponent.get(context).groupDatabase() val members = DatabaseComponent.get(context).groupDatabase()
.getGroupMemberAddresses(address.toGroupString(), true) .getGroupMemberAddresses(address.toGroupString(), true)
.sorted() .sorted()
@ -83,7 +83,7 @@ class ProfilePictureView @JvmOverloads constructor(
additionalPublicKey = apk additionalPublicKey = apk
additionalDisplayName = getUserDisplayName(apk) additionalDisplayName = getUserDisplayName(apk)
} }
} else if(isOpenGroupInboxRecipient) { } else if(isCommunityInboxRecipient) {
val publicKey = GroupUtil.getDecodedOpenGroupInboxAccountId(address.serialize()) val publicKey = GroupUtil.getDecodedOpenGroupInboxAccountId(address.serialize())
this.publicKey = publicKey this.publicKey = publicKey
displayName = getUserDisplayName(publicKey) displayName = getUserDisplayName(publicKey)

View File

@ -32,6 +32,13 @@ import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
/**
* @deprecated This database table management is only used for
* legacy group management. It is not used in groupv2. For group v2 data, you generally need
* to query config system directly. The Storage class may also be more up-to-date.
*
*/
@Deprecated
public class GroupDatabase extends Database implements LokiOpenGroupDatabaseProtocol { public class GroupDatabase extends Database implements LokiOpenGroupDatabaseProtocol {
@SuppressWarnings("unused") @SuppressWarnings("unused")