Notify changes after the updating is completed.

This commit is contained in:
2025-02-21 17:01:12 +08:00
parent 3efc4794d0
commit be0daddd82
2 changed files with 27 additions and 3 deletions

View File

@@ -797,7 +797,7 @@ class LocalFavoritesManager with ChangeNotifier {
}
}
void updateInfo(String folder, FavoriteItem comic) {
void updateInfo(String folder, FavoriteItem comic, [bool notify = true]) {
_db.execute("""
update "$folder"
set name = ?, author = ?, cover_path = ?, tags = ?
@@ -810,7 +810,9 @@ class LocalFavoritesManager with ChangeNotifier {
comic.id,
comic.type.value
]);
notifyListeners();
if (notify) {
notifyListeners();
}
}
String folderToJson(String folder) {
@@ -900,6 +902,18 @@ class LocalFavoritesManager with ChangeNotifier {
]);
}
void updateCheckTime(
String folder,
String id,
ComicType type,
) {
_db.execute("""
update "$folder"
set last_check_time = ?
where id == ? and type == ?;
""", [DateTime.now().millisecondsSinceEpoch, id, type.value]);
}
int countUpdates(String folder) {
return _db.select("""
select count(*) as c from "$folder"
@@ -961,4 +975,8 @@ class LocalFavoritesManager with ChangeNotifier {
void close() {
_db.dispose();
}
void notifyChanges() {
notifyListeners();
}
}