mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 09:20:19 +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
@@ -56,9 +56,13 @@ import org.thoughtcrime.securesms.util.ProjectionList;
|
||||
import org.thoughtcrime.securesms.util.SpanUtil;
|
||||
import org.thoughtcrime.securesms.util.ThemeUtil;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.CommunicationActions;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.livedata.LiveDataUtil;
|
||||
import org.thoughtcrime.securesms.verify.VerifyIdentityActivity;
|
||||
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import org.signal.core.models.ServiceId;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -107,6 +111,8 @@ public final class ConversationUpdateItem extends FrameLayout
|
||||
|
||||
private final PassthroughClickListener passthroughClickListener = new PassthroughClickListener();
|
||||
|
||||
private Disposable activeCallDisposable = Disposable.disposed();
|
||||
|
||||
public ConversationUpdateItem(Context context) {
|
||||
super(context);
|
||||
}
|
||||
@@ -234,6 +240,7 @@ public final class ConversationUpdateItem extends FrameLayout
|
||||
public void unbind() {
|
||||
this.displayBodyWithTimer.removeObserver(updateObserver);
|
||||
handler.removeCallbacks(timerUpdateRunnable);
|
||||
activeCallDisposable.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -487,6 +494,8 @@ public final class ConversationUpdateItem extends FrameLayout
|
||||
}
|
||||
});
|
||||
} else if (conversationMessage.getMessageRecord().isGroupCall()) {
|
||||
activeCallDisposable.dispose();
|
||||
|
||||
GroupCallUpdateDetails groupCallUpdateDetails = GroupCallUpdateDetailsUtil.parse(conversationMessage.getMessageRecord().getBody());
|
||||
boolean isRingingOnLocalDevice = groupCallUpdateDetails.isRingingOnLocalDevice;
|
||||
boolean endedRecently = GroupCallUpdateDetailsUtil.checkCallEndedRecently(groupCallUpdateDetails);
|
||||
@@ -495,9 +504,7 @@ public final class ConversationUpdateItem extends FrameLayout
|
||||
|
||||
int text = 0;
|
||||
if (Util.hasItems(serviceIds) || isRingingOnLocalDevice) {
|
||||
if (serviceIds.contains(SignalStore.account().requireAci())) {
|
||||
text = R.string.ConversationUpdateItem_return_to_call;
|
||||
} else if (GroupCallUpdateDetailsUtil.parse(conversationMessage.getMessageRecord().getBody()).isCallFull) {
|
||||
if (GroupCallUpdateDetailsUtil.parse(conversationMessage.getMessageRecord().getBody()).isCallFull) {
|
||||
text = R.string.ConversationUpdateItem_call_is_full;
|
||||
} else {
|
||||
text = R.string.ConversationUpdateItem_join_call;
|
||||
@@ -516,6 +523,16 @@ public final class ConversationUpdateItem extends FrameLayout
|
||||
passthroughClickListener.onClick(v);
|
||||
}
|
||||
});
|
||||
|
||||
if (text == R.string.ConversationUpdateItem_join_call) {
|
||||
activeCallDisposable = CommunicationActions.isDeviceInCallWithRecipient(conversationRecipient.getId())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(isInCall -> {
|
||||
if (isInCall) {
|
||||
actionButton.setText(R.string.ConversationUpdateItem_return_to_call);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
actionButton.setVisibility(GONE);
|
||||
actionButton.setOnClickListener(null);
|
||||
|
||||
Reference in New Issue
Block a user