Hide switch camera button if video call is receive only

This commit is contained in:
Sylvain Berfini 2023-12-15 09:33:31 +01:00
parent 18756a840d
commit 93ac3f8c41
2 changed files with 5 additions and 5 deletions

View file

@ -540,12 +540,12 @@ class ControlsViewModel : ViewModel() {
isVideoEnabled.value = enabled isVideoEnabled.value = enabled
showTakeSnapshotButton.value = enabled && corePreferences.showScreenshotButton showTakeSnapshotButton.value = enabled && corePreferences.showScreenshotButton
val isVideoBeingSent = if (coreContext.core.currentCall?.conference != null) { val videoDirection = if (coreContext.core.currentCall?.conference != null) {
val videoDirection = coreContext.core.currentCall?.currentParams?.videoDirection coreContext.core.currentCall?.currentParams?.videoDirection
videoDirection == MediaDirection.SendRecv || videoDirection == MediaDirection.SendOnly
} else { } else {
true coreContext.core.currentCall?.params?.videoDirection
} }
val isVideoBeingSent = videoDirection == MediaDirection.SendRecv || videoDirection == MediaDirection.SendOnly
isSendingVideo.value = isVideoBeingSent isSendingVideo.value = isVideoBeingSent
isSwitchCameraAvailable.value = enabled && coreContext.showSwitchCameraButton() && isVideoBeingSent isSwitchCameraAvailable.value = enabled && coreContext.showSwitchCameraButton() && isVideoBeingSent
} }

View file

@ -246,7 +246,7 @@
android:onClick="@{() -> controlsViewModel.switchCamera()}" android:onClick="@{() -> controlsViewModel.switchCamera()}"
android:padding="10dp" android:padding="10dp"
android:src="@drawable/icon_call_camera_switch" android:src="@drawable/icon_call_camera_switch"
android:visibility="@{controlsViewModel.isVideoEnabled && !callsViewModel.currentCallData.isRemotelyPaused && !callsViewModel.currentCallData.isPaused && controlsViewModel.isSwitchCameraAvailable && !controlsViewModel.pipMode ? View.VISIBLE : View.GONE, default=gone}" android:visibility="@{controlsViewModel.isSendingVideo && !callsViewModel.currentCallData.isRemotelyPaused && !callsViewModel.currentCallData.isPaused && controlsViewModel.isSwitchCameraAvailable && !controlsViewModel.pipMode ? View.VISIBLE : View.GONE, default=gone}"
app:layout_constraintEnd_toEndOf="@id/local_preview_video_surface" app:layout_constraintEnd_toEndOf="@id/local_preview_video_surface"
app:layout_constraintTop_toTopOf="@id/local_preview_video_surface" /> app:layout_constraintTop_toTopOf="@id/local_preview_video_surface" />