Don't save the URL of the update in the database
Each update must now be in updates.json to be downloaded. Since this file already stores the URL of each update and that the URL is not needed after the download, the URL entry can be removed from the database.
This commit is contained in:
@@ -37,7 +37,6 @@ public class UpdatesDbHelper extends SQLiteOpenHelper {
|
||||
public static final String COLUMN_NAME_PATH = "path";
|
||||
public static final String COLUMN_NAME_NAME = "name";
|
||||
public static final String COLUMN_NAME_DOWNLOAD_ID = "download_id";
|
||||
public static final String COLUMN_NAME_DOWNLOAD_URL = "download_url";
|
||||
public static final String COLUMN_NAME_TIMESTAMP = "timestamp";
|
||||
public static final String COLUMN_NAME_TYPE = "type";
|
||||
public static final String COLUMN_NAME_VERSION = "version";
|
||||
@@ -51,7 +50,6 @@ public class UpdatesDbHelper extends SQLiteOpenHelper {
|
||||
UpdateEntry.COLUMN_NAME_PATH + " TEXT," +
|
||||
UpdateEntry.COLUMN_NAME_NAME + " TEXT," +
|
||||
UpdateEntry.COLUMN_NAME_DOWNLOAD_ID + " TEXT NOT NULL UNIQUE," +
|
||||
UpdateEntry.COLUMN_NAME_DOWNLOAD_URL + " TEXT," +
|
||||
UpdateEntry.COLUMN_NAME_TIMESTAMP + " INTEGER," +
|
||||
UpdateEntry.COLUMN_NAME_TYPE + " TEXT," +
|
||||
UpdateEntry.COLUMN_NAME_VERSION + " TEXT," +
|
||||
@@ -84,7 +82,6 @@ public class UpdatesDbHelper extends SQLiteOpenHelper {
|
||||
values.put(UpdateEntry.COLUMN_NAME_PATH, update.getFile().getAbsolutePath());
|
||||
values.put(UpdateEntry.COLUMN_NAME_NAME, update.getName());
|
||||
values.put(UpdateEntry.COLUMN_NAME_DOWNLOAD_ID, update.getDownloadId());
|
||||
values.put(UpdateEntry.COLUMN_NAME_DOWNLOAD_URL, update.getDownloadUrl());
|
||||
values.put(UpdateEntry.COLUMN_NAME_TIMESTAMP, update.getTimestamp());
|
||||
values.put(UpdateEntry.COLUMN_NAME_TYPE, update.getType());
|
||||
values.put(UpdateEntry.COLUMN_NAME_VERSION, update.getVersion());
|
||||
@@ -99,7 +96,6 @@ public class UpdatesDbHelper extends SQLiteOpenHelper {
|
||||
values.put(UpdateEntry.COLUMN_NAME_PATH, update.getFile().getAbsolutePath());
|
||||
values.put(UpdateEntry.COLUMN_NAME_NAME, update.getName());
|
||||
values.put(UpdateEntry.COLUMN_NAME_DOWNLOAD_ID, update.getDownloadId());
|
||||
values.put(UpdateEntry.COLUMN_NAME_DOWNLOAD_URL, update.getDownloadUrl());
|
||||
values.put(UpdateEntry.COLUMN_NAME_TIMESTAMP, update.getTimestamp());
|
||||
values.put(UpdateEntry.COLUMN_NAME_TYPE, update.getType());
|
||||
values.put(UpdateEntry.COLUMN_NAME_VERSION, update.getVersion());
|
||||
@@ -165,7 +161,6 @@ public class UpdatesDbHelper extends SQLiteOpenHelper {
|
||||
UpdateEntry.COLUMN_NAME_PATH,
|
||||
UpdateEntry.COLUMN_NAME_NAME,
|
||||
UpdateEntry.COLUMN_NAME_DOWNLOAD_ID,
|
||||
UpdateEntry.COLUMN_NAME_DOWNLOAD_URL,
|
||||
UpdateEntry.COLUMN_NAME_TIMESTAMP,
|
||||
UpdateEntry.COLUMN_NAME_TYPE,
|
||||
UpdateEntry.COLUMN_NAME_VERSION,
|
||||
@@ -185,8 +180,6 @@ public class UpdatesDbHelper extends SQLiteOpenHelper {
|
||||
update.setName(cursor.getString(index));
|
||||
index = cursor.getColumnIndex(UpdateEntry.COLUMN_NAME_DOWNLOAD_ID);
|
||||
update.setDownloadId(cursor.getString(index));
|
||||
index = cursor.getColumnIndex(UpdateEntry.COLUMN_NAME_DOWNLOAD_URL);
|
||||
update.setDownloadUrl(cursor.getString(index));
|
||||
index = cursor.getColumnIndex(UpdateEntry.COLUMN_NAME_TIMESTAMP);
|
||||
update.setTimestamp(cursor.getLong(index));
|
||||
index = cursor.getColumnIndex(UpdateEntry.COLUMN_NAME_TYPE);
|
||||
|
||||
@@ -320,6 +320,7 @@ public class UpdaterController implements UpdaterControllerInt {
|
||||
Log.d(TAG, "Download (" + update.getDownloadId() + ") already added");
|
||||
UpdateDownload updateAdded = mDownloads.get(update.getDownloadId()).mUpdate;
|
||||
updateAdded.setAvailableOnline(availableOnline && updateAdded.getAvailableOnline());
|
||||
updateAdded.setDownloadUrl(update.getDownloadUrl());
|
||||
return false;
|
||||
}
|
||||
if (!fixUpdateStatus(update) && !availableOnline) {
|
||||
|
||||
Reference in New Issue
Block a user