mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Reactively share profiles to those who should already have it.
This commit is contained in:
@@ -11,6 +11,7 @@ import com.annimon.stream.Stream;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.contacts.sync.DirectoryHelper;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.GroupDatabase;
|
||||
import org.thoughtcrime.securesms.database.RecipientDatabase.RegisteredState;
|
||||
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
|
||||
@@ -265,6 +266,25 @@ public class RecipientUtil {
|
||||
threadRecipient.isForceSmsSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if this recipient should already have your profile key, otherwise false.
|
||||
*/
|
||||
public static boolean shouldHaveProfileKey(@NonNull Context context, @NonNull Recipient recipient) {
|
||||
if (recipient.isBlocked()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (recipient.isProfileSharing()) {
|
||||
return true;
|
||||
} else {
|
||||
GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(context);
|
||||
return groupDatabase.getPushGroupsContainingMember(recipient.getId())
|
||||
.stream()
|
||||
.anyMatch(GroupDatabase.GroupRecord::isV2Group);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private static boolean isMessageRequestAccepted(@NonNull Context context, long threadId, @NonNull Recipient threadRecipient) {
|
||||
return threadRecipient.isSelf() ||
|
||||
|
||||
Reference in New Issue
Block a user