mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Revamp group name color generation.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user