build: update remaining dependencies

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2021-02-08 13:29:58 +05:30
parent cdfa20b9a7
commit 020976e257
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
5 changed files with 19 additions and 9 deletions

View file

@ -4,10 +4,10 @@ import dev.msfjarvis.lobsters.injection.ApiModule
import dev.msfjarvis.lobsters.injection.MoshiModule import dev.msfjarvis.lobsters.injection.MoshiModule
import dev.msfjarvis.lobsters.util.TestUtils import dev.msfjarvis.lobsters.util.TestUtils
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking
import okhttp3.mockwebserver.Dispatcher import mockwebserver3.Dispatcher
import okhttp3.mockwebserver.MockResponse import mockwebserver3.MockResponse
import okhttp3.mockwebserver.MockWebServer import mockwebserver3.MockWebServer
import okhttp3.mockwebserver.RecordedRequest import mockwebserver3.RecordedRequest
import org.junit.AfterClass import org.junit.AfterClass
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue import org.junit.Assert.assertTrue

View file

@ -1,6 +1,7 @@
package dev.msfjarvis.lobsters.data.remote package dev.msfjarvis.lobsters.data.remote
import androidx.paging.PagingSource import androidx.paging.PagingSource
import androidx.paging.PagingState
import dev.msfjarvis.lobsters.data.local.LobstersPost import dev.msfjarvis.lobsters.data.local.LobstersPost
import dev.msfjarvis.lobsters.data.repo.LobstersRepository import dev.msfjarvis.lobsters.data.repo.LobstersRepository
import javax.inject.Inject import javax.inject.Inject
@ -26,4 +27,8 @@ class LobstersPagingSource @Inject constructor(
LoadResult.Error(e) LoadResult.Error(e)
} }
} }
override fun getRefreshKey(state: PagingState<Int, LobstersPost>): Int {
return state.pages.size + 1
}
} }

View file

@ -100,6 +100,10 @@ fun LobstersItem(
) )
CoilImage( CoilImage(
data = "${LobstersApi.BASE_URL}/${post.submitter_user.avatarUrl}", data = "${LobstersApi.BASE_URL}/${post.submitter_user.avatarUrl}",
contentDescription = stringResource(
R.string.avatar_content_description,
post.submitter_user.username
),
fadeIn = true, fadeIn = true,
requestBuilder = { requestBuilder = {
transformations(CircleCropTransformation()) transformations(CircleCropTransformation())

View file

@ -5,6 +5,7 @@
<string name="hottest_posts">Hottest</string> <string name="hottest_posts">Hottest</string>
<string name="saved_posts">Saved</string> <string name="saved_posts">Saved</string>
<string name="submitted_by">submitted by %1$s</string> <string name="submitted_by">submitted by %1$s</string>
<string name="avatar_content_description">%1$s\'s avatar</string>
<string name="add_to_saved_posts">Add to saved posts</string> <string name="add_to_saved_posts">Add to saved posts</string>
<string name="remove_from_saved_posts">Remove from saved posts</string> <string name="remove_from_saved_posts">Remove from saved posts</string>
</resources> </resources>

View file

@ -39,8 +39,8 @@ object Dependencies {
const val foundation = "androidx.compose.foundation:foundation:$COMPOSE_VERSION" const val foundation = "androidx.compose.foundation:foundation:$COMPOSE_VERSION"
const val foundationLayout = "androidx.compose.foundation:foundation-layout:$COMPOSE_VERSION" const val foundationLayout = "androidx.compose.foundation:foundation-layout:$COMPOSE_VERSION"
const val material = "androidx.compose.material:material:$COMPOSE_VERSION" const val material = "androidx.compose.material:material:$COMPOSE_VERSION"
const val navigation = "androidx.navigation:navigation-compose:1.0.0-alpha05" const val navigation = "androidx.navigation:navigation-compose:1.0.0-alpha06"
const val paging = "androidx.paging:paging-compose:1.0.0-alpha05" const val paging = "androidx.paging:paging-compose:1.0.0-alpha06"
const val runtime = "androidx.compose.runtime:runtime:$COMPOSE_VERSION" const val runtime = "androidx.compose.runtime:runtime:$COMPOSE_VERSION"
const val ui = "androidx.compose.ui:ui:$COMPOSE_VERSION" const val ui = "androidx.compose.ui:ui:$COMPOSE_VERSION"
const val uiUnit = "androidx.compose.ui:ui-unit:$COMPOSE_VERSION" const val uiUnit = "androidx.compose.ui:ui-unit:$COMPOSE_VERSION"
@ -62,13 +62,13 @@ object Dependencies {
object ThirdParty { object ThirdParty {
const val accompanist = "dev.chrisbanes.accompanist:accompanist-coil:0.4.2" const val accompanist = "dev.chrisbanes.accompanist:accompanist-coil:0.5.0"
object Moshi { object Moshi {
private const val version = "1.11.0" private const val version = "1.11.0"
const val lib = "com.squareup.moshi:moshi:$version" const val lib = "com.squareup.moshi:moshi:$version"
const val moshiMetadataReflect = "dev.zacsweers.moshix:moshi-metadata-reflect:0.7.1" const val moshiMetadataReflect = "dev.zacsweers.moshix:moshi-metadata-reflect:0.8.0"
} }
object Retrofit { object Retrofit {
@ -90,7 +90,7 @@ object Dependencies {
const val daggerHilt = "com.google.dagger:hilt-android-testing:$DAGGER_HILT_VERSION" const val daggerHilt = "com.google.dagger:hilt-android-testing:$DAGGER_HILT_VERSION"
const val junit = "junit:junit:4.13.1" const val junit = "junit:junit:4.13.1"
const val mockWebServer = "com.squareup.okhttp3:mockwebserver:4.6.0" const val mockWebServer = "com.squareup.okhttp3:mockwebserver3-junit4:5.0.0-alpha.2"
const val uiTest = "androidx.compose.ui:ui-test:$COMPOSE_VERSION" const val uiTest = "androidx.compose.ui:ui-test:$COMPOSE_VERSION"
object AndroidX { object AndroidX {