in azure-communication-ui/calling/src/main/java/com/azure/android/communication/ui/calling/presentation/fragment/calling/CallingViewModel.kt [93:225]
override fun init(coroutineScope: CoroutineScope) {
val state = store.getCurrentState()
val remoteParticipantsForGridView = remoteParticipantsForGridView(state.remoteParticipantState.participantMap)
controlBarViewModel.init(
permissionState = state.permissionState,
cameraState = state.localParticipantState.cameraState,
audioState = state.localParticipantState.audioState,
callState = state.callState,
requestCallEndCallback = this::requestCallEnd,
openAudioDeviceSelectionMenuCallback = audioDeviceListViewModel::displayAudioDeviceSelectionMenu,
visibilityState = state.visibilityState,
audioVideoMode = state.localParticipantState.audioVideoMode,
capabilities = state.localParticipantState.capabilities,
buttonViewDataState = state.buttonState,
controlBarOptions = callScreenOptions?.controlBarOptions,
deviceConfigurationState = state.deviceConfigurationState,
)
localParticipantViewModel.init(
state.localParticipantState.displayName,
state.localParticipantState.audioState.operation,
state.localParticipantState.videoStreamID,
remoteParticipantsForGridView.count(),
state.callState.callingStatus,
state.localParticipantState.cameraState.device,
state.localParticipantState.cameraState.camerasCount,
state.visibilityState.status,
avMode,
isOverlayDisplayedOverGrid(state),
)
floatingHeaderViewModel.init(
remoteParticipantsForGridView.count(),
state.callScreenInfoHeaderState,
state.buttonState,
isOverlayDisplayedOverGrid(state),
this::requestCallEndOnBackPressed,
/* <CALL_START_TIME>
state.callState.callStartTime,
</CALL_START_TIME> */
)
audioDeviceListViewModel.init(
state.localParticipantState.audioState,
state.visibilityState
)
bannerViewModel.init(
state.callState,
isOverlayDisplayedOverGrid(state),
)
participantMenuViewModel.init(
state.localParticipantState.capabilities,
)
participantListViewModel.init(
state.remoteParticipantState.participantMap,
state.localParticipantState,
shouldShowLobby(
state.localParticipantState.capabilities,
state.visibilityState
),
participantMenuViewModel::displayParticipantMenu,
state.remoteParticipantState.totalParticipantCount,
)
waitingLobbyOverlayViewModel.init(shouldDisplayLobbyOverlay(state))
connectingLobbyOverlayViewModel.init(
state.callState,
state.permissionState,
networkManager,
state.localParticipantState.cameraState,
state.localParticipantState.audioState,
state.localParticipantState.initialCallJoinState,
)
holdOverlayViewModel.init(state.callState.callingStatus, state.audioSessionState.audioFocusStatus)
participantGridViewModel.init(
state.rttState,
isOverlayDisplayedOverGrid(state),
state.deviceConfigurationState,
state.captionsState,
)
lobbyHeaderViewModel.init(
state.callState.callingStatus,
getLobbyParticipantsForHeader(state),
shouldShowLobby(
state.localParticipantState.capabilities,
state.visibilityState
)
)
lobbyErrorHeaderViewModel.init(
state.callState.callingStatus,
state.remoteParticipantState.lobbyErrorCode,
shouldShowLobby(
state.localParticipantState.capabilities,
state.visibilityState,
)
)
captionsListViewModel.init(
state.captionsState,
state.callState.callingStatus,
state.visibilityState,
state.buttonState,
state.rttState,
state.navigationState,
)
captionsLanguageSelectionListViewModel.init(state.captionsState, state.visibilityState, state.navigationState)
isCaptionsVisibleMutableFlow.value =
shouldShowCaptionsUI(state.visibilityState, state.captionsState.status, state.rttState)
captionsLayoutViewModel.init(
state.captionsState,
state.rttState,
isCaptionsVisibleMutableFlow.value,
state.deviceConfigurationState,
)
moreCallOptionsListViewModel.init(
state.visibilityState,
state.buttonState,
state.navigationState
)
toastNotificationViewModel.init(
coroutineScope,
)
isCaptionsMaximized = state.rttState.isMaximized
super.init(coroutineScope)
}