Open angelolloqui opened 2 years ago
For anyone interested on the same, I am for the time being executing this code just before doing the Phrase.setup
:
private fun fixOTACache() {
val preferences = getSharedPreferences("PREF_UNIQUE_ID", Context.MODE_PRIVATE)
val currentVersion = BuildConfig.VERSION_NAME
val lastClearVersion = preferences.getString("ota_cleared_cache_version", null)
if (lastClearVersion != currentVersion) {
File(filesDir, ".phrase_cache").deleteRecursively()
val keys = preferences.all.keys.filter { it != "PREF_UNIQUE_ID" }
preferences.edit().apply {
keys.forEach(::remove)
putString("ota_cleared_cache_version", currentVersion)
}.commit()
}
}
What it does is to delete the previous cached data when there is an app version update, because the downloaded OTA for that new version might be no longer applicable.
Hey @angelolloqui, thanks for raising this for the Android SDK. Right now the SDK does not validate the version constraints once the translations have been downloaded. We have this also as an improvement in our backlog and I'll let you know when this has been solved in the SDK
Hello @theSoenke , what is the status of this? have you implemented some kind of version control in the android sdk as mentioned here? thanks!
Hi @angelolloqui, unfortunately some other tasks have been taking priority for Android over this issue. But unless any unforeseen new tasks should take priority this will worked on as one of the next tasks
Hi, I am running into something similar to what I expressed in the iOS SDK some months ago regarding the behavior of min/max version constraints. Basically, this:
Can you confirm if the Android SDK is behaving this way on purpose? could you make an update like the one in iOS to make the versioning more consistent? otherwise, could it be possible to at least have a "clear cache" method or alike to reset the state after each app upgrade?
Thanks!