mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Include unregistered users in blocked sync message.
This commit is contained in:
@@ -9,6 +9,7 @@ import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.database.RecipientTable;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.database.model.RecipientRecord;
|
||||
import org.thoughtcrime.securesms.groups.GroupChangeBusyException;
|
||||
import org.thoughtcrime.securesms.groups.GroupChangeFailedException;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
@@ -19,6 +20,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class BlockedUsersRepository {
|
||||
|
||||
@@ -32,19 +34,11 @@ class BlockedUsersRepository {
|
||||
|
||||
void getBlocked(@NonNull Consumer<List<Recipient>> blockedUsers) {
|
||||
SignalExecutors.BOUNDED.execute(() -> {
|
||||
RecipientTable db = SignalDatabase.recipients();
|
||||
try (RecipientTable.RecipientReader reader = db.readerForBlocked(db.getBlocked())) {
|
||||
int count = reader.getCount();
|
||||
if (count == 0) {
|
||||
blockedUsers.accept(Collections.emptyList());
|
||||
} else {
|
||||
List<Recipient> recipients = new ArrayList<>();
|
||||
while (reader.getNext() != null) {
|
||||
recipients.add(reader.getCurrent());
|
||||
}
|
||||
blockedUsers.accept(recipients);
|
||||
}
|
||||
}
|
||||
List<RecipientRecord> records = SignalDatabase.recipients().getBlocked();
|
||||
List<Recipient> recipients = records.stream()
|
||||
.map((record) -> Recipient.resolved(record.getId()))
|
||||
.collect(Collectors.toList());
|
||||
blockedUsers.accept(recipients);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user