Skip to content

Commit

Permalink
Hardcode fallback minimum repodata timestamp
Browse files Browse the repository at this point in the history
Since Accrescent is in pre-alpha we'll just update this value before
every release. When it hits productios we'll update in on a more regular
basis.

Closes #50.
  • Loading branch information
lberrymage committed Jul 18, 2022
1 parent 569209f commit 13a4d6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Expand Up @@ -2,3 +2,5 @@ package app.accrescent.client.data

const val ROOT_DOMAIN = "accrescent.app"
const val REPOSITORY_URL = "https://store.${ROOT_DOMAIN}"

const val MIN_TIMESTAMP: Long = 1656492271
Expand Up @@ -23,7 +23,8 @@ class RepoDataRepository @Inject constructor(
suspend fun fetchRepoData() {
val repoData = repoDataRemoteDataSource.fetchRepoData()
val timestampKey = longPreferencesKey("timestamp")
val storedTimestamp = timestampDataStore.data.map { it[timestampKey] ?: 0 }.first()
val storedTimestamp =
timestampDataStore.data.map { it[timestampKey] ?: MIN_TIMESTAMP }.first()

if (repoData.timestamp >= storedTimestamp) {
timestampDataStore.edit { it[timestampKey] = repoData.timestamp }
Expand Down

0 comments on commit 13a4d6d

Please sign in to comment.