refactor: extract number to a constant
All checks were successful
Android Unit Tests / tests (push) Successful in 7m6s

This commit is contained in:
Leonardo Murça 2025-07-20 16:57:15 -03:00
parent 1874f3a573
commit a7c31bc48b

View file

@ -10,6 +10,7 @@ import kotlinx.coroutines.launch
import xyz.leomurca.csgomatches.domain.model.Match import xyz.leomurca.csgomatches.domain.model.Match
import xyz.leomurca.csgomatches.domain.model.Resource import xyz.leomurca.csgomatches.domain.model.Resource
import xyz.leomurca.csgomatches.domain.repository.MatchRepository import xyz.leomurca.csgomatches.domain.repository.MatchRepository
import xyz.leomurca.csgomatches.utils.ApiDefaults.ITEMS_PER_PAGE
import javax.inject.Inject import javax.inject.Inject
@HiltViewModel @HiltViewModel
@ -54,14 +55,13 @@ class MatchesViewModel @Inject constructor(
_uiState.value = current.copy( _uiState.value = current.copy(
matches = current.matches + newMatches, matches = current.matches + newMatches,
isPaginating = false, isPaginating = false,
endReached = newMatches.size < 20 endReached = newMatches.size < ITEMS_PER_PAGE
) )
isLoadingNextPage = false isLoadingNextPage = false
} }
} }
sealed class MatchesUiState { sealed class MatchesUiState {
data class Success( data class Success(
val matches: List<Match>, val matches: List<Match>,