mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Improve group name coloring performance.
This commit is contained in:
@@ -13,7 +13,8 @@ import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
import org.whispersystems.signalservice.api.groupsv2.DecryptedGroupUtil
|
||||
import org.whispersystems.signalservice.api.push.DistributionId
|
||||
import java.lang.AssertionError
|
||||
import org.whispersystems.signalservice.api.push.ServiceId
|
||||
import org.whispersystems.signalservice.api.util.UuidUtil
|
||||
import java.util.Optional
|
||||
|
||||
class GroupRecord(
|
||||
@@ -44,6 +45,22 @@ class GroupRecord(
|
||||
}
|
||||
}
|
||||
|
||||
/** Valid for v2 groups only */
|
||||
val decryptedMemberServiceIds: List<ServiceId> by lazy {
|
||||
if (isV2Group) {
|
||||
requireV2GroupProperties()
|
||||
.decryptedGroup
|
||||
.membersList
|
||||
.asSequence()
|
||||
.map { DecryptedGroupUtil.toUuid(it) }
|
||||
.filterNot { it == UuidUtil.UNKNOWN_UUID }
|
||||
.map { ServiceId.from(it) }
|
||||
.toList()
|
||||
} else {
|
||||
emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
/** V1 members that were lost during the V1->V2 migration */
|
||||
val unmigratedV1Members: List<RecipientId> by lazy {
|
||||
if (serializedUnmigratedV1Members.isNullOrEmpty()) {
|
||||
@@ -183,4 +200,12 @@ class GroupRecord(
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun hasSameMembers(other: GroupRecord): Boolean {
|
||||
if (!isV2Group || !other.isV2Group) {
|
||||
return false
|
||||
}
|
||||
|
||||
return decryptedMemberServiceIds == other.decryptedMemberServiceIds
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user