Skip to content

Commit

Permalink
Remove usage of collectLatest in BitmapCache
Browse files Browse the repository at this point in the history
  • Loading branch information
saket committed Sep 20, 2023
1 parent 8132987 commit 753754f
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.conflate
import kotlinx.coroutines.flow.consumeAsFlow
import kotlinx.coroutines.flow.distinctUntilChanged
Expand Down Expand Up @@ -43,7 +42,7 @@ internal class BitmapCache(
activeTiles.consumeAsFlow()
.distinctUntilChanged()
.throttleLatest(throttleEvery) // In case the image is animating its zoom.
.collectLatest { regions ->
.collect { regions ->
val tilesToLoad = regions.fastFilter { it !in cachedBitmaps.value }
tilesToLoad.fastForEach { region ->
val job = launch {
Expand Down

0 comments on commit 753754f

Please sign in to comment.