mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 08:39:22 +01:00
Display proper text when not in the active call on the local device.
This commit is contained in:
committed by
jeffrey-signal
parent
2538e48d0f
commit
9db33c3fec
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user