-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 서버의 데이터베이스 버전이 달라지면 디스크 캐시를 리프레쉬한다
- Loading branch information
Showing
5 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
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
11 changes: 11 additions & 0 deletions
11
android/data/src/main/java/poke/rogue/helper/data/datasource/LocalVersionDataSource.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package poke.rogue.helper.data.datasource | ||
|
||
import poke.rogue.helper.local.datastore.VersionDataStore | ||
|
||
class LocalVersionDataSource( | ||
private val versionDataStore: VersionDataStore, | ||
) { | ||
fun databaseVersion() = versionDataStore.databaseVersion() | ||
|
||
suspend fun saveDatabaseVersion(version: Int) = versionDataStore.saveDatabaseVersion(version) | ||
} |
17 changes: 17 additions & 0 deletions
17
android/data/src/main/java/poke/rogue/helper/data/datasource/RemoteVersionDataSource.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package poke.rogue.helper.data.datasource | ||
|
||
import poke.rogue.helper.analytics.AnalyticsLogger | ||
import poke.rogue.helper.data.exception.getOrThrow | ||
import poke.rogue.helper.data.exception.onFailure | ||
import poke.rogue.helper.remote.service.VersionService | ||
|
||
class RemoteVersionDataSource( | ||
private val versionService: VersionService, | ||
private val logger: AnalyticsLogger, | ||
) { | ||
suspend fun databaseVersion(): Int = | ||
versionService.databaseVersion() | ||
.onFailure { | ||
logger.logError(throwable, "RemoteVersionDataSource - databaseVersion() 에서 발생") | ||
}.getOrThrow().version | ||
} |
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
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