Skip to content

Commit

Permalink
Fix #5 Incorporate kotlin-result-retry
Browse files Browse the repository at this point in the history
  • Loading branch information
herrbert74 committed Dec 16, 2024
1 parent 6eaabb8 commit 549c8fe
Show file tree
Hide file tree
Showing 17 changed files with 411 additions and 234 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies {
"implementation"(libs.findLibrary("kotlinx.coroutines.core").get())
"implementation"(libs.findLibrary("kotlinx.serialization.core").get())
"implementation"(libs.findLibrary("kotlinResult.result").get())
"implementation"(libs.findLibrary("kotlinRetry").get())
"implementation"(libs.findLibrary("kotlinx.collections.immutable.jvm").get())
"api"(libs.findLibrary("squareUp.retrofit2.retrofit").get())
"implementation"(libs.findLibrary("squareUp.okhttp3.okhttp").get())
Expand Down
2 changes: 1 addition & 1 deletion config/detekt/default-detekt-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ style:
- '1'
- '2'
ignoreHashCodeFunction: true
ignorePropertyDeclaration: true
ignorePropertyDeclaration: false
ignoreLocalVariableDeclaration: false
ignoreConstantDeclaration: true
ignoreCompanionObjectPropertyDeclaration: true
Expand Down
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ junit = "4.13.2"
#jUnit5 = "5.10.2"
kotest = "5.9.1"
kotlinResult = "1.1.21"
kotlinRetry = "2.0.1"
kotlinx-collections = "0.3.8"
#koin = "3.5.3"
#ktor = "2.3.6"
Expand Down Expand Up @@ -305,6 +306,8 @@ detekt-compose = { module = "io.nlopez.compose.rules:detekt", version = "0.4.22"

kotlinResult-result = { module = "com.michael-bull.kotlin-result:kotlin-result", version.ref = "kotlinResult" }
kotlinResult-coroutines = { module = "com.michael-bull.kotlin-result:kotlin-result-coroutines", version.ref = "kotlinResult" }
kotlinRetry = { module = "com.michael-bull.kotlin-retry:kotlin-retry", version.ref = "kotlinRetry" }
#kotlinRetryResult = { module = "com.michael-bull.kotlin-retry:kotlin-retry-result", version.ref = "kotlinRetry" }

#view-collapsingToolbar = "me.onebone:toolbar-compose:2.3.5"
coil-base = "io.coil-kt:coil-base:2.7.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.zsoltbertalan.flickslate.movies.data.network.MoviesService
import com.zsoltbertalan.flickslate.movies.data.network.model.toMovieDetail
import com.zsoltbertalan.flickslate.movies.domain.api.MoviesRepository
import com.zsoltbertalan.flickslate.movies.domain.model.MovieDetail
import com.zsoltbertalan.flickslate.shared.data.getresult.backoffRetryPolicy
import com.zsoltbertalan.flickslate.shared.data.getresult.fetchCacheThenRemote
import com.zsoltbertalan.flickslate.shared.data.util.runCatchingApi
import com.zsoltbertalan.flickslate.shared.model.Movie
Expand Down Expand Up @@ -53,6 +54,7 @@ class MoviesAccessor @Inject constructor(
)
popularMoviesDataSource.insertPopularMovies(moviesReply, page)
},
retryPolicy = backoffRetryPolicy,
)
}

Expand All @@ -70,6 +72,7 @@ class MoviesAccessor @Inject constructor(
)
upcomingMoviesDataSource.insertUpcomingMovies(moviesReply, page)
},
retryPolicy = backoffRetryPolicy,
)
}

Expand All @@ -87,6 +90,7 @@ class MoviesAccessor @Inject constructor(
)
nowPlayingMoviesDataSource.insertNowPlayingMovies(moviesReply, page)
},
retryPolicy = backoffRetryPolicy,
)
}

Expand Down
6 changes: 5 additions & 1 deletion shared-data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies {
api(libs.google.dagger.core)
api(libs.inject)
implementation(libs.kotlinResult.result)
api(libs.kotlinRetry)
api(libs.kotlinx.collections.immutable.jvm)
api(libs.kotlinx.coroutines.core)
api(libs.kotlinx.serialization.core)
Expand Down Expand Up @@ -67,5 +68,8 @@ dependencies {

detektPlugins(libs.detekt.compose)

}

}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
compilerOptions.freeCompilerArgs.add("-opt-in=kotlin.contracts.ExperimentalContracts")
}

This file was deleted.

Loading

0 comments on commit 549c8fe

Please sign in to comment.