mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2025-02-08 09:04:36 +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) {
|
withContext(Dispatchers.Default) {
|
||||||
config.migrate(this@App)
|
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)
|
SSLProviderInstaller.install(applicationContext, this@App::buildHttp)
|
||||||
|
|
||||||
if (config.devModePassword != null)
|
if (config.devModePassword != null)
|
||||||
|
@ -43,6 +43,7 @@ class Config(db: AppDb) : BaseConfig(db) {
|
|||||||
var appInstalledTime by config<Long>(0L)
|
var appInstalledTime by config<Long>(0L)
|
||||||
var appRateSnackbarTime by config<Long>(0L)
|
var appRateSnackbarTime by config<Long>(0L)
|
||||||
var appVersion by config<Int>(BuildConfig.VERSION_CODE)
|
var appVersion by config<Int>(BuildConfig.VERSION_CODE)
|
||||||
|
var appVersionCore by config<Int>(0)
|
||||||
var validation by config<String?>(null, "buildValidation")
|
var validation by config<String?>(null, "buildValidation")
|
||||||
|
|
||||||
var archiverEnabled by config<Boolean>(true)
|
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 }
|
teams.filter { it.profileId == profile.id }.map { it.code }
|
||||||
)
|
)
|
||||||
val hash = user.toString().md5()
|
val hash = user.toString().md5()
|
||||||
if (hash == profile.config.hash)
|
if (hash == profile.config.hash && app.config.hash != "invalid")
|
||||||
return@mapNotNull null
|
return@mapNotNull null
|
||||||
return@mapNotNull user to profile.config
|
return@mapNotNull user to profile.config
|
||||||
}
|
}
|
||||||
|
@ -24,4 +24,7 @@ interface EndpointTimerDao {
|
|||||||
|
|
||||||
@Query("DELETE FROM endpointTimers WHERE profileId = :profileId")
|
@Query("DELETE FROM endpointTimers WHERE profileId = :profileId")
|
||||||
fun clear(profileId: Int)
|
fun clear(profileId: Int)
|
||||||
|
|
||||||
|
@Query("DELETE FROM endpointTimers")
|
||||||
|
fun clear()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user