Skip to content

Commit

Permalink
fix(home): optimize home header fetching to be faster
Browse files Browse the repository at this point in the history
  • Loading branch information
rhenwinch committed Jun 26, 2024
1 parent 0098d22 commit 992b5f7
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.flixclusive.data.watch_history.WatchHistoryRepository
import com.flixclusive.domain.category.CategoryItemsProviderUseCase
import com.flixclusive.domain.provider.SourceLinksProviderUseCase
import com.flixclusive.domain.tmdb.FilmProviderUseCase
import com.flixclusive.model.provider.ProviderCatalog
import com.flixclusive.model.tmdb.Film
import com.flixclusive.model.tmdb.FilmSearchItem
import com.flixclusive.model.tmdb.Movie
Expand Down Expand Up @@ -183,6 +184,11 @@ class HomeItemsProviderUseCase @Inject constructor(
val randomIndex = Random.nextInt(_categories.value.size)
val category = _categories.value[randomIndex]

if (category is ProviderCatalog) {
traversedCategories[randomIndex] = category
continue
}

if (!traversedCategories.containsKey(randomIndex)) {
getCategoryItems(
category = category,
Expand Down

0 comments on commit 992b5f7

Please sign in to comment.