mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-02-08 00:54:37 +01:00
[App] Force full sync on update
This commit is contained in:
parent
aeecc48639
commit
cac98ee3d4
@ -241,6 +241,14 @@ class App : MultiDexApplication(), Configuration.Provider, CoroutineScope {
|
||||
withContext(Dispatchers.Default) {
|
||||
config.migrate(this@App)
|
||||
|
||||
if (config.appVersionCore < BuildConfig.VERSION_CODE) {
|
||||
// force syncing all endpoints on update
|
||||
db.endpointTimerDao().clear()
|
||||
config.sync.lastAppSync = 0L
|
||||
config.hash = "invalid"
|
||||
config.appVersionCore = BuildConfig.VERSION_CODE
|
||||
}
|
||||
|
||||
SSLProviderInstaller.install(applicationContext, this@App::buildHttp)
|
||||
|
||||
if (config.devModePassword != null)
|
||||
|
@ -43,6 +43,7 @@ class Config(db: AppDb) : BaseConfig(db) {
|
||||
var appInstalledTime by config<Long>(0L)
|
||||
var appRateSnackbarTime by config<Long>(0L)
|
||||
var appVersion by config<Int>(BuildConfig.VERSION_CODE)
|
||||
var appVersionCore by config<Int>(0)
|
||||
var validation by config<String?>(null, "buildValidation")
|
||||
|
||||
var archiverEnabled by config<Boolean>(true)
|
||||
|
@ -206,7 +206,7 @@ class SzkolnyApi(val app: App) : CoroutineScope {
|
||||
teams.filter { it.profileId == profile.id }.map { it.code }
|
||||
)
|
||||
val hash = user.toString().md5()
|
||||
if (hash == profile.config.hash)
|
||||
if (hash == profile.config.hash && app.config.hash != "invalid")
|
||||
return@mapNotNull null
|
||||
return@mapNotNull user to profile.config
|
||||
}
|
||||
|
@ -24,4 +24,7 @@ interface EndpointTimerDao {
|
||||
|
||||
@Query("DELETE FROM endpointTimers WHERE profileId = :profileId")
|
||||
fun clear(profileId: Int)
|
||||
|
||||
@Query("DELETE FROM endpointTimers")
|
||||
fun clear()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user