Created
August 6, 2020 15:52
-
-
Save shakalaca/7ed210b6b7561cc280a751fa9d036c90 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
class GithubRepository { | |
fun getSearchResultStream(query: String): Flow<PagingData<Repo>> { | |
val dbQuery = "%${query.replace(' ', '%')}%" | |
val pagingSourceFactory = { database.reposDao().reposByName(dbQuery)} | |
return Pager( | |
config = PagingConfig(pageSize = NETWORK_PAGE_SIZE, enablePlaceholders = false), | |
remoteMediator = GithubRemoteMediator(query, service, database), | |
pagingSourceFactory = pagingSourceFactory | |
).flow | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment