chore: delete action button (#20261)

This commit is contained in:
Alex 2025-07-26 13:51:18 -05:00 committed by GitHub
parent b14c768208
commit 3a5d82f790
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 162 additions and 9 deletions

View file

@ -230,6 +230,22 @@ class ActionNotifier extends Notifier<void> {
}
}
Future<ActionResult> trashRemoteAndDeleteLocal(ActionSource source) async {
final ids = _getOwnedRemoteIdsForSource(source);
final localIds = _getLocalIdsForSource(source);
try {
await _service.trashRemoteAndDeleteLocal(ids, localIds);
return ActionResult(count: ids.length, success: true);
} catch (error, stack) {
_logger.severe('Failed to delete assets', error, stack);
return ActionResult(
count: ids.length,
success: false,
error: error.toString(),
);
}
}
Future<ActionResult> deleteRemoteAndLocal(ActionSource source) async {
final ids = _getOwnedRemoteIdsForSource(source);
final localIds = _getLocalIdsForSource(source);
@ -249,8 +265,8 @@ class ActionNotifier extends Notifier<void> {
Future<ActionResult> deleteLocal(ActionSource source) async {
final ids = _getLocalIdsForSource(source);
try {
await _service.deleteLocal(ids);
return ActionResult(count: ids.length, success: true);
final deletedCount = await _service.deleteLocal(ids);
return ActionResult(count: deletedCount, success: true);
} catch (error, stack) {
_logger.severe('Failed to delete assets', error, stack);
return ActionResult(