From cb79f75ac1e7a0760361a3a77fab7429de48d4af Mon Sep 17 00:00:00 2001 From: Cody Henthorne Date: Thu, 8 Jul 2021 16:13:51 -0400 Subject: [PATCH] Fix bug when calling non-Signal contacts from Settings. Fixes #11450 --- .../securesms/util/CommunicationActions.java | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/CommunicationActions.java b/app/src/main/java/org/thoughtcrime/securesms/util/CommunicationActions.java index 3d14f34ab..f57ad4b6a 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/CommunicationActions.java +++ b/app/src/main/java/org/thoughtcrime/securesms/util/CommunicationActions.java @@ -51,21 +51,25 @@ public class CommunicationActions { return; } - ApplicationDependencies.getSignalCallManager().isCallActive(new ResultReceiver(new Handler(Looper.getMainLooper())) { - @Override - protected void onReceiveResult(int resultCode, Bundle resultData) { - if (resultCode == 1) { - startCallInternal(activity, recipient, false); - } else { - new AlertDialog.Builder(activity) - .setMessage(R.string.CommunicationActions_start_voice_call) - .setPositiveButton(R.string.CommunicationActions_call, (d, w) -> startCallInternal(activity, recipient, false)) - .setNegativeButton(R.string.CommunicationActions_cancel, (d, w) -> d.dismiss()) - .setCancelable(true) - .show(); + if (recipient.isRegistered()) { + ApplicationDependencies.getSignalCallManager().isCallActive(new ResultReceiver(new Handler(Looper.getMainLooper())) { + @Override + protected void onReceiveResult(int resultCode, Bundle resultData) { + if (resultCode == 1) { + startCallInternal(activity, recipient, false); + } else { + new AlertDialog.Builder(activity) + .setMessage(R.string.CommunicationActions_start_voice_call) + .setPositiveButton(R.string.CommunicationActions_call, (d, w) -> startCallInternal(activity, recipient, false)) + .setNegativeButton(R.string.CommunicationActions_cancel, (d, w) -> d.dismiss()) + .setCancelable(true) + .show(); + } } - } - }); + }); + } else { + startInsecureCall(activity, recipient); + } } public static void startVideoCall(@NonNull FragmentActivity activity, @NonNull Recipient recipient) {