mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-25 19:29:54 +01:00
Improve cold start performance.
This commit is contained in:
@@ -216,7 +216,7 @@ public class ContactSelectionListItem extends ConstraintLayout implements Recipi
|
||||
if (!recipient.isGroup()) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
int memberCount = recipient.getParticipants().size();
|
||||
int memberCount = recipient.getParticipantIds().size();
|
||||
return getContext().getResources().getQuantityString(R.plurals.contact_selection_list_item__number_of_members, memberCount, memberCount);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ object ContactSearchItems {
|
||||
number.visible = true
|
||||
|
||||
val count = if (model.story.recipient.isGroup) {
|
||||
model.story.recipient.participants.size
|
||||
model.story.recipient.participantIds.size
|
||||
} else {
|
||||
model.story.viewerCount
|
||||
}
|
||||
@@ -227,8 +227,9 @@ object ContactSearchItems {
|
||||
protected open fun bindNumberField(model: T) {
|
||||
number.visible = getRecipient(model).isGroup
|
||||
if (getRecipient(model).isGroup) {
|
||||
number.text = getRecipient(model).participants
|
||||
number.text = getRecipient(model).participantIds
|
||||
.take(10)
|
||||
.map { id -> Recipient.resolved(id) }
|
||||
.sortedWith(IsSelfComparator()).joinToString(", ") {
|
||||
if (it.isSelf) {
|
||||
context.getString(R.string.ConversationTitleView_you)
|
||||
|
||||
@@ -84,7 +84,7 @@ open class ContactSearchPagedDataSourceRepository(
|
||||
open fun getGroupStories(): Set<ContactSearchData.Story> {
|
||||
return SignalDatabase.groups.groupsToDisplayAsStories.map {
|
||||
val recipient = Recipient.resolved(SignalDatabase.recipients.getOrInsertFromGroupId(it))
|
||||
ContactSearchData.Story(recipient, recipient.participants.size)
|
||||
ContactSearchData.Story(recipient, recipient.participantIds.size)
|
||||
}.toSet()
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ class ContactSearchViewModel(
|
||||
state.copy(
|
||||
groupStories = state.groupStories + groupStories.map {
|
||||
val recipient = Recipient.resolved(it.recipientId)
|
||||
ContactSearchData.Story(recipient, recipient.participants.size)
|
||||
ContactSearchData.Story(recipient, recipient.participantIds.size)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user