app: cleanups

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2021-01-31 15:06:18 +05:30
parent 7c8cbc4b3f
commit 49d9ceb73a
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
2 changed files with 3 additions and 3 deletions

View file

@ -15,9 +15,9 @@ class LobstersPagingSource @Inject constructor(
override suspend fun load(params: LoadParams<Int>): LoadResult<Int, LobstersPost> {
return try {
val page = params.key ?: 1
val posts = lobstersApi.getHottestPosts(page).mapIndexed { index, post ->
val posts = lobstersApi.getHottestPosts(page).map { post ->
val isSaved = lobstersRepository.isPostSaved(post.short_id)
return@mapIndexed post.copy(is_saved = isSaved)
post.copy(is_saved = isSaved)
}
LoadResult.Page(

View file

@ -46,7 +46,7 @@ class LobstersViewModel @Inject constructor(
}
fun invalidateSource() {
source?.invalidate()
source.invalidate()
}
private fun savePost(post: LobstersPost) {