Skip to content

Commit

Permalink
Remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
mr3y-the-programmer committed Oct 20, 2023
1 parent a2f303e commit d24691c
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ interface DiscoverPagingFactory {

val soundtrackGamesPager: Pager<Int, Game>

fun createPagerForGamesWithQuery(searchQuery: String, filters: DiscoverFiltersState): Pager<Int, Game>
fun searchQueryBasedGamesPager(searchQuery: String, filters: DiscoverFiltersState): Pager<Int, Game>
}

@Inject
Expand Down Expand Up @@ -134,7 +134,7 @@ class DefaultDiscoverPagingFactory(
)
}

override fun createPagerForGamesWithQuery(
override fun searchQueryBasedGamesPager(
searchQuery: String,
filters: DiscoverFiltersState
): Pager<Int, Game> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class DiscoverViewModel(
Initial.gamesState
} else {
DiscoverStateGames.SearchQueryBasedGames(
games = pagingFactory.createPagerForGamesWithQuery(searchText, filtersState).flow.cachedIn(coroutineScope)
games = searchQueryBasedGamesPager(searchText, filtersState).flow.cachedIn(coroutineScope)
)
}
}.map {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.mr3y.ludi.shared.ui.presenter.model

import app.cash.paging.PagingData
import com.mr3y.ludi.shared.core.model.Game
import com.mr3y.ludi.shared.core.model.Result
import kotlinx.coroutines.flow.Flow

data class DiscoverState(
Expand Down Expand Up @@ -32,54 +31,6 @@ sealed interface DiscoverStateGames {
) : DiscoverStateGames
}

sealed interface TaggedGames {
val games: Flow<Result<List<Game>, Throwable>>

data class TrendingGames(
override val games: Flow<Result<List<Game>, Throwable>>
) : TaggedGames

data class TopRatedGames(
override val games: Flow<Result<List<Game>, Throwable>>
) : TaggedGames

data class BasedOnFavGenresGames(
override val games: Flow<Result<List<Game>, Throwable>>
) : TaggedGames

data class MultiplayerGames(
override val games: Flow<Result<List<Game>, Throwable>>
) : TaggedGames

data class FreeGames(
override val games: Flow<Result<List<Game>, Throwable>>
) : TaggedGames

data class StoryGames(
override val games: Flow<Result<List<Game>, Throwable>>
) : TaggedGames

data class BoardGames(
override val games: Flow<Result<List<Game>, Throwable>>
) : TaggedGames

data class ESportsGames(
override val games: Flow<Result<List<Game>, Throwable>>
) : TaggedGames

data class RaceGames(
override val games: Flow<Result<List<Game>, Throwable>>
) : TaggedGames

data class PuzzleGames(
override val games: Flow<Result<List<Game>, Throwable>>
) : TaggedGames

data class SoundtrackGames(
override val games: Flow<Result<List<Game>, Throwable>>
) : TaggedGames
}

data class DiscoverFiltersState(
val currentPage: Int,
val allPlatforms: Set<Platform>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.icons.Icons
Expand Down Expand Up @@ -68,7 +67,6 @@ import com.mr3y.ludi.shared.ui.presenter.model.DiscoverStateGames
import com.mr3y.ludi.shared.ui.presenter.model.Platform
import com.mr3y.ludi.shared.ui.presenter.model.Store
import com.mr3y.ludi.shared.ui.presenter.model.Tag
import com.mr3y.ludi.shared.ui.presenter.model.TaggedGames
import kotlinx.coroutines.flow.distinctUntilChanged

object DiscoverScreenTab : Screen, BottomBarTab {
Expand Down Expand Up @@ -429,22 +427,6 @@ fun SuggestedGamesPage(
}
}

private fun getLabelFor(taggedGames: TaggedGames): String {
return when (taggedGames) {
is TaggedGames.TrendingGames -> "Trending"
is TaggedGames.TopRatedGames -> "Top rated"
is TaggedGames.MultiplayerGames -> "Multiplayer"
is TaggedGames.BasedOnFavGenresGames -> "You might also like"
is TaggedGames.FreeGames -> "Free to play"
is TaggedGames.StoryGames -> "Story based"
is TaggedGames.BoardGames -> "Board"
is TaggedGames.ESportsGames -> "ESports"
is TaggedGames.RaceGames -> "Race"
is TaggedGames.PuzzleGames -> "Puzzle"
is TaggedGames.SoundtrackGames -> "SoundTrack"
}
}

@Composable
fun SearchQueryAndFilterPage(
searchResultsGames: DiscoverStateGames.SearchQueryBasedGames,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class DiscoverViewModelTest {
override val soundtrackGamesPager: Pager<Int, Game>
get() = TODO("Not yet implemented")

override fun createPagerForGamesWithQuery(
override fun searchQueryBasedGamesPager(
searchQuery: String,
filters: DiscoverFiltersState
): Pager<Int, Game> {
Expand Down

0 comments on commit d24691c

Please sign in to comment.