func update()

in AzureCommunicationUI/sdk/AzureCommunicationUICalling/Sources/Presentation/SwiftUI/Calling/CallingViewComponent/Banner/BannerViewModel.swift [34:63]


    func update(callingState: CallingState, visibilityState: VisibilityState) {
        let recordingState = callingState.recordingStatus
        let transcriptionState = callingState.transcriptionStatus

        var toDisplayBanner = true
        switch(recordingState, transcriptionState) {
        case (.on, .on):
            bannerTextViewModel.update(bannerInfoType: .recordingAndTranscriptionStarted)
        case (.on, .off):
            bannerTextViewModel.update(bannerInfoType: .recordingStarted)
        case (.on, .stopped):
            bannerTextViewModel.update(bannerInfoType: .transcriptionStoppedStillRecording)
        case (.off, .on):
            bannerTextViewModel.update(bannerInfoType: .transcriptionStarted)
        case (.off, .off):
            bannerTextViewModel.update(bannerInfoType: nil)
            toDisplayBanner = false
        case (.off, .stopped):
            bannerTextViewModel.update(bannerInfoType: .transcriptionStoppedAndSaved)
        case (.stopped, .on):
            bannerTextViewModel.update(bannerInfoType: .recordingStoppedStillTranscribing)
        case (.stopped, .off):
            bannerTextViewModel.update(bannerInfoType: .recordingStopped)
        case (.stopped, .stopped):
            bannerTextViewModel.update(bannerInfoType: .recordingAndTranscriptionStopped)
        }
        isBannerDisplayed = toDisplayBanner
        && !callingState.isRecorcingTranscriptionBannedDismissed
        && visibilityState.currentStatus == VisibilityStatus.visible
    }