Skip to content

Commit

Permalink
SpotlessApply
Browse files Browse the repository at this point in the history
  • Loading branch information
chikoski committed Apr 19, 2024
1 parent 5c00cf3 commit 1e968b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package com.example.jetcaster.tv.ui.discover
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.jetcaster.core.data.database.model.toPlayerEpisode
import com.example.jetcaster.core.data.domain.FilterableCategoriesUseCase
import com.example.jetcaster.core.data.repository.CategoryStore
import com.example.jetcaster.core.data.repository.PodcastsRepository
import com.example.jetcaster.core.model.CategoryInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import com.example.jetcaster.tv.model.CategorySelection
import com.example.jetcaster.tv.model.CategorySelectionList
import com.example.jetcaster.tv.model.PodcastList
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
Expand All @@ -35,7 +36,6 @@ import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class SearchScreenViewModel @Inject constructor(
Expand All @@ -51,8 +51,12 @@ class SearchScreenViewModel @Inject constructor(
categoryStore.categoriesSortedByPodcastCount().map(CategoryInfoList::from)

private val searchConditionFlow =
combine(keywordFlow, selectedCategoryListFlow, categoryInfoListFlow) { keyword, selectedCategories, categories ->
val selected = selectedCategories.ifEmpty {
combine(
keywordFlow,
selectedCategoryListFlow,
categoryInfoListFlow
) { keyword, selectedCategories, categories ->
val selected = selectedCategories.ifEmpty {
categories
}
SearchCondition(keyword, selected)
Expand Down

0 comments on commit 1e968b8

Please sign in to comment.