fun update()

in azure-communication-ui/calling/src/main/java/com/azure/android/communication/ui/calling/presentation/fragment/calling/banner/BannerViewModel.kt [48:76]


    fun update(
        callingState: CallingState,
        visibilityState: VisibilityState,
        isOverlayDisplayedOverGrid: Boolean,
    ) {

        if (hideWhileInPip && visibilityState.status == VisibilityStatus.VISIBLE) {
            shouldShowBannerStateMutableFlow.value = true
            hideWhileInPip = false
            return
        }

        val currentBannerInfoType = bannerInfoTypeStateFlow.value
        val newBannerInfoType =
            createBannerInfoType(callingState.isRecording, callingState.isTranscribing)

        if (newBannerInfoType != currentBannerInfoType) {
            bannerInfoTypeStateMutableFlow.value = newBannerInfoType
            shouldShowBannerStateMutableFlow.value = true
            hideWhileInPip = false
        }

        if (shouldShowBannerStateMutableFlow.value && visibilityState.status != VisibilityStatus.VISIBLE) {
            shouldShowBannerStateMutableFlow.value = false
            hideWhileInPip = true
            return
        }
        isOverlayDisplayedMutableFlow.value = isOverlayDisplayedOverGrid
    }