From c66964b18057dba131005ff92a5ce9ed15edfee8 Mon Sep 17 00:00:00 2001 From: Vincent Velociter Date: Thu, 27 Feb 2020 10:13:28 +0100 Subject: [PATCH] Fix cache delete on android from 6.x to 7.x --- .../java/org/lichess/mobileapp/MainActivity.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/android/app/src/main/java/org/lichess/mobileapp/MainActivity.java b/android/app/src/main/java/org/lichess/mobileapp/MainActivity.java index d24c800859..1e12e3d761 100644 --- a/android/app/src/main/java/org/lichess/mobileapp/MainActivity.java +++ b/android/app/src/main/java/org/lichess/mobileapp/MainActivity.java @@ -125,16 +125,16 @@ private void openGooglePlayPage(String packageName) throws android.content.Activ } private void versionUpdateActions() { - // fix home quick setup loading bug when going from 6.x to 7.x - if (BuildConfig.VERSION_CODE == 7000019) { - SharedPreferences prefs = getSharedPreferences("LiVersionCheck", Context.MODE_PRIVATE); - SharedPreferences.Editor editor = prefs.edit(); - int previousVersionCode = prefs.getInt("LAST_VERSION_CODE", 0); - if (BuildConfig.VERSION_CODE > previousVersionCode) { + SharedPreferences prefs = getSharedPreferences("LiVersionCheck", Context.MODE_PRIVATE); + int previousVersionCode = prefs.getInt("LAST_VERSION_CODE", 0); + if (BuildConfig.VERSION_CODE > previousVersionCode) { + // fix home quick setup loading bug when going from 6.x to 7.x + if (previousVersionCode == 0) { deleteDir(getApplicationContext().getCacheDir()); - editor.putInt("LAST_VERSION_CODE", BuildConfig.VERSION_CODE); - editor.apply(); } + SharedPreferences.Editor editor = prefs.edit(); + editor.putInt("LAST_VERSION_CODE", BuildConfig.VERSION_CODE); + editor.apply(); } }