mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-23 18:30:20 +01:00
Add ContactDiscovery abstraction for doing CDS refreshes.
This commit is contained in:
@@ -9,7 +9,7 @@ import androidx.annotation.WorkerThread;
|
||||
import com.annimon.stream.Stream;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.contacts.sync.DirectoryHelper;
|
||||
import org.thoughtcrime.securesms.contacts.sync.ContactDiscovery;
|
||||
import org.thoughtcrime.securesms.database.GroupDatabase;
|
||||
import org.thoughtcrime.securesms.database.RecipientDatabase.RegisteredState;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
@@ -56,7 +56,7 @@ public class RecipientUtil {
|
||||
|
||||
if (!recipient.getServiceId().isPresent()) {
|
||||
Log.i(TAG, recipient.getId() + " is missing a UUID...");
|
||||
RegisteredState state = DirectoryHelper.refreshDirectoryFor(context, recipient, false);
|
||||
RegisteredState state = ContactDiscovery.refresh(context, recipient, false);
|
||||
|
||||
recipient = Recipient.resolved(recipient.getId());
|
||||
Log.i(TAG, "Successfully performed a UUID fetch for " + recipient.getId() + ". Registered: " + state);
|
||||
@@ -98,7 +98,7 @@ public class RecipientUtil {
|
||||
.toList();
|
||||
|
||||
if (recipientsWithoutUuids.size() > 0) {
|
||||
DirectoryHelper.refreshDirectoryFor(context, recipientsWithoutUuids, false);
|
||||
ContactDiscovery.refresh(context, recipientsWithoutUuids, false);
|
||||
|
||||
if (recipients.stream().map(Recipient::resolve).anyMatch(Recipient::isUnregistered)) {
|
||||
throw new NotFoundException("1 or more recipients are not registered!");
|
||||
|
||||
@@ -8,7 +8,7 @@ import androidx.core.util.Consumer;
|
||||
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.contacts.sync.DirectoryHelper;
|
||||
import org.thoughtcrime.securesms.contacts.sync.ContactDiscovery;
|
||||
import org.thoughtcrime.securesms.database.GroupDatabase;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.database.model.IdentityRecord;
|
||||
@@ -66,7 +66,7 @@ final class RecipientDialogRepository {
|
||||
void refreshRecipient() {
|
||||
SignalExecutors.UNBOUNDED.execute(() -> {
|
||||
try {
|
||||
DirectoryHelper.refreshDirectoryFor(context, Recipient.resolved(recipientId), false);
|
||||
ContactDiscovery.refresh(context, Recipient.resolved(recipientId), false);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, "Failed to refresh user after adding to contacts.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user