Skip to content

Commit

Permalink
fix unchecked integrity when local cache used
Browse files Browse the repository at this point in the history
  • Loading branch information
GrakovNe committed Nov 10, 2024
1 parent 2d49bd2 commit 194c0ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
applicationId = "org.grakovne.lissen"
minSdk = 28
targetSdk = 35
versionCode = 28
versionName = "1.0.27"
versionCode = 29
versionName = "1.0.28"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ class LocalCacheRepository @Inject constructor(

suspend fun fetchBook(bookId: String) = cachedBookRepository
.fetchBook(bookId)
?.takeIf { checkBookIntegrity(bookId) }

suspend fun fetchCachedBookIds() = cachedBookRepository.fetchCachedBooksIds()
suspend fun fetchCachedBookIds() = cachedBookRepository
.fetchCachedBooksIds()
.filter { checkBookIntegrity(it) }

private suspend fun checkBookIntegrity(bookId: String): Boolean {
val book = cachedBookRepository.fetchBook(bookId) ?: return false
Expand Down

0 comments on commit 194c0ef

Please sign in to comment.