mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-26 03:40:56 +01:00
Fix bug causing call requests to not be handled properly.
This commit is contained in:
@@ -17,7 +17,6 @@ import org.thoughtcrime.securesms.groups.GroupChangeBusyException;
|
||||
import org.thoughtcrime.securesms.groups.GroupChangeException;
|
||||
import org.thoughtcrime.securesms.groups.GroupChangeFailedException;
|
||||
import org.thoughtcrime.securesms.groups.GroupManager;
|
||||
import org.thoughtcrime.securesms.jobs.DirectoryRefreshJob;
|
||||
import org.thoughtcrime.securesms.jobs.MultiDeviceBlockedUpdateJob;
|
||||
import org.thoughtcrime.securesms.jobs.MultiDeviceMessageRequestResponseJob;
|
||||
import org.thoughtcrime.securesms.jobs.RotateProfileKeyJob;
|
||||
@@ -201,6 +200,20 @@ public class RecipientUtil {
|
||||
return isMessageRequestAccepted(context, threadId, threadRecipient);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like {@link #isMessageRequestAccepted(Context, long)} but with fewer checks around messages so it
|
||||
* is more likely to return false.
|
||||
*/
|
||||
@WorkerThread
|
||||
public static boolean isCallRequestAccepted(@NonNull Context context, @Nullable Recipient threadRecipient) {
|
||||
if (threadRecipient == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(threadRecipient);
|
||||
return isCallRequestAccepted(context, threadId, threadRecipient);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if a conversation existed before we enabled message requests, otherwise false.
|
||||
*/
|
||||
@@ -244,6 +257,14 @@ public class RecipientUtil {
|
||||
isPreMessageRequestThread(context, threadId);
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private static boolean isCallRequestAccepted(@NonNull Context context, long threadId, @NonNull Recipient threadRecipient) {
|
||||
return threadRecipient.isProfileSharing() ||
|
||||
threadRecipient.isSystemContact() ||
|
||||
hasSentMessageInThread(context, threadId) ||
|
||||
isPreMessageRequestThread(context, threadId);
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private static boolean hasSentMessageInThread(@NonNull Context context, long threadId) {
|
||||
return DatabaseFactory.getMmsSmsDatabase(context).getOutgoingSecureConversationCount(threadId) != 0;
|
||||
|
||||
Reference in New Issue
Block a user