Display proper text when not in the active call on the local device.

This commit is contained in:
Alex Hart
2025-12-18 15:43:14 -04:00
committed by jeffrey-signal
parent 2538e48d0f
commit 9db33c3fec
2 changed files with 43 additions and 3 deletions

View File

@@ -47,12 +47,15 @@ import org.thoughtcrime.securesms.profiles.manage.UsernameRepository;
import org.thoughtcrime.securesms.profiles.manage.UsernameRepository.UsernameLinkConversionResult;
import org.thoughtcrime.securesms.proxy.ProxyBottomSheetFragment;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientId;
import org.thoughtcrime.securesms.service.webrtc.ActiveCallData;
import org.thoughtcrime.securesms.service.webrtc.links.CallLinkRoomId;
import org.thoughtcrime.securesms.sms.MessageSender;
import org.thoughtcrime.securesms.util.views.SimpleProgressDialog;
import org.whispersystems.signalservice.api.push.UsernameLinkComponents;
import io.reactivex.rxjava3.core.Single;
import java.io.IOException;
import java.net.URI;
import java.util.Objects;
@@ -574,6 +577,26 @@ public class CommunicationActions {
}
}
/**
* Returns a Single that emits true if this device is currently in an active call with the given recipient,
* false otherwise.
*/
public static @NonNull Single<Boolean> isDeviceInCallWithRecipient(@NonNull RecipientId recipientId) {
return Single.create(emitter -> {
AppDependencies.getSignalCallManager().isCallActive(new ResultReceiver(new Handler(Looper.getMainLooper())) {
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
if (resultCode == 1 && resultData != null) {
ActiveCallData activeCallData = ActiveCallData.fromBundle(resultData);
emitter.onSuccess(Objects.equals(activeCallData.getRecipientId(), recipientId));
} else {
emitter.onSuccess(false);
}
}
});
});
}
public interface OnUserAlreadyInAnotherCall {
void onUserAlreadyInAnotherCall();
}