mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
Notify changes after the updating is completed.
This commit is contained in:
@@ -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("""
|
_db.execute("""
|
||||||
update "$folder"
|
update "$folder"
|
||||||
set name = ?, author = ?, cover_path = ?, tags = ?
|
set name = ?, author = ?, cover_path = ?, tags = ?
|
||||||
@@ -810,7 +810,9 @@ class LocalFavoritesManager with ChangeNotifier {
|
|||||||
comic.id,
|
comic.id,
|
||||||
comic.type.value
|
comic.type.value
|
||||||
]);
|
]);
|
||||||
notifyListeners();
|
if (notify) {
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String folderToJson(String folder) {
|
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) {
|
int countUpdates(String folder) {
|
||||||
return _db.select("""
|
return _db.select("""
|
||||||
select count(*) as c from "$folder"
|
select count(*) as c from "$folder"
|
||||||
@@ -961,4 +975,8 @@ class LocalFavoritesManager with ChangeNotifier {
|
|||||||
void close() {
|
void close() {
|
||||||
_db.dispose();
|
_db.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void notifyChanges() {
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -603,7 +603,7 @@ void _updateFolderBase(
|
|||||||
tags: newTags,
|
tags: newTags,
|
||||||
);
|
);
|
||||||
|
|
||||||
LocalFavoritesManager().updateInfo(folder, item);
|
LocalFavoritesManager().updateInfo(folder, item, false);
|
||||||
|
|
||||||
var updateTime = newInfo.findUpdateTime();
|
var updateTime = newInfo.findUpdateTime();
|
||||||
if (updateTime != null && updateTime != c.updateTime) {
|
if (updateTime != null && updateTime != c.updateTime) {
|
||||||
@@ -613,6 +613,8 @@ void _updateFolderBase(
|
|||||||
c.type,
|
c.type,
|
||||||
updateTime,
|
updateTime,
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
LocalFavoritesManager().updateCheckTime(folder, c.id, c.type);
|
||||||
}
|
}
|
||||||
updated++;
|
updated++;
|
||||||
return;
|
return;
|
||||||
@@ -639,6 +641,10 @@ void _updateFolderBase(
|
|||||||
|
|
||||||
await Future.wait(futures);
|
await Future.wait(futures);
|
||||||
|
|
||||||
|
if (updated > 0) {
|
||||||
|
LocalFavoritesManager().notifyChanges();
|
||||||
|
}
|
||||||
|
|
||||||
stream.close();
|
stream.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user