Revamp group name color generation.

This commit is contained in:
Cody Henthorne
2023-07-27 16:07:38 -04:00
committed by GitHub
parent 938309d125
commit 39f96bb12c
15 changed files with 86 additions and 105 deletions

View File

@@ -1294,6 +1294,17 @@ class GroupTable(context: Context?, databaseHelper: SignalDatabase?) : DatabaseT
return recipients
}
fun getMemberServiceIds(): List<ServiceId> {
return decryptedGroup
.membersList
.asSequence()
.map { UuidUtil.fromByteStringOrNull(it.uuid) }
.filterNotNull()
.map { ServiceId.from(it) }
.sortedBy { it.toString() }
.toList()
}
}
@Throws(BadGroupIdException::class)

View File

@@ -1859,7 +1859,8 @@ class ThreadTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTa
null,
false,
group.isActive,
null
null,
Optional.of(group)
)
Recipient(recipientId, details, false)
} ?: Recipient.live(recipientId).get()

View File

@@ -13,8 +13,6 @@ 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 org.whispersystems.signalservice.api.push.ServiceId
import org.whispersystems.signalservice.api.util.UuidUtil
import java.util.Optional
class GroupRecord(
@@ -45,22 +43,6 @@ 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()) {
@@ -200,12 +182,4 @@ class GroupRecord(
}
return false
}
fun hasSameMembers(other: GroupRecord): Boolean {
if (!isV2Group || !other.isV2Group) {
return false
}
return decryptedMemberServiceIds == other.decryptedMemberServiceIds
}
}