Created
June 6, 2021 09:21
-
-
Save annchar/2d8dea860d8630bb55b2772d0b7cbad0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface CryptoListRepository { | |
suspend fun getCryptoList(): LiveData<PagingData<CryptoItemResponse>> | |
} | |
class CryptoRepositoryImpl( | |
private val service: APIService, | |
private val mapper: CryptoListMapper | |
) : CryptoListRepository { | |
override suspend fun getCryptoList(): LiveData<PagingData<CryptoItemResponse>> { | |
return Pager( | |
config = PagingConfig( | |
pageSize = NETWORK_PAGE_SIZE, | |
enablePlaceholders = false | |
), | |
pagingSourceFactory = { | |
CryptoListPagingSource(service, mapper) | |
} | |
).liveData | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment