Don't show toast when dismiss the recording stop dialog

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-01-30 16:12:56 +01:00
parent 869dc86757
commit 5cc2a6d531
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
3 changed files with 31 additions and 14 deletions

View File

@ -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.
* <p>
* 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.
*
* <p>
* 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.
*

View File

@ -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 -> {}
}
}

View File

@ -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
)
}
}