Clear out the etag from the repo table to "force" update.

We are not forcing an update, in the sense that we make the update
service run. Rather, we are ensuring that the next update wont return
after doing nothing, with the message "repos already up to date".
In this case, the repo metadata (and hence its etag) is the same,
but we made changes in the client to handle the metadata correctly.
Thus, we don't care that it hasn't changed, we want to update anyhow.
This commit is contained in:
Peter Serwylo 2015-07-30 17:30:58 +10:00
parent e1a8c42f9e
commit 4565f58a75

View File

@ -437,9 +437,20 @@ public class DBHelper extends SQLiteOpenHelper {
if (oldVersion < 50) { if (oldVersion < 50) {
Log.i(TAG, "Recalculating app icon URLs so that the newly added large icons will get updated."); Log.i(TAG, "Recalculating app icon URLs so that the newly added large icons will get updated.");
AppProvider.UpgradeHelper.updateIconUrls(context, db); AppProvider.UpgradeHelper.updateIconUrls(context, db);
clearRepoEtags(db);
} }
} }
/**
* By clearing the etags stored in the repo table, it means that next time the user updates
* their repos (either manually or on a scheduled task), they will update regardless of whether
* they have changed since last update or not.
*/
private void clearRepoEtags(SQLiteDatabase db) {
Log.i(TAG, "Clearing repo etags, so next update will not be skipped with \"Repos up to date\".");
db.execSQL("update " + TABLE_REPO + " set lastetag = NULL");
}
private void resetTransient(SQLiteDatabase db, int oldVersion) { private void resetTransient(SQLiteDatabase db, int oldVersion) {
// Before version 42, only transient info was stored in here. As of some time // Before version 42, only transient info was stored in here. As of some time
// just before 42 (F-Droid 0.60ish) it now has "ignore this version" info which // just before 42 (F-Droid 0.60ish) it now has "ignore this version" info which
@ -451,7 +462,7 @@ public class DBHelper extends SQLiteOpenHelper {
.putBoolean("triedEmptyUpdate", false).commit(); .putBoolean("triedEmptyUpdate", false).commit();
db.execSQL("drop table " + TABLE_APP); db.execSQL("drop table " + TABLE_APP);
db.execSQL("drop table " + TABLE_APK); db.execSQL("drop table " + TABLE_APK);
db.execSQL("update " + TABLE_REPO + " set lastetag = NULL"); clearRepoEtags(db);
createAppApk(db); createAppApk(db);
} }
} }