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() {
|
private void handleRecipientUnavailable() {
|
||||||
EventBus.getDefault().removeStickyEvent(WebRtcViewModel.class);
|
EventBus.getDefault().removeStickyEvent(WebRtcViewModel.class);
|
||||||
callScreen.setStatus(getString(R.string.RedPhone_recipient_unavailable));
|
callScreen.setStatus(getString(R.string.RedPhone_recipient_unavailable));
|
||||||
|
@ -623,6 +627,8 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
|
||||||
handleCallPreJoin(event); break;
|
handleCallPreJoin(event); break;
|
||||||
case CALL_CONNECTED:
|
case CALL_CONNECTED:
|
||||||
handleCallConnected(event); break;
|
handleCallConnected(event); break;
|
||||||
|
case CALL_RECONNECTING:
|
||||||
|
handleCallReconnecting(); break;
|
||||||
case NETWORK_FAILURE:
|
case NETWORK_FAILURE:
|
||||||
handleServerFailure(); break;
|
handleServerFailure(); break;
|
||||||
case CALL_RINGING:
|
case CALL_RINGING:
|
||||||
|
|
|
@ -278,7 +278,7 @@ data class CallParticipantsState(
|
||||||
if (isExpanded && (localParticipant.isVideoEnabled || isNonIdleGroupCall)) {
|
if (isExpanded && (localParticipant.isVideoEnabled || isNonIdleGroupCall)) {
|
||||||
return WebRtcLocalRenderState.EXPANDED
|
return WebRtcLocalRenderState.EXPANDED
|
||||||
} else if (displayLocal || showVideoForOutgoing) {
|
} 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) {
|
localRenderState = if (isViewingFocusedParticipant || numberOfRemoteParticipants > 1) {
|
||||||
WebRtcLocalRenderState.SMALLER_RECTANGLE
|
WebRtcLocalRenderState.SMALLER_RECTANGLE
|
||||||
} else if (numberOfRemoteParticipants == 1) {
|
} else if (numberOfRemoteParticipants == 1) {
|
||||||
|
|
|
@ -349,6 +349,9 @@ public class WebRtcCallViewModel extends ViewModel {
|
||||||
case NETWORK_FAILURE:
|
case NETWORK_FAILURE:
|
||||||
callState = WebRtcControls.CallState.ERROR;
|
callState = WebRtcControls.CallState.ERROR;
|
||||||
break;
|
break;
|
||||||
|
case CALL_RECONNECTING:
|
||||||
|
callState = WebRtcControls.CallState.RECONNECTING;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
callState = WebRtcControls.CallState.ONGOING;
|
callState = WebRtcControls.CallState.ONGOING;
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ public final class WebRtcControls {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean displayEndCall() {
|
boolean displayEndCall() {
|
||||||
return isAtLeastOutgoing();
|
return isAtLeastOutgoing() || callState == CallState.RECONNECTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean displayMuteAudio() {
|
boolean displayMuteAudio() {
|
||||||
|
@ -182,7 +182,7 @@ public final class WebRtcControls {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isFadeOutEnabled() {
|
boolean isFadeOutEnabled() {
|
||||||
return isAtLeastOutgoing() && isRemoteVideoEnabled;
|
return isAtLeastOutgoing() && isRemoteVideoEnabled && callState != CallState.RECONNECTING;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean displaySmallOngoingCallButtons() {
|
boolean displaySmallOngoingCallButtons() {
|
||||||
|
@ -248,6 +248,7 @@ public final class WebRtcControls {
|
||||||
NONE,
|
NONE,
|
||||||
ERROR,
|
ERROR,
|
||||||
PRE_JOIN,
|
PRE_JOIN,
|
||||||
|
RECONNECTING,
|
||||||
INCOMING,
|
INCOMING,
|
||||||
OUTGOING,
|
OUTGOING,
|
||||||
ONGOING,
|
ONGOING,
|
||||||
|
|
|
@ -23,6 +23,7 @@ class WebRtcViewModel(state: WebRtcServiceState) {
|
||||||
CALL_DISCONNECTED,
|
CALL_DISCONNECTED,
|
||||||
CALL_DISCONNECTED_GLARE,
|
CALL_DISCONNECTED_GLARE,
|
||||||
CALL_NEEDS_PERMISSION,
|
CALL_NEEDS_PERMISSION,
|
||||||
|
CALL_RECONNECTING,
|
||||||
|
|
||||||
// Error states
|
// Error states
|
||||||
NETWORK_FAILURE,
|
NETWORK_FAILURE,
|
||||||
|
|
|
@ -27,7 +27,7 @@ public final class NotInCallConstraint implements Constraint {
|
||||||
|
|
||||||
public static boolean isNotInConnectedCall() {
|
public static boolean isNotInConnectedCall() {
|
||||||
WebRtcViewModel viewModel = EventBus.getDefault().getStickyEvent(WebRtcViewModel.class);
|
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
|
@Override
|
||||||
|
|
|
@ -8,6 +8,7 @@ import androidx.annotation.Nullable;
|
||||||
import org.signal.core.util.logging.Log;
|
import org.signal.core.util.logging.Log;
|
||||||
import org.signal.ringrtc.CallException;
|
import org.signal.ringrtc.CallException;
|
||||||
import org.signal.ringrtc.CallManager;
|
import org.signal.ringrtc.CallManager;
|
||||||
|
import org.thoughtcrime.securesms.events.WebRtcViewModel;
|
||||||
import org.thoughtcrime.securesms.ringrtc.RemotePeer;
|
import org.thoughtcrime.securesms.ringrtc.RemotePeer;
|
||||||
import org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState;
|
import org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState;
|
||||||
import org.thoughtcrime.securesms.webrtc.locks.LockManager;
|
import org.thoughtcrime.securesms.webrtc.locks.LockManager;
|
||||||
|
@ -74,6 +75,16 @@ public class ConnectedCallActionProcessor extends DeviceAwareActionProcessor {
|
||||||
return currentState;
|
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
|
@Override
|
||||||
protected @NonNull WebRtcServiceState handleRemoteVideoEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
|
protected @NonNull WebRtcServiceState handleRemoteVideoEnable(@NonNull WebRtcServiceState currentState, boolean enable) {
|
||||||
return activeCallDelegate.handleRemoteVideoEnable(currentState, enable);
|
return activeCallDelegate.handleRemoteVideoEnable(currentState, enable);
|
||||||
|
|
|
@ -445,11 +445,8 @@ public final class SignalCallManager implements CallManager.Observer, GroupCall.
|
||||||
case REMOTE_RINGING:
|
case REMOTE_RINGING:
|
||||||
return p.handleRemoteRinging(s, remotePeer);
|
return p.handleRemoteRinging(s, remotePeer);
|
||||||
case RECONNECTING:
|
case RECONNECTING:
|
||||||
Log.i(TAG, "Reconnecting: NOT IMPLEMENTED");
|
|
||||||
break;
|
|
||||||
case RECONNECTED:
|
case RECONNECTED:
|
||||||
Log.i(TAG, "Reconnected: NOT IMPLEMENTED");
|
return p.handleCallReconnect(s, event);
|
||||||
break;
|
|
||||||
case LOCAL_CONNECTED:
|
case LOCAL_CONNECTED:
|
||||||
case REMOTE_CONNECTED:
|
case REMOTE_CONNECTED:
|
||||||
return p.handleCallConnected(s, remotePeer);
|
return p.handleCallConnected(s, remotePeer);
|
||||||
|
|
|
@ -459,6 +459,11 @@ public abstract class WebRtcActionProcessor {
|
||||||
return currentState;
|
return currentState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public @NonNull WebRtcServiceState handleCallReconnect(@NonNull WebRtcServiceState currentState, @NonNull CallManager.CallEvent event) {
|
||||||
|
Log.i(tag, "handleCallReconnect not processed");
|
||||||
|
return currentState;
|
||||||
|
}
|
||||||
|
|
||||||
//endregion Active call
|
//endregion Active call
|
||||||
|
|
||||||
//region Call setup
|
//region Call setup
|
||||||
|
|
|
@ -1486,6 +1486,8 @@
|
||||||
<string name="WebRtcCallActivity__signal_s">Signal %1$s</string>
|
<string name="WebRtcCallActivity__signal_s">Signal %1$s</string>
|
||||||
<string name="WebRtcCallActivity__calling">Calling…</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>
|
<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 -->
|
<!-- WebRtcCallView -->
|
||||||
<string name="WebRtcCallView__signal_call">Signal Call</string>
|
<string name="WebRtcCallView__signal_call">Signal Call</string>
|
||||||
|
|
Ładowanie…
Reference in New Issue