Added short toast when user starts recording a call

This commit is contained in:
Sylvain Berfini 2025-02-03 15:52:42 +01:00
parent 2952b2db01
commit da385ee6e1
9 changed files with 38 additions and 2 deletions

View file

@ -125,10 +125,13 @@ class ActiveConferenceCallFragment : GenericCallFragment() {
callViewModel = requireActivity().run {
ViewModelProvider(this)[CurrentCallViewModel::class.java]
}
observeToastEvents(callViewModel)
observeToastEvents(callViewModel.conferenceModel)
callsViewModel = requireActivity().run {
ViewModelProvider(this)[CallsViewModel::class.java]
}
observeToastEvents(callsViewModel)
binding.lifecycleOwner = viewLifecycleOwner
binding.viewModel = callViewModel

View file

@ -154,10 +154,12 @@ class ActiveCallFragment : GenericCallFragment() {
callViewModel = requireActivity().run {
ViewModelProvider(this)[CurrentCallViewModel::class.java]
}
observeToastEvents(callViewModel)
callsViewModel = requireActivity().run {
ViewModelProvider(this)[CallsViewModel::class.java]
}
observeToastEvents(callsViewModel)
binding.lifecycleOwner = viewLifecycleOwner
binding.viewModel = callViewModel

View file

@ -67,6 +67,7 @@ class EndedCallFragment : GenericCallFragment() {
callViewModel = requireActivity().run {
ViewModelProvider(this)[CurrentCallViewModel::class.java]
}
observeToastEvents(callViewModel)
binding.lifecycleOwner = viewLifecycleOwner
binding.viewModel = callViewModel

View file

@ -55,6 +55,7 @@ class IncomingCallFragment : GenericCallFragment() {
callViewModel = requireActivity().run {
ViewModelProvider(this)[CurrentCallViewModel::class.java]
}
observeToastEvents(callViewModel)
binding.lifecycleOwner = viewLifecycleOwner
binding.viewModel = callViewModel

View file

@ -56,6 +56,7 @@ class OutgoingCallFragment : GenericCallFragment() {
callViewModel = requireActivity().run {
ViewModelProvider(this)[CurrentCallViewModel::class.java]
}
observeToastEvents(callViewModel)
binding.lifecycleOwner = viewLifecycleOwner
binding.viewModel = callViewModel

View file

@ -115,10 +115,12 @@ class TransferCallFragment : GenericCallFragment() {
callViewModel = requireActivity().run {
ViewModelProvider(this)[CurrentCallViewModel::class.java]
}
observeToastEvents(callViewModel)
callsViewModel = requireActivity().run {
ViewModelProvider(this)[CallsViewModel::class.java]
}
observeToastEvents(callsViewModel)
binding.viewModel = viewModel
binding.callsViewModel = callsViewModel

View file

@ -358,7 +358,11 @@ class CurrentCallViewModel
videoUpdateInProgress.postValue(false)
updateCallDuration()
if (corePreferences.automaticallyStartCallRecording) {
isRecording.postValue(call.params.isRecording)
val recording = call.params.isRecording
isRecording.postValue(recording)
if (recording) {
showRecordingToast()
}
}
// MediaEncryption None & SRTP won't be notified through onEncryptionChanged callback,
@ -855,8 +859,12 @@ class CurrentCallViewModel
Log.i("$TAG Starting call recording")
currentCall.startRecording()
}
val recording = currentCall.params.isRecording
isRecording.postValue(recording)
if (recording) {
showRecordingToast()
}
}
}
}
@ -1172,7 +1180,11 @@ class CurrentCallViewModel
contact.postValue(model)
displayedName.postValue(model.friend.name)
isRecording.postValue(call.params.isRecording)
val recording = call.params.isRecording
isRecording.postValue(recording)
if (recording) {
showRecordingToast()
}
val isRemoteRecording = call.remoteParams?.isRecording == true
if (isRemoteRecording) {
@ -1471,4 +1483,16 @@ class CurrentCallViewModel
}
}
}
@AnyThread
private fun showRecordingToast() {
showGreenToastEvent.postValue(
Event(
Pair(
R.string.call_is_being_recorded,
R.drawable.record_fill
)
)
)
}
}

View file

@ -633,6 +633,7 @@
<string name="call_srtp_point_to_point_encrypted">Appel chiffré de point à point</string>
<string name="call_not_encrypted">Appel non chiffré</string>
<string name="calls_list_title">Liste des appels</string>
<string name="call_is_being_recorded">L\'appel est enregistré</string>
<string name="call_remote_is_recording">%s enregistre l\'appel</string>
<string name="calls_count_label">%s appels</string>
<string name="calls_paused_count_label">%s appels en pause</string>

View file

@ -673,6 +673,7 @@
<string name="call_srtp_point_to_point_encrypted">Point-to-point encrypted by SRTP</string>
<string name="call_not_encrypted">Call is not encrypted</string>
<string name="calls_list_title">Calls list</string>
<string name="call_is_being_recorded">Call is being recorded</string>
<string name="call_remote_is_recording">%s is recording</string>
<string name="calls_count_label">%s calls</string>
<string name="calls_paused_count_label">%s paused calls</string>