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,8 +108,12 @@ class ControlsFragment : GenericFragment<CallControlsFragmentBinding>() {
if (call.state == Call.State.StreamsRunning) {
dialog?.dismiss()
} else if (call.state == Call.State.UpdatedByRemote) {
if (call.currentParams.videoEnabled() != call.remoteParams?.videoEnabled()) {
showCallVideoUpdateDialog(call)
if (coreContext.core.videoCaptureEnabled() || coreContext.core.videoDisplayEnabled()) {
if (call.currentParams.videoEnabled() != call.remoteParams?.videoEnabled()) {
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 autoAccept = call.core.videoActivationPolicy.automaticallyAccept
if (remoteVideo && !localVideo && !autoAccept) {
call.deferUpdate()
callUpdateEvent.value = Event(call)
if (coreContext.core.videoCaptureEnabled() || coreContext.core.videoDisplayEnabled()) {
call.deferUpdate()
callUpdateEvent.value = Event(call)
} else {
coreContext.answerCallVideoUpdateRequest(call, false)
}
}
} else if (state == Call.State.StreamsRunning) {
callUpdateEvent.value = Event(call)

View file

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

View file

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

View file

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