feat: adjust changelog logic
Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
parent
9f1916d438
commit
016fb34ee5
|
|
@ -1,7 +1,6 @@
|
||||||
package chat.revolt.internals
|
package chat.revolt.internals
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import chat.revolt.BuildConfig
|
|
||||||
import chat.revolt.api.REVOLT_KJBOOK
|
import chat.revolt.api.REVOLT_KJBOOK
|
||||||
import chat.revolt.api.RevoltHttp
|
import chat.revolt.api.RevoltHttp
|
||||||
import chat.revolt.api.RevoltJson
|
import chat.revolt.api.RevoltJson
|
||||||
|
|
@ -107,17 +106,14 @@ class Changelogs(val context: Context, val kvStorage: KVStorage? = null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
val latest = getLatestChangelog().version.code
|
val latest = getLatestChangelog().version.code
|
||||||
val appVersion = BuildConfig.VERSION_CODE
|
val lastRead = kvStorage.get("latestChangelogRead")
|
||||||
|
|
||||||
val appIsNewerThanLatestServerChangelog = appVersion > latest
|
if (lastRead == null) {
|
||||||
|
return false
|
||||||
// If the app is newer than the latest server changelog
|
|
||||||
if (appIsNewerThanLatestServerChangelog) {
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, check if the latest changelog has been read
|
// If the last read changelog is >= the latest, it has been read
|
||||||
return kvStorage.get("latestChangelogRead") == latest.toString()
|
return lastRead.toLong() >= latest
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun markAsSeen() {
|
suspend fun markAsSeen() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue