diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java index cba9861f4..52811c344 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java @@ -397,8 +397,10 @@ public class CallActivity extends CallBaseActivity { callRecordingViewModel.getViewState().observe(this, viewState -> { if (viewState instanceof CallRecordingViewModel.RecordingStartedState) { binding.callRecordingIndicator.setVisibility(View.VISIBLE); - VibrationUtils.INSTANCE.vibrateShort(context); - Toast.makeText(context, context.getResources().getString(R.string.record_active_info), Toast.LENGTH_LONG).show(); + if (((CallRecordingViewModel.RecordingStartedState) viewState).getShowStartedInfo()) { + VibrationUtils.INSTANCE.vibrateShort(context); + Toast.makeText(context, context.getResources().getString(R.string.record_active_info), Toast.LENGTH_LONG).show(); + } } else if (viewState instanceof CallRecordingViewModel.RecordingConfirmStopState) { MaterialAlertDialogBuilder dialogBuilder = new MaterialAlertDialogBuilder(this) .setTitle(R.string.record_stop_confirm_title) @@ -1614,7 +1616,7 @@ public class CallActivity extends CallBaseActivity { @Override public void onNext( @io.reactivex.annotations.NonNull - SignalingOverall signalingOverall) { + SignalingOverall signalingOverall) { receivedSignalingMessages(signalingOverall.getOcs().getSignalings()); } @@ -1988,7 +1990,7 @@ public class CallActivity extends CallBaseActivity { // will not send an offer, so no connection is actually established when the remote participant has a // higher session ID but is not publishing media. if ((hasMCU && participantHasAudioOrVideo) || - (!hasMCU && selfParticipantHasAudioOrVideo && (!participantHasAudioOrVideo || sessionId.compareTo(currentSessionId) < 0))) { + (!hasMCU && selfParticipantHasAudioOrVideo && (!participantHasAudioOrVideo || sessionId.compareTo(currentSessionId) < 0))) { getOrCreatePeerConnectionWrapperForSessionIdAndType(sessionId, VIDEO_STREAM_TYPE_VIDEO, false); } } @@ -2220,7 +2222,7 @@ public class CallActivity extends CallBaseActivity { private void updateSelfVideoViewIceConnectionState(PeerConnection.IceConnectionState iceConnectionState) { boolean connected = iceConnectionState == PeerConnection.IceConnectionState.CONNECTED || - iceConnectionState == PeerConnection.IceConnectionState.COMPLETED; + iceConnectionState == PeerConnection.IceConnectionState.COMPLETED; // FIXME In voice only calls there is no video view, so the progress bar would appear floating in the middle of // nowhere. However, a way to signal that the local participant is not connected to the HPB is still need in @@ -2598,8 +2600,9 @@ public class CallActivity extends CallBaseActivity { } /** - * Temporary implementation of SignalingMessageReceiver until signaling related code is extracted from CallActivity. - * + * Temporary implementation of SignalingMessageReceiver until signaling related code is extracted from + * CallActivity. + *

* All listeners are called in the main thread. */ private static class InternalSignalingMessageReceiver extends SignalingMessageReceiver { @@ -2794,7 +2797,7 @@ public class CallActivity extends CallBaseActivity { /** * Adds the local participant nick to offers and answers. - * + *

* For legacy reasons the offers and answers sent when the internal signaling server is used are expected to * provide the nick of the local participant. * diff --git a/app/src/main/java/com/nextcloud/talk/viewmodels/CallRecordingViewModel.kt b/app/src/main/java/com/nextcloud/talk/viewmodels/CallRecordingViewModel.kt index 349e24483..2cdc62a7c 100644 --- a/app/src/main/java/com/nextcloud/talk/viewmodels/CallRecordingViewModel.kt +++ b/app/src/main/java/com/nextcloud/talk/viewmodels/CallRecordingViewModel.kt @@ -42,7 +42,8 @@ class CallRecordingViewModel @Inject constructor(private val repository: CallRec lateinit var roomToken: String sealed interface ViewState - object RecordingStartedState : ViewState + open class RecordingStartedState(val showStartedInfo: Boolean) : ViewState + object RecordingStoppedState : ViewState object RecordingStartLoadingState : ViewState object RecordingStopLoadingState : ViewState @@ -57,7 +58,7 @@ class CallRecordingViewModel @Inject constructor(private val repository: CallRec fun clickRecordButton() { when (viewState.value) { - RecordingStartedState -> { + is RecordingStartedState -> { _viewState.value = RecordingConfirmStopState } RecordingStoppedState -> { @@ -92,7 +93,7 @@ class CallRecordingViewModel @Inject constructor(private val repository: CallRec } fun dismissStopRecording() { - _viewState.value = RecordingStartedState + _viewState.value = RecordingStartedState(false) } override fun onCleared() { @@ -108,8 +109,8 @@ class CallRecordingViewModel @Inject constructor(private val repository: CallRec fun setRecordingState(state: Int) { when (state) { RECORDING_STOPPED_CODE -> _viewState.value = RecordingStoppedState - RECORDING_STARTED_VIDEO_CODE -> _viewState.value = RecordingStartedState - RECORDING_STARTED_AUDIO_CODE -> _viewState.value = RecordingStartedState + RECORDING_STARTED_VIDEO_CODE -> _viewState.value = RecordingStartedState(true) + RECORDING_STARTED_AUDIO_CODE -> _viewState.value = RecordingStartedState(true) else -> {} } } diff --git a/app/src/test/java/com/nextcloud/talk/viewmodels/CallRecordingViewModelTest.kt b/app/src/test/java/com/nextcloud/talk/viewmodels/CallRecordingViewModelTest.kt index 2a362e916..ea506b78b 100644 --- a/app/src/test/java/com/nextcloud/talk/viewmodels/CallRecordingViewModelTest.kt +++ b/app/src/test/java/com/nextcloud/talk/viewmodels/CallRecordingViewModelTest.kt @@ -29,6 +29,9 @@ class CallRecordingViewModelTest : AbstractViewModelTest() { val viewModel = CallRecordingViewModel(repository) viewModel.setData("foo") viewModel.setRecordingState(CallRecordingViewModel.RECORDING_STARTED_VIDEO_CODE) + + Assert.equals(true, (viewModel.viewState.value as CallRecordingViewModel.RecordingStartedState).showStartedInfo) + viewModel.clickRecordButton() Assert.equals(CallRecordingViewModel.RecordingConfirmStopState, viewModel.viewState.value) @@ -43,6 +46,9 @@ class CallRecordingViewModelTest : AbstractViewModelTest() { val viewModel = CallRecordingViewModel(repository) viewModel.setData("foo") viewModel.setRecordingState(CallRecordingViewModel.RECORDING_STARTED_VIDEO_CODE) + + Assert.equals(true, (viewModel.viewState.value as CallRecordingViewModel.RecordingStartedState).showStartedInfo) + viewModel.clickRecordButton() Assert.equals(CallRecordingViewModel.RecordingConfirmStopState, viewModel.viewState.value) @@ -63,6 +69,13 @@ class CallRecordingViewModelTest : AbstractViewModelTest() { viewModel.dismissStopRecording() - Assert.equals(CallRecordingViewModel.RecordingStartedState, viewModel.viewState.value) + Assert.equals( + CallRecordingViewModel.RecordingStartedState(false).javaClass, + viewModel.viewState.value?.javaClass + ) + Assert.equals( + false, + (viewModel.viewState.value as CallRecordingViewModel.RecordingStartedState).showStartedInfo + ) } }