Added setting for auto call recording

This commit is contained in:
Sylvain Berfini 2021-08-23 14:48:47 +02:00
parent 6a76513f1e
commit 8303f2e062
5 changed files with 25 additions and 0 deletions

View file

@ -101,6 +101,13 @@ class CallSettingsViewModel : GenericSettingsViewModel() {
}
val rfc2833Dtmf = MutableLiveData<Boolean>()
val autoStartCallRecordingListener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) {
prefs.automaticallyStartCallRecording = newValue
}
}
val autoStartCallRecording = MutableLiveData<Boolean>()
val autoStartListener = object : SettingListenerStub() {
override fun onBoolValueChanged(newValue: Boolean) {
prefs.callRightAway = newValue
@ -191,6 +198,7 @@ class CallSettingsViewModel : GenericSettingsViewModel() {
systemWideOverlay.value = prefs.systemWideCallOverlay
sipInfoDtmf.value = core.useInfoForDtmf
rfc2833Dtmf.value = core.useRfc2833ForDtmf
autoStartCallRecording.value = prefs.automaticallyStartCallRecording
autoStart.value = prefs.callRightAway
autoAnswer.value = prefs.autoAnswerEnabled
autoAnswerDelay.value = prefs.autoAnswerDelay

View file

@ -190,6 +190,10 @@ class CoreContext(val context: Context, coreConfig: Config) {
AudioRouteUtils.routeAudioToBluetooth(call)
}
} else if (state == Call.State.Connected) {
if (corePreferences.automaticallyStartCallRecording) {
Log.i("[Context] We were asked to start the call recording automatically")
call.startRecording()
}
onCallStarted()
} else if (state == Call.State.StreamsRunning) {
// Do not automatically route audio to bluetooth after first call

View file

@ -283,6 +283,12 @@ class CorePreferences constructor(private val context: Context) {
config.setBool("app", "call_right_away", value)
}
var automaticallyStartCallRecording: Boolean
get() = config.getBool("app", "auto_start_call_record", false)
set(value) {
config.setBool("app", "auto_start_call_record", value)
}
var fullScreenCallUI: Boolean
get() = config.getBool("app", "full_screen_call", true)
set(value) {

View file

@ -127,6 +127,12 @@
linphone:listener="@{viewModel.rfc2833DtmfListener}"
linphone:checked="@={viewModel.rfc2833Dtmf}"/>
<include
layout="@layout/settings_widget_switch"
linphone:title="@{@string/call_settings_auto_start_recording_title}"
linphone:listener="@{viewModel.autoStartCallRecordingListener}"
linphone:checked="@={viewModel.autoStartCallRecording}"/>
<include
layout="@layout/settings_widget_switch"
linphone:title="@{@string/call_settings_auto_start_title}"

View file

@ -420,6 +420,7 @@
<string name="call_settings_ring_during_early_media_title">Ring during incoming early media</string>
<string name="call_settings_pause_calls_lost_audio_focus_title">Pause calls when audio focus is lost</string>
<string name="call_settings_go_to_android_notification_settings">Android notification settings</string>
<string name="call_settings_auto_start_recording_title">Automatically start call recording</string>
<!-- Chat settings -->
<string name="chat_settings_mark_as_read_notif_dismissal_title">Mark as read upon notification dismissal</string>