mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
When adding a favorite, also add the update time.
This commit is contained in:
@@ -462,7 +462,8 @@ class LocalFavoritesManager with ChangeNotifier {
|
||||
|
||||
/// add comic to a folder.
|
||||
/// return true if success, false if already exists
|
||||
bool addComic(String folder, FavoriteItem comic, [int? order]) {
|
||||
bool addComic(String folder, FavoriteItem comic,
|
||||
[int? order, String? updateTime]) {
|
||||
_modifiedAfterLastCache = true;
|
||||
if (!existsFolder(folder)) {
|
||||
throw Exception("Folder does not exists");
|
||||
@@ -501,6 +502,18 @@ class LocalFavoritesManager with ChangeNotifier {
|
||||
values (?, ?, ?, ?, ?, ?, ?, ?, ?);
|
||||
""", [...params, minValue(folder) - 1]);
|
||||
}
|
||||
if (updateTime != null) {
|
||||
var columns = _db.select("""
|
||||
pragma table_info("$folder");
|
||||
""");
|
||||
if (columns.any((element) => element["name"] == "last_update_time")) {
|
||||
_db.execute("""
|
||||
update "$folder"
|
||||
set last_update_time = ?
|
||||
where id == ? and type == ?;
|
||||
""", [updateTime, comic.id, comic.type.value]);
|
||||
}
|
||||
}
|
||||
notifyListeners();
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user