kopia lustrzana https://github.com/ryukoposting/Signal-Android
Add ContactDiscovery abstraction for doing CDS refreshes.
rodzic
3c2bd032ba
commit
83c3b16b92
|
@ -27,7 +27,7 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
|||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.components.ContactFilterView;
|
||||
import org.thoughtcrime.securesms.contacts.ContactsCursorLoader.DisplayMode;
|
||||
import org.thoughtcrime.securesms.contacts.sync.DirectoryHelper;
|
||||
import org.thoughtcrime.securesms.contacts.sync.ContactDiscovery;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
|
@ -153,7 +153,7 @@ public abstract class ContactSelectionActivity extends PassphraseRequiredActivit
|
|||
@Override
|
||||
protected Void doInBackground(Context... params) {
|
||||
try {
|
||||
DirectoryHelper.refreshDirectory(params[0], true);
|
||||
ContactDiscovery.refreshAll(params[0], true);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ import org.thoughtcrime.securesms.contacts.ContactsCursorLoader.DisplayMode;
|
|||
import org.thoughtcrime.securesms.contacts.HeaderAction;
|
||||
import org.thoughtcrime.securesms.contacts.LetterHeaderDecoration;
|
||||
import org.thoughtcrime.securesms.contacts.SelectedContact;
|
||||
import org.thoughtcrime.securesms.contacts.sync.DirectoryHelper;
|
||||
import org.thoughtcrime.securesms.contacts.sync.ContactDiscovery;
|
||||
import org.thoughtcrime.securesms.groups.SelectionLimits;
|
||||
import org.thoughtcrime.securesms.groups.ui.GroupLimitDialog;
|
||||
import org.thoughtcrime.securesms.mms.GlideApp;
|
||||
|
@ -576,7 +576,7 @@ public final class ContactSelectionListFragment extends LoggingFragment
|
|||
@Override
|
||||
protected Boolean doInBackground(Void... voids) {
|
||||
try {
|
||||
DirectoryHelper.refreshDirectory(context, false);
|
||||
ContactDiscovery.refreshAll(context, false);
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
|
|
|
@ -25,7 +25,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
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.conversation.ConversationIntents;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.groups.ui.creategroup.CreateGroupActivity;
|
||||
|
@ -79,7 +79,7 @@ public class NewConversationActivity extends ContactSelectionActivity
|
|||
if (!resolved.isRegistered() || !resolved.hasServiceId()) {
|
||||
Log.i(TAG, "[onContactSelected] Not registered or no UUID. Doing a directory refresh.");
|
||||
try {
|
||||
DirectoryHelper.refreshDirectoryFor(this, resolved, false);
|
||||
ContactDiscovery.refresh(this, resolved, false);
|
||||
resolved = Recipient.resolved(resolved.getId());
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, "[onContactSelected] Failed to refresh directory for new contact.");
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.signal.core.util.concurrent.SignalExecutors
|
|||
import org.signal.core.util.logging.Log
|
||||
import org.signal.storageservice.protos.groups.local.DecryptedGroup
|
||||
import org.signal.storageservice.protos.groups.local.DecryptedPendingMember
|
||||
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.MediaDatabase
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase
|
||||
|
@ -114,7 +114,7 @@ class ConversationSettingsRepository(
|
|||
fun refreshRecipient(recipientId: RecipientId) {
|
||||
SignalExecutors.UNBOUNDED.execute {
|
||||
try {
|
||||
DirectoryHelper.refreshDirectoryFor(context, Recipient.resolved(recipientId), false)
|
||||
ContactDiscovery.refresh(context, Recipient.resolved(recipientId), false)
|
||||
} catch (e: IOException) {
|
||||
Log.w(TAG, "Failed to refresh user after adding to contacts.")
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import android.os.Bundle;
|
|||
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.SignalDatabase;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
import org.thoughtcrime.securesms.jobs.DirectoryRefreshJob;
|
||||
|
@ -47,7 +47,7 @@ public class ContactsSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||
|
||||
if (!SignalStore.account().isRegistered()) {
|
||||
Log.i(TAG, "Not push registered. Just syncing contact info.");
|
||||
DirectoryHelper.syncRecipientInfoWithSystemContacts(context);
|
||||
ContactDiscovery.syncRecipientInfoWithSystemContacts(context);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class ContactsSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||
if (unknownSystemNumbers.size() > FULL_SYNC_THRESHOLD) {
|
||||
Log.i(TAG, "There are " + unknownSystemNumbers.size() + " unknown contacts. Doing a full sync.");
|
||||
try {
|
||||
DirectoryHelper.refreshDirectory(context, true);
|
||||
ContactDiscovery.refreshAll(context, true);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
|
@ -69,14 +69,14 @@ public class ContactsSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||
.map(s -> Recipient.external(getContext(), s))
|
||||
.toList();
|
||||
try {
|
||||
DirectoryHelper.refreshDirectoryFor(context, recipients, true);
|
||||
ContactDiscovery.refresh(context, recipients, true);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, "Failed to refresh! Scheduling for later.", e);
|
||||
ApplicationDependencies.getJobManager().add(new DirectoryRefreshJob(true));
|
||||
}
|
||||
} else {
|
||||
Log.i(TAG, "No new contacts. Just syncing system contact data.");
|
||||
DirectoryHelper.syncRecipientInfoWithSystemContacts(context);
|
||||
ContactDiscovery.syncRecipientInfoWithSystemContacts(context);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package org.thoughtcrime.securesms.contacts.sync
|
||||
|
||||
import android.content.Context
|
||||
import androidx.annotation.WorkerThread
|
||||
import org.thoughtcrime.securesms.database.RecipientDatabase
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import java.io.IOException
|
||||
|
||||
/**
|
||||
* Methods for discovering which users are registered and marking them as such in the database.
|
||||
*/
|
||||
object ContactDiscovery {
|
||||
|
||||
@JvmStatic
|
||||
@Throws(IOException::class)
|
||||
@WorkerThread
|
||||
fun refreshAll(context: Context, notifyOfNewUsers: Boolean) {
|
||||
DirectoryHelper.refreshAll(context, notifyOfNewUsers)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@Throws(IOException::class)
|
||||
@WorkerThread
|
||||
fun refresh(context: Context, recipients: List<Recipient>, notifyOfNewUsers: Boolean) {
|
||||
return DirectoryHelper.refresh(context, recipients, notifyOfNewUsers)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@Throws(IOException::class)
|
||||
@WorkerThread
|
||||
fun refresh(context: Context, recipient: Recipient, notifyOfNewUsers: Boolean): RecipientDatabase.RegisteredState {
|
||||
return DirectoryHelper.refresh(context, recipient, notifyOfNewUsers)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@WorkerThread
|
||||
fun syncRecipientInfoWithSystemContacts(context: Context) {
|
||||
DirectoryHelper.syncRecipientInfoWithSystemContacts(context)
|
||||
}
|
||||
}
|
|
@ -76,12 +76,12 @@ import io.reactivex.rxjava3.schedulers.Schedulers;
|
|||
/**
|
||||
* Manages all the stuff around determining if a user is registered or not.
|
||||
*/
|
||||
public class DirectoryHelper {
|
||||
class DirectoryHelper {
|
||||
|
||||
private static final String TAG = Log.tag(DirectoryHelper.class);
|
||||
|
||||
@WorkerThread
|
||||
public static void refreshDirectory(@NonNull Context context, boolean notifyOfNewUsers) throws IOException {
|
||||
static void refreshAll(@NonNull Context context, boolean notifyOfNewUsers) throws IOException {
|
||||
if (TextUtils.isEmpty(SignalStore.account().getE164())) {
|
||||
Log.w(TAG, "Have not yet set our own local number. Skipping.");
|
||||
return;
|
||||
|
@ -108,7 +108,7 @@ public class DirectoryHelper {
|
|||
}
|
||||
|
||||
@WorkerThread
|
||||
public static void refreshDirectoryFor(@NonNull Context context, @NonNull List<Recipient> recipients, boolean notifyOfNewUsers) throws IOException {
|
||||
static void refresh(@NonNull Context context, @NonNull List<Recipient> recipients, boolean notifyOfNewUsers) throws IOException {
|
||||
RecipientDatabase recipientDatabase = SignalDatabase.recipients();
|
||||
|
||||
for (Recipient recipient : recipients) {
|
||||
|
@ -130,7 +130,7 @@ public class DirectoryHelper {
|
|||
}
|
||||
|
||||
@WorkerThread
|
||||
public static RegisteredState refreshDirectoryFor(@NonNull Context context, @NonNull Recipient recipient, boolean notifyOfNewUsers) throws IOException {
|
||||
static RegisteredState refresh(@NonNull Context context, @NonNull Recipient recipient, boolean notifyOfNewUsers) throws IOException {
|
||||
Stopwatch stopwatch = new Stopwatch("single");
|
||||
RecipientDatabase recipientDatabase = SignalDatabase.recipients();
|
||||
RegisteredState originalRegisteredState = recipient.resolve().getRegistered();
|
||||
|
@ -215,7 +215,7 @@ public class DirectoryHelper {
|
|||
/**
|
||||
* Reads the system contacts and copies over any matching data (like names) int our local store.
|
||||
*/
|
||||
public static void syncRecipientInfoWithSystemContacts(@NonNull Context context) {
|
||||
static void syncRecipientInfoWithSystemContacts(@NonNull Context context) {
|
||||
syncRecipientInfoWithSystemContacts(context, Collections.emptyMap());
|
||||
}
|
||||
|
||||
|
|
|
@ -109,6 +109,7 @@ import org.thoughtcrime.securesms.R;
|
|||
import org.thoughtcrime.securesms.ShortcutLauncherActivity;
|
||||
import org.thoughtcrime.securesms.TransportOption;
|
||||
import org.thoughtcrime.securesms.components.emoji.RecentEmojiPageModel;
|
||||
import org.thoughtcrime.securesms.contacts.sync.ContactDiscovery;
|
||||
import org.thoughtcrime.securesms.util.Debouncer;
|
||||
import org.thoughtcrime.securesms.util.LifecycleDisposable;
|
||||
import org.thoughtcrime.securesms.verify.VerifyIdentityActivity;
|
||||
|
@ -128,7 +129,6 @@ import org.thoughtcrime.securesms.components.TypingStatusSender;
|
|||
import org.thoughtcrime.securesms.components.emoji.EmojiEventListener;
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiStrings;
|
||||
import org.thoughtcrime.securesms.components.emoji.MediaKeyboard;
|
||||
import org.thoughtcrime.securesms.components.emoji.RecentEmojiPageModel;
|
||||
import org.thoughtcrime.securesms.components.identity.UnverifiedBannerView;
|
||||
import org.thoughtcrime.securesms.components.location.SignalPlace;
|
||||
import org.thoughtcrime.securesms.components.mention.MentionAnnotation;
|
||||
|
@ -147,7 +147,6 @@ import org.thoughtcrime.securesms.components.voice.VoiceNotePlaybackState;
|
|||
import org.thoughtcrime.securesms.components.voice.VoiceNotePlayerView;
|
||||
import org.thoughtcrime.securesms.contacts.ContactAccessor;
|
||||
import org.thoughtcrime.securesms.contacts.ContactAccessor.ContactData;
|
||||
import org.thoughtcrime.securesms.contacts.sync.DirectoryHelper;
|
||||
import org.thoughtcrime.securesms.contactshare.Contact;
|
||||
import org.thoughtcrime.securesms.contactshare.ContactShareEditActivity;
|
||||
import org.thoughtcrime.securesms.contactshare.ContactUtil;
|
||||
|
@ -295,7 +294,6 @@ import org.thoughtcrime.securesms.util.concurrent.ListenableFuture;
|
|||
import org.thoughtcrime.securesms.util.concurrent.SettableFuture;
|
||||
import org.thoughtcrime.securesms.util.concurrent.SimpleTask;
|
||||
import org.thoughtcrime.securesms.util.views.Stub;
|
||||
import org.thoughtcrime.securesms.verify.VerifyIdentityActivity;
|
||||
import org.thoughtcrime.securesms.wallpaper.ChatWallpaper;
|
||||
import org.thoughtcrime.securesms.wallpaper.ChatWallpaperDimLevelUtil;
|
||||
import org.whispersystems.libsignal.InvalidMessageException;
|
||||
|
@ -778,7 +776,7 @@ public class ConversationParentFragment extends Fragment
|
|||
case ADD_CONTACT:
|
||||
SimpleTask.run(() -> {
|
||||
try {
|
||||
DirectoryHelper.refreshDirectoryFor(requireContext(), recipient.get(), false);
|
||||
ContactDiscovery.refresh(requireContext(), recipient.get(), false);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, "Failed to refresh user after adding to contacts.");
|
||||
}
|
||||
|
@ -1855,7 +1853,7 @@ public class ConversationParentFragment extends Fragment
|
|||
if (registeredState == RegisteredState.UNKNOWN) {
|
||||
try {
|
||||
Log.i(TAG, "Refreshing directory for user: " + recipient.getId().serialize());
|
||||
registeredState = DirectoryHelper.refreshDirectoryFor(context, recipient, false);
|
||||
registeredState = ContactDiscovery.refresh(context, recipient, false);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.thoughtcrime.securesms.ContactSelectionActivity;
|
|||
import org.thoughtcrime.securesms.ContactSelectionListFragment;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.contacts.ContactsCursorLoader;
|
||||
import org.thoughtcrime.securesms.contacts.sync.DirectoryHelper;
|
||||
import org.thoughtcrime.securesms.contacts.sync.ContactDiscovery;
|
||||
import org.thoughtcrime.securesms.database.RecipientDatabase;
|
||||
import org.thoughtcrime.securesms.groups.ui.creategroup.details.AddGroupDetailsActivity;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
|
@ -176,7 +176,7 @@ public class CreateGroupActivity extends ContactSelectionActivity {
|
|||
|
||||
for (Recipient recipient : registeredChecks) {
|
||||
try {
|
||||
DirectoryHelper.refreshDirectoryFor(this, recipient, false);
|
||||
ContactDiscovery.refresh(this, recipient, false);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, "Failed to refresh registered status for " + recipient.getId(), e);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import io.reactivex.rxjava3.core.Single
|
|||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
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.dependencies.ApplicationDependencies
|
||||
|
@ -45,7 +45,7 @@ class GroupManagementRepository @JvmOverloads constructor(private val context: C
|
|||
.toList()
|
||||
|
||||
try {
|
||||
DirectoryHelper.refreshDirectoryFor(context, recipients, false)
|
||||
ContactDiscovery.refresh(context, recipients, false)
|
||||
recipients.forEach { Recipient.live(it.id).refresh() }
|
||||
} catch (e: IOException) {
|
||||
consumer.accept(GroupAddMembersResult.Failure(GroupChangeFailureReason.NETWORK))
|
||||
|
|
|
@ -4,7 +4,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.annotation.Nullable;
|
||||
|
||||
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.jobmanager.Data;
|
||||
import org.thoughtcrime.securesms.jobmanager.Job;
|
||||
import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint;
|
||||
|
@ -71,9 +71,9 @@ public class DirectoryRefreshJob extends BaseJob {
|
|||
Log.i(TAG, "DirectoryRefreshJob.onRun()");
|
||||
|
||||
if (recipient == null) {
|
||||
DirectoryHelper.refreshDirectory(context, notifyOfNewUsers);
|
||||
ContactDiscovery.refreshAll(context, notifyOfNewUsers);
|
||||
} else {
|
||||
DirectoryHelper.refreshDirectoryFor(context, recipient, notifyOfNewUsers);
|
||||
ContactDiscovery.refresh(context, recipient, notifyOfNewUsers);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.thoughtcrime.securesms.migrations;
|
|||
import androidx.annotation.NonNull;
|
||||
|
||||
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.jobmanager.Data;
|
||||
import org.thoughtcrime.securesms.jobmanager.Job;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
|
@ -47,7 +47,7 @@ public final class DirectoryRefreshMigrationJob extends MigrationJob {
|
|||
return;
|
||||
}
|
||||
|
||||
DirectoryHelper.refreshDirectory(context, true);
|
||||
ContactDiscovery.refreshAll(context, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.thoughtcrime.securesms.migrations;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.thoughtcrime.securesms.contacts.sync.DirectoryHelper;
|
||||
import org.thoughtcrime.securesms.contacts.sync.ContactDiscovery;
|
||||
import org.thoughtcrime.securesms.jobmanager.Data;
|
||||
import org.thoughtcrime.securesms.jobmanager.Job;
|
||||
import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint;
|
||||
|
@ -37,7 +37,7 @@ public class RecipientSearchMigrationJob extends MigrationJob {
|
|||
|
||||
@Override
|
||||
void performMigration() throws Exception {
|
||||
DirectoryHelper.refreshDirectory(context, false);
|
||||
ContactDiscovery.refreshAll(context, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.signal.core.util.logging.Log;
|
|||
import org.thoughtcrime.securesms.attachments.Attachment;
|
||||
import org.thoughtcrime.securesms.attachments.AttachmentId;
|
||||
import org.thoughtcrime.securesms.attachments.DatabaseAttachment;
|
||||
import org.thoughtcrime.securesms.contacts.sync.DirectoryHelper;
|
||||
import org.thoughtcrime.securesms.contacts.sync.ContactDiscovery;
|
||||
import org.thoughtcrime.securesms.contactshare.Contact;
|
||||
import org.thoughtcrime.securesms.database.AttachmentDatabase;
|
||||
import org.thoughtcrime.securesms.database.MessageDatabase;
|
||||
|
@ -44,7 +44,6 @@ import org.thoughtcrime.securesms.database.SmsDatabase;
|
|||
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
||||
import org.thoughtcrime.securesms.database.model.MessageId;
|
||||
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
||||
import org.thoughtcrime.securesms.database.model.MmsMessageRecord;
|
||||
import org.thoughtcrime.securesms.database.model.ReactionRecord;
|
||||
import org.thoughtcrime.securesms.database.model.SmsMessageRecord;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
|
@ -85,7 +84,6 @@ import java.util.Collection;
|
|||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -505,7 +503,7 @@ public class MessageSender {
|
|||
return false;
|
||||
} else {
|
||||
try {
|
||||
RecipientDatabase.RegisteredState state = DirectoryHelper.refreshDirectoryFor(context, destination, false);
|
||||
RecipientDatabase.RegisteredState state = ContactDiscovery.refresh(context, destination, false);
|
||||
return state == RecipientDatabase.RegisteredState.REGISTERED;
|
||||
} catch (IOException e1) {
|
||||
Log.w(TAG, e1);
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.signal.core.util.concurrent.SignalExecutors;
|
|||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.WebRtcCallActivity;
|
||||
import org.thoughtcrime.securesms.contacts.sync.DirectoryHelper;
|
||||
import org.thoughtcrime.securesms.contacts.sync.ContactDiscovery;
|
||||
import org.thoughtcrime.securesms.conversation.ConversationIntents;
|
||||
import org.thoughtcrime.securesms.database.GroupDatabase;
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase;
|
||||
|
@ -242,7 +242,7 @@ public class CommunicationActions {
|
|||
|
||||
if (!recipient.isRegistered() || !recipient.hasServiceId()) {
|
||||
try {
|
||||
DirectoryHelper.refreshDirectoryFor(activity, recipient, false);
|
||||
ContactDiscovery.refresh(activity, recipient, false);
|
||||
recipient = Recipient.resolved(recipient.getId());
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, "[handlePotentialMeUrl] Failed to refresh directory for new contact.");
|
||||
|
|
|
@ -531,7 +531,12 @@ public class SignalServiceAccountManager {
|
|||
}
|
||||
}
|
||||
|
||||
public CdshV2Service.Response getRegisteredUsersWithCdshV2(Set<String> previousE164s, Set<String> newE164s, Map<ServiceId, ProfileKey> serviceIds, Optional<byte[]> token, String hexPublicKey, String hexCodeHash)
|
||||
public CdshV2Service.Response getRegisteredUsersWithCdshV2(Set<String> previousE164s,
|
||||
Set<String> newE164s,
|
||||
Map<ServiceId, ProfileKey> serviceIds,
|
||||
Optional<byte[]> token,
|
||||
String hexPublicKey,
|
||||
String hexCodeHash)
|
||||
throws IOException
|
||||
{
|
||||
CdshAuthResponse auth = pushServiceSocket.getCdshAuth();
|
||||
|
|
Ładowanie…
Reference in New Issue