A better update detection method, for now at least
This commit is contained in:
parent
bf8aa30a57
commit
adc4e0631e
@ -77,7 +77,8 @@ public class DB {
|
|||||||
public String installedVersion;
|
public String installedVersion;
|
||||||
|
|
||||||
// True if there are new versions (apks) that the user hasn't
|
// True if there are new versions (apks) that the user hasn't
|
||||||
// explicitly ignored.
|
// explicitly ignored. (We're currently not using the database
|
||||||
|
// field for this - we make the decision on the fly in getApps().
|
||||||
public boolean hasUpdates;
|
public boolean hasUpdates;
|
||||||
|
|
||||||
// Used internally for tracking during repo updates.
|
// Used internally for tracking during repo updates.
|
||||||
@ -220,7 +221,7 @@ public class DB {
|
|||||||
app.sourceURL = c.getString(c.getColumnIndex("sourceURL"));
|
app.sourceURL = c.getString(c.getColumnIndex("sourceURL"));
|
||||||
app.installedVersion = c.getString(c
|
app.installedVersion = c.getString(c
|
||||||
.getColumnIndex("installedVersion"));
|
.getColumnIndex("installedVersion"));
|
||||||
app.hasUpdates = c.getInt(c.getColumnIndex("hasUpdates")) == 1;
|
app.hasUpdates = false;
|
||||||
|
|
||||||
c2 = db.rawQuery("select * from " + TABLE_APK + " where "
|
c2 = db.rawQuery("select * from " + TABLE_APK + " where "
|
||||||
+ "id = '" + app.id + "' order by vercode desc", null);
|
+ "id = '" + app.id + "' order by vercode desc", null);
|
||||||
@ -258,6 +259,14 @@ public class DB {
|
|||||||
getUpdates(result);
|
getUpdates(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We'll say an application has updates if it's installed and the
|
||||||
|
// installed version is not the 'current' one.
|
||||||
|
for(App app : result) {
|
||||||
|
if(app.installedVersion != null && !app.installedVersion.equals(app.getCurrentVersion().version)) {
|
||||||
|
app.hasUpdates=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user