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:
@@ -307,6 +307,8 @@ class HistoryManager with ChangeNotifier {
|
||||
}
|
||||
|
||||
void clearUnfavoritedHistory() {
|
||||
_db.execute('BEGIN TRANSACTION;');
|
||||
try {
|
||||
final idAndTypes = _db.select("""
|
||||
select id, type from history;
|
||||
""");
|
||||
@@ -320,6 +322,11 @@ class HistoryManager with ChangeNotifier {
|
||||
""", [id, type.value]);
|
||||
}
|
||||
}
|
||||
_db.execute('COMMIT;');
|
||||
} catch (e) {
|
||||
_db.execute('ROLLBACK;');
|
||||
rethrow;
|
||||
}
|
||||
updateCache();
|
||||
notifyListeners();
|
||||
}
|
||||
|
@@ -147,6 +147,7 @@ class _HistoryPageState extends State<HistoryPage> {
|
||||
},
|
||||
child: Text('Clear Unfavorited'.tl),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Button.filled(
|
||||
color: context.colorScheme.error,
|
||||
onPressed: () {
|
||||
|
Reference in New Issue
Block a user