Don't show video popup if video is globally disabled + don't hide mandatory encryption setting if encryption is disabled

This commit is contained in:
Sylvain Berfini 2021-06-29 13:43:30 +02:00
parent 1b0bbb913a
commit 5d048ee6db
5 changed files with 21 additions and 6 deletions

View file

@ -108,9 +108,13 @@ class ControlsFragment : GenericFragment<CallControlsFragmentBinding>() {
if (call.state == Call.State.StreamsRunning) { if (call.state == Call.State.StreamsRunning) {
dialog?.dismiss() dialog?.dismiss()
} else if (call.state == Call.State.UpdatedByRemote) { } else if (call.state == Call.State.UpdatedByRemote) {
if (coreContext.core.videoCaptureEnabled() || coreContext.core.videoDisplayEnabled()) {
if (call.currentParams.videoEnabled() != call.remoteParams?.videoEnabled()) { if (call.currentParams.videoEnabled() != call.remoteParams?.videoEnabled()) {
showCallVideoUpdateDialog(call) showCallVideoUpdateDialog(call)
} }
} else {
Log.w("[Controls Fragment] Video display & capture are disabled, don't show video dialog")
}
} }
} }
}) })

View file

@ -78,8 +78,12 @@ class CallsViewModel : ViewModel() {
val localVideo = call.currentParams.videoEnabled() val localVideo = call.currentParams.videoEnabled()
val autoAccept = call.core.videoActivationPolicy.automaticallyAccept val autoAccept = call.core.videoActivationPolicy.automaticallyAccept
if (remoteVideo && !localVideo && !autoAccept) { if (remoteVideo && !localVideo && !autoAccept) {
if (coreContext.core.videoCaptureEnabled() || coreContext.core.videoDisplayEnabled()) {
call.deferUpdate() call.deferUpdate()
callUpdateEvent.value = Event(call) callUpdateEvent.value = Event(call)
} else {
coreContext.answerCallVideoUpdateRequest(call, false)
}
} }
} else if (state == Call.State.StreamsRunning) { } else if (state == Call.State.StreamsRunning) {
callUpdateEvent.value = Event(call) callUpdateEvent.value = Event(call)

View file

@ -46,6 +46,9 @@ class CallSettingsViewModel : GenericSettingsViewModel() {
override fun onListValueChanged(position: Int) { override fun onListValueChanged(position: Int) {
core.mediaEncryption = MediaEncryption.fromInt(encryptionValues[position]) core.mediaEncryption = MediaEncryption.fromInt(encryptionValues[position])
encryptionIndex.value = position encryptionIndex.value = position
if (position == 0) {
encryptionMandatory.value = false
}
} }
} }
val encryptionIndex = MutableLiveData<Int>() val encryptionIndex = MutableLiveData<Int>()

View file

@ -33,6 +33,11 @@ class VideoSettingsViewModel : GenericSettingsViewModel() {
override fun onBoolValueChanged(newValue: Boolean) { override fun onBoolValueChanged(newValue: Boolean) {
core.enableVideoCapture(newValue) core.enableVideoCapture(newValue)
core.enableVideoDisplay(newValue) core.enableVideoDisplay(newValue)
if (!newValue) {
tabletPreview.value = false
initiateCall.value = false
autoAccept.value = false
}
} }
} }
val enableVideo = MutableLiveData<Boolean>() val enableVideo = MutableLiveData<Boolean>()

View file

@ -89,8 +89,7 @@
linphone:title="@{@string/call_settings_encryption_mandatory_title}" linphone:title="@{@string/call_settings_encryption_mandatory_title}"
linphone:listener="@{viewModel.encryptionMandatoryListener}" linphone:listener="@{viewModel.encryptionMandatoryListener}"
linphone:checked="@={viewModel.encryptionMandatory}" linphone:checked="@={viewModel.encryptionMandatory}"
linphone:enabled="@{viewModel.encryptionIndex != 0}" linphone:enabled="@{viewModel.encryptionIndex != 0}" />
android:visibility="@{viewModel.encryptionIndex != 0 ? View.VISIBLE : View.GONE}"/>
<include <include
layout="@layout/settings_widget_switch" layout="@layout/settings_widget_switch"
linphone:title="@{@string/call_settings_full_screen_title}" linphone:title="@{@string/call_settings_full_screen_title}"