mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 18:00:02 +01:00
Better error handling for group calls.
This commit is contained in:
committed by
Alan Evans
parent
84f1da76ad
commit
cf32b93269
@@ -96,6 +96,7 @@ public class WebRtcCallView extends FrameLayout {
|
||||
private TextView participantCount;
|
||||
private Stub<FrameLayout> groupCallSpeakerHint;
|
||||
private Stub<View> groupCallFullStub;
|
||||
private View errorButton;
|
||||
private int pagerBottomMarginDp;
|
||||
private boolean controlsVisible = true;
|
||||
|
||||
@@ -151,6 +152,7 @@ public class WebRtcCallView extends FrameLayout {
|
||||
callParticipantsRecycler = findViewById(R.id.call_screen_participants_recycler);
|
||||
toolbar = findViewById(R.id.call_screen_toolbar);
|
||||
startCall = findViewById(R.id.call_screen_start_call_start_call);
|
||||
errorButton = findViewById(R.id.call_screen_error_cancel);
|
||||
groupCallSpeakerHint = new Stub<>(findViewById(R.id.call_screen_group_call_speaker_hint));
|
||||
groupCallFullStub = new Stub<>(findViewById(R.id.group_call_call_full_view));
|
||||
|
||||
@@ -227,6 +229,12 @@ public class WebRtcCallView extends FrameLayout {
|
||||
|
||||
int statusBarHeight = ViewUtil.getStatusBarHeight(this);
|
||||
statusBarGuideline.setGuidelineBegin(statusBarHeight);
|
||||
|
||||
errorButton.setOnClickListener(v -> {
|
||||
if (controlsListener != null) {
|
||||
controlsListener.onCancelStartCall();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -426,6 +434,11 @@ public class WebRtcCallView extends FrameLayout {
|
||||
startCall.setEnabled(webRtcControls.isStartCallEnabled());
|
||||
}
|
||||
|
||||
if (webRtcControls.displayErrorControls()) {
|
||||
visibleViewSet.add(footerGradient);
|
||||
visibleViewSet.add(errorButton);
|
||||
}
|
||||
|
||||
if (webRtcControls.displayGroupCallFull()) {
|
||||
groupCallFullStub.get().setVisibility(View.VISIBLE);
|
||||
((TextView) groupCallFullStub.get().findViewById(R.id.group_call_call_full_message)).setText(webRtcControls.getGroupCallFullMessage(getContext()));
|
||||
|
||||
@@ -56,8 +56,8 @@ public class WebRtcCallViewModel extends ViewModel {
|
||||
private boolean answerWithVideoAvailable = false;
|
||||
private Runnable elapsedTimeRunnable = this::handleTick;
|
||||
private boolean canEnterPipMode = false;
|
||||
private List<CallParticipant> previousParticipantsList = Collections.emptyList();
|
||||
private boolean callingStarted = false;
|
||||
private List<CallParticipant> previousParticipantsList = Collections.emptyList();
|
||||
private boolean callStarting = false;
|
||||
|
||||
private final WebRtcCallRepository repository = new WebRtcCallRepository(ApplicationDependencies.getApplication());
|
||||
|
||||
@@ -113,8 +113,8 @@ public class WebRtcCallViewModel extends ViewModel {
|
||||
return answerWithVideoAvailable;
|
||||
}
|
||||
|
||||
public boolean isCallingStarted() {
|
||||
return callingStarted;
|
||||
public boolean isCallStarting() {
|
||||
return callStarting;
|
||||
}
|
||||
|
||||
@MainThread
|
||||
@@ -141,7 +141,10 @@ public class WebRtcCallViewModel extends ViewModel {
|
||||
|
||||
@MainThread
|
||||
public void updateFromWebRtcViewModel(@NonNull WebRtcViewModel webRtcViewModel, boolean enableVideo) {
|
||||
canEnterPipMode = webRtcViewModel.getState() != WebRtcViewModel.State.CALL_PRE_JOIN;
|
||||
canEnterPipMode = !webRtcViewModel.getState().isPreJoinOrNetworkUnavailable();
|
||||
if (callStarting && webRtcViewModel.getState().isPassedPreJoin()) {
|
||||
callStarting = false;
|
||||
}
|
||||
|
||||
CallParticipant localParticipant = webRtcViewModel.getLocalParticipant();
|
||||
|
||||
@@ -232,6 +235,9 @@ public class WebRtcCallViewModel extends ViewModel {
|
||||
case CALL_DISCONNECTED:
|
||||
callState = WebRtcControls.CallState.ENDING;
|
||||
break;
|
||||
case NETWORK_FAILURE:
|
||||
callState = WebRtcControls.CallState.ERROR;
|
||||
break;
|
||||
default:
|
||||
callState = WebRtcControls.CallState.ONGOING;
|
||||
}
|
||||
@@ -309,7 +315,7 @@ public class WebRtcCallViewModel extends ViewModel {
|
||||
}
|
||||
|
||||
public void startCall(boolean isVideoCall) {
|
||||
callingStarted = true;
|
||||
callStarting = true;
|
||||
Recipient recipient = getRecipient().get();
|
||||
if (recipient.isGroup()) {
|
||||
repository.getIdentityRecords(recipient, identityRecords -> {
|
||||
|
||||
@@ -51,6 +51,10 @@ public final class WebRtcControls {
|
||||
this.participantLimit = participantLimit;
|
||||
}
|
||||
|
||||
boolean displayErrorControls() {
|
||||
return isError();
|
||||
}
|
||||
|
||||
boolean displayStartCallControls() {
|
||||
return isPreJoin();
|
||||
}
|
||||
@@ -145,6 +149,10 @@ public final class WebRtcControls {
|
||||
return audioOutput;
|
||||
}
|
||||
|
||||
private boolean isError() {
|
||||
return callState == CallState.ERROR;
|
||||
}
|
||||
|
||||
private boolean isPreJoin() {
|
||||
return callState == CallState.PRE_JOIN;
|
||||
}
|
||||
@@ -167,6 +175,7 @@ public final class WebRtcControls {
|
||||
|
||||
public enum CallState {
|
||||
NONE,
|
||||
ERROR,
|
||||
PRE_JOIN,
|
||||
INCOMING,
|
||||
OUTGOING,
|
||||
|
||||
Reference in New Issue
Block a user