Don't overwrite "ignore updates" settings on update.
For now, the UpdateService ignores these fields when updating from the index. There is no time that the index should specify what versions to be ignored. In the future, this will be done with a join table that stores info about what to ignore. Another future improvement should also be to make "App.toContentValues()" smarter. That is, make it only return values which have been set since the object was created. However this will add an overhead which may or may not be noticable.
This commit is contained in:
parent
799be52224
commit
68a719f48a
@ -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)
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user