mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
Improve performance for clearing history.
This commit is contained in:
@@ -306,7 +306,9 @@ class HistoryManager with ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearUnfavoritedHistory() {
|
void clearUnfavoritedHistory() {
|
||||||
|
_db.execute('BEGIN TRANSACTION;');
|
||||||
|
try {
|
||||||
final idAndTypes = _db.select("""
|
final idAndTypes = _db.select("""
|
||||||
select id, type from history;
|
select id, type from history;
|
||||||
""");
|
""");
|
||||||
@@ -320,9 +322,14 @@ class HistoryManager with ChangeNotifier {
|
|||||||
""", [id, type.value]);
|
""", [id, type.value]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateCache();
|
_db.execute('COMMIT;');
|
||||||
notifyListeners();
|
} catch (e) {
|
||||||
|
_db.execute('ROLLBACK;');
|
||||||
|
rethrow;
|
||||||
}
|
}
|
||||||
|
updateCache();
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
void remove(String id, ComicType type) async {
|
void remove(String id, ComicType type) async {
|
||||||
_db.execute("""
|
_db.execute("""
|
||||||
|
@@ -147,6 +147,7 @@ class _HistoryPageState extends State<HistoryPage> {
|
|||||||
},
|
},
|
||||||
child: Text('Clear Unfavorited'.tl),
|
child: Text('Clear Unfavorited'.tl),
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
Button.filled(
|
Button.filled(
|
||||||
color: context.colorScheme.error,
|
color: context.colorScheme.error,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
Reference in New Issue
Block a user