mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-24 19:00:26 +01:00
Improve performance of GV2 profile fetch and mentions initialization.
This commit is contained in:
committed by
Alex Hart
parent
c0db88960c
commit
12e6ebb4df
@@ -1,13 +1,9 @@
|
||||
package org.thoughtcrime.securesms.conversation.ui.mentions;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.WorkerThread;
|
||||
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.database.GroupDatabase;
|
||||
import org.thoughtcrime.securesms.database.RecipientDatabase;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
@@ -22,7 +18,7 @@ final class MentionsPickerRepository {
|
||||
private final RecipientDatabase recipientDatabase;
|
||||
private final GroupDatabase groupDatabase;
|
||||
|
||||
MentionsPickerRepository(@NonNull Context context) {
|
||||
MentionsPickerRepository() {
|
||||
recipientDatabase = SignalDatabase.recipients();
|
||||
groupDatabase = SignalDatabase.groups();
|
||||
}
|
||||
@@ -33,9 +29,7 @@ final class MentionsPickerRepository {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Stream.of(groupDatabase.getGroupMembers(recipient.requireGroupId(), GroupDatabase.MemberSet.FULL_MEMBERS_EXCLUDING_SELF))
|
||||
.map(Recipient::getId)
|
||||
.toList();
|
||||
return groupDatabase.getGroupMemberIds(recipient.requireGroupId(), GroupDatabase.MemberSet.FULL_MEMBERS_EXCLUDING_SELF);
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
|
||||
@@ -11,7 +11,6 @@ import androidx.lifecycle.ViewModelProvider;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.thoughtcrime.securesms.conversation.ui.mentions.MentionsPickerRepository.MentionQuery;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.recipients.LiveRecipient;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
@@ -112,7 +111,7 @@ public class MentionsPickerViewModel extends ViewModel {
|
||||
@Override
|
||||
public @NonNull <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
|
||||
//noinspection ConstantConditions
|
||||
return modelClass.cast(new MentionsPickerViewModel(new MentionsPickerRepository(ApplicationDependencies.getApplication())));
|
||||
return modelClass.cast(new MentionsPickerViewModel(new MentionsPickerRepository()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user