diff --git a/TODO-before-release.md b/TODO-before-release.md index b755ba856..1a0d72a39 100644 --- a/TODO-before-release.md +++ b/TODO-before-release.md @@ -1,8 +1,5 @@ These issues are a must-fix before the next stable release: -* Move Ignore settings into separate table to not overwrite them upon repo - update - * Right after updating a repo, "Recently Updated" shows the apps correctly but the new apks don't show up on App Details until the whole app is restarted (or until the repos are wiped and re-downloaded) diff --git a/src/org/fdroid/fdroid/UpdateService.java b/src/org/fdroid/fdroid/UpdateService.java index ac7689b9a..915da5e82 100644 --- a/src/org/fdroid/fdroid/UpdateService.java +++ b/src/org/fdroid/fdroid/UpdateService.java @@ -55,6 +55,20 @@ public class UpdateService extends IntentService implements ProgressListener { super("UpdateService"); } + /** + * When an app already exists in the db, and we are updating it on the off chance that some + * values changed in the index, some fields should not be updated. Rather, they should be + * ignored, because they were explicitly set by the user, and hence can't be automatically + * overridden by the index. + * + * NOTE: In the future, these attributes will be moved to a join table, so that the app table + * is essentially completely transient, and can be nuked at any time. + */ + private static final String[] APP_FIELDS_TO_IGNORE = { + AppProvider.DataColumns.IGNORE_ALLUPDATES, + AppProvider.DataColumns.IGNORE_THISUPDATE + }; + // For receiving results from the UpdateService when we've told it to // update in response to a user request. public static class UpdateReceiver extends ResultReceiver { @@ -644,6 +658,11 @@ public class UpdateService extends IntentService implements ProgressListener { private ContentProviderOperation updateExistingApp(App app) { Uri uri = AppProvider.getContentUri(app); ContentValues values = app.toContentValues(); + for (String toIgnore : APP_FIELDS_TO_IGNORE) { + if (values.containsKey(toIgnore)) { + values.remove(toIgnore); + } + } return ContentProviderOperation.newUpdate(uri).withValues(values).build(); }