Hi im attempting to use ```private val mutableDis...
# coroutines
t
Hi im attempting to use
Copy code
private val mutableDisplayedPageNoState = MutableSharedFlow<Int>(replay = 0, extraBufferCapacity = 3, onBufferOverflow = BufferOverflow.DROP_OLDEST)
to detect the minimum page number, thats emitted by my actor...
Copy code
private val displayedPageNoState: SharedFlow<Int> = mutableDisplayedPageNoState

private val displayedPageNoActor = lifecycleScope.actor<Int>(capacity = Channel.UNLIMITED) {
    channel.consumeEach { displayedPageNo ->
        val isSuccessfulTry = mutableDisplayedPageNoState.tryEmit(displayedPageNo)
        if (!isSuccessfulTry) Timber.e("Failed to emit displayedPageNo = $displayedPageNo")
    }
}
Copy code
private fun sendPageNumber(pageNumber: Int) {
    Timber.e("sendPageNumber() called with: pageNumber = $pageNumber")
    val channelResult: ChannelResult<Unit> = displayedPageNoActor.trySend(pageNumber)

    @Suppress("ControlFlowWithEmptyBody")
    if (channelResult.isSuccess) {
    } else {
        if (BuildConfig.BUILD_TYPE == "debug") throw RuntimeException("unsuccessful $channelResult")
        else Timber.e("unsuccessful $channelResult")
    }
}
this is not working due to the fact that the third party pdf library i am using in my android application displays the visible pages multiple times
for example in landscape mode there can be multiple pages visble, e.g. page numbers 0, 1, 2, & 3 in this case the third party library calls "`pageDisplayed`" function multiple times, there fore my actor sends page numbers n, n+1, n+2, n+3 approximately 3 times i need to detect what the minimum page number is both when the pages are first displayed and then as the user scroll through the pages is there a flow operator i can employ that will detect the minimum value for each "burst" of pagenumbers emitted?