Skip to content

Commit

Permalink
fix: camera on/off button when in fullscreen [WPB-9815] (#3121)
Browse files Browse the repository at this point in the history
  • Loading branch information
saleniuk authored Jun 24, 2024
1 parent ab3cabe commit 4c5a52f
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import com.wire.android.ui.theme.wireColorScheme
import com.wire.android.ui.theme.wireDimensions
import com.wire.android.ui.theme.wireTypography
import com.wire.android.util.ui.PreviewMultipleThemes
import com.wire.kalium.logic.data.call.CallStatus
import com.wire.kalium.logic.data.conversation.Conversation
import com.wire.kalium.logic.data.id.ConversationId
import java.util.Locale
Expand Down Expand Up @@ -122,20 +123,24 @@ fun OngoingCallScreen(
hangUpCall = { sharedCallingViewModel.hangUpCall(navigator::navigateBack) },
toggleVideo = sharedCallingViewModel::toggleVideo,
flipCamera = sharedCallingViewModel::flipCamera,
setVideoPreview = {
sharedCallingViewModel.setVideoPreview(it)
ongoingCallViewModel.startSendingVideoFeed()
},
clearVideoPreview = {
sharedCallingViewModel.clearVideoPreview()
ongoingCallViewModel.stopSendingVideoFeed()
},
setVideoPreview = sharedCallingViewModel::setVideoPreview,
clearVideoPreview = sharedCallingViewModel::clearVideoPreview,
navigateBack = navigator::navigateBack,
requestVideoStreams = ongoingCallViewModel::requestVideoStreams,
hideDoubleTapToast = ongoingCallViewModel::hideDoubleTapToast
)
BackHandler(enabled = isCameraOn, navigator::navigateBack)
}

// Start/stop sending video feed based on the camera state when the call is established.
LaunchedEffect(sharedCallingViewModel.callState.callStatus, sharedCallingViewModel.callState.isCameraOn) {
if (sharedCallingViewModel.callState.callStatus == CallStatus.ESTABLISHED) {
when (sharedCallingViewModel.callState.isCameraOn) {
true -> ongoingCallViewModel.startSendingVideoFeed()
false -> ongoingCallViewModel.stopSendingVideoFeed()
}
}
}
}

@OptIn(ExperimentalMaterial3Api::class)
Expand Down

0 comments on commit 4c5a52f

Please sign in to comment.