kopia lustrzana https://github.com/ryukoposting/Signal-Android
Handle 1:1 call reconnecting events.
rodzic
3af53f2089
commit
403958fed3
|
@ -501,6 +501,10 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
|
|||
}
|
||||
}
|
||||
|
||||
private void handleCallReconnecting() {
|
||||
callScreen.setStatus(getString(R.string.WebRtcCallActivity__reconnecting));
|
||||
}
|
||||
|
||||
private void handleRecipientUnavailable() {
|
||||
EventBus.getDefault().removeStickyEvent(WebRtcViewModel.class);
|
||||
callScreen.setStatus(getString(R.string.RedPhone_recipient_unavailable));
|
||||
|
@ -623,6 +627,8 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
|
|||
handleCallPreJoin(event); break;
|
||||
case CALL_CONNECTED:
|
||||
handleCallConnected(event); break;
|
||||
case CALL_RECONNECTING:
|
||||
handleCallReconnecting(); break;
|
||||
case NETWORK_FAILURE:
|
||||
handleServerFailure(); break;
|
||||
case CALL_RINGING:
|
||||
|
|
|
@ -278,7 +278,7 @@ data class CallParticipantsState(
|
|||
if (isExpanded && (localParticipant.isVideoEnabled || isNonIdleGroupCall)) {
|
||||
return WebRtcLocalRenderState.EXPANDED
|
||||
} else if (displayLocal || showVideoForOutgoing) {
|
||||
if (callState == WebRtcViewModel.State.CALL_CONNECTED) {
|
||||
if (callState == WebRtcViewModel.State.CALL_CONNECTED || callState == WebRtcViewModel.State.CALL_RECONNECTING) {
|
||||
localRenderState = if (isViewingFocusedParticipant || numberOfRemoteParticipants > 1) {
|
||||
WebRtcLocalRenderState.SMALLER_RECTANGLE
|
||||
} else if (numberOfRemoteParticipants == 1) {
|
||||
|
|
|
@ -349,6 +349,9 @@ public class WebRtcCallViewModel extends ViewModel {
|
|||
case NETWORK_FAILURE:
|
||||
callState = WebRtcControls.CallState.ERROR;
|
||||
break;
|
||||
case CALL_RECONNECTING:
|
||||
callState = WebRtcControls.CallState.RECONNECTING;
|
||||
break;
|
||||
default:
|
||||
callState = WebRtcControls.CallState.ONGOING;
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ public final class WebRtcControls {
|
|||
}
|
||||
|
||||
boolean displayEndCall() {
|
||||
return isAtLeastOutgoing();
|
||||
return isAtLeastOutgoing() || callState == CallState.RECONNECTING;
|
||||
}
|
||||
|
||||
boolean displayMuteAudio() {
|
||||
|
@ -182,7 +182,7 @@ public final class WebRtcControls {
|
|||
}
|
||||
|
||||
boolean isFadeOutEnabled() {
|
||||
return isAtLeastOutgoing() && isRemoteVideoEnabled;
|
||||
return isAtLeastOutgoing() && isRemoteVideoEnabled && callState != CallState.RECONNECTING;
|
||||
}
|
||||
|
||||
boolean displaySmallOngoingCallButtons() {
|
||||
|
@ -248,6 +248,7 @@ public final class WebRtcControls {
|
|||
NONE,
|
||||
ERROR,
|
||||
PRE_JOIN,
|
||||
RECONNECTING,
|
||||
INCOMING,
|
||||
OUTGOING,
|
||||
ONGOING,
|
||||
|
|
|
@ -23,6 +23,7 @@ class WebRtcViewModel(state: WebRtcServiceState) {
|
|||
CALL_DISCONNECTED,
|
||||
CALL_DISCONNECTED_GLARE,
|
||||
CALL_NEEDS_PERMISSION,
|
||||
CALL_RECONNECTING,
|
||||
|
||||
// Error states
|
||||
NETWORK_FAILURE,
|
||||
|
|
|
@ -27,7 +27,7 @@ public final class NotInCallConstraint implements Constraint {
|
|||
|
||||
public static boolean isNotInConnectedCall() {
|
||||
WebRtcViewModel viewModel = EventBus.getDefault().getStickyEvent(WebRtcViewModel.class);
|
||||
return viewModel == null || viewModel.getState() != WebRtcViewModel.State.CALL_CONNECTED;
|
||||
return viewModel == null || (viewModel.getState() != WebRtcViewModel.State.CALL_CONNECTED && viewModel.getState() != WebRtcViewModel.State.CALL_RECONNECTING);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,6 +8,7 @@ import androidx.annotation.Nullable;
|
|||
import org.signal.core.util.logging.Log;
|
||||
import org.signal.ringrtc.CallException;
|
||||
import org.signal.ringrtc.CallManager;
|
||||
import org.thoughtcrime.securesms.events.WebRtcViewModel;
|
||||
import org.thoughtcrime.securesms.ringrtc.RemotePeer;
|
||||
import org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState;
|
||||
import org.thoughtcrime.securesms.webrtc.locks.LockManager;
|
||||
|
@ -74,6 +75,16 @@ public class ConnectedCallActionProcessor extends DeviceAwareActionProcessor {
|
|||
return currentState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNull WebRtcServiceState handleCallReconnect(@NonNull WebRtcServiceState currentState, @NonNull CallManager.CallEvent event) {
|
||||
Log.i(TAG, "handleCallReconnect(): event: " + event);
|
||||
|
||||
return currentState.builder()
|
||||
.changeCallInfoState()
|
||||
.callState(event == CallManager.CallEvent.RECONNECTING ? WebRtcViewModel.State.CALL_RECONNECTING : WebRtcViewModel.State.CALL_CONNECTED)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NonNull WebRtcServiceState handleRemoteVideoEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
|
||||
return activeCallDelegate.handleRemoteVideoEnable(currentState, enable);
|
||||
|
|
|
@ -445,11 +445,8 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
|
|||
case REMOTE_RINGING:
|
||||
return p.handleRemoteRinging(s, remotePeer);
|
||||
case RECONNECTING:
|
||||
Log.i(TAG, "Reconnecting: NOT IMPLEMENTED");
|
||||
break;
|
||||
case RECONNECTED:
|
||||
Log.i(TAG, "Reconnected: NOT IMPLEMENTED");
|
||||
break;
|
||||
return p.handleCallReconnect(s, event);
|
||||
case LOCAL_CONNECTED:
|
||||
case REMOTE_CONNECTED:
|
||||
return p.handleCallConnected(s, remotePeer);
|
||||
|
|
|
@ -459,6 +459,11 @@ public abstract class WebRtcActionProcessor {
|
|||
return currentState;
|
||||
}
|
||||
|
||||
public @NonNull WebRtcServiceState handleCallReconnect(@NonNull WebRtcServiceState currentState, @NonNull CallManager.CallEvent event) {
|
||||
Log.i(tag, "handleCallReconnect not processed");
|
||||
return currentState;
|
||||
}
|
||||
|
||||
//endregion Active call
|
||||
|
||||
//region Call setup
|
||||
|
|
|
@ -1486,6 +1486,8 @@
|
|||
<string name="WebRtcCallActivity__signal_s">Signal %1$s</string>
|
||||
<string name="WebRtcCallActivity__calling">Calling…</string>
|
||||
<string name="WebRtcCallActivity__group_is_too_large_to_ring_the_participants">Group is too large to ring the participants.</string>
|
||||
<!-- Call status shown when an active call was disconnected (e.g., network hiccup) and is trying to reconnect -->
|
||||
<string name="WebRtcCallActivity__reconnecting">Reconnecting…</string>
|
||||
|
||||
<!-- WebRtcCallView -->
|
||||
<string name="WebRtcCallView__signal_call">Signal Call</string>
|
||||
|
|
Ładowanie…
Reference in New Issue