From 67a4c68734aa901a9b2f934d571192ec3d110164 Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Sun, 17 Sep 2023 20:15:18 +0200 Subject: [PATCH] #753 fixed workflow when moving to an album with insufficient storage --- CHANGELOG.md | 1 + lib/widgets/common/action_mixins/entry_storage.dart | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10e0f4462..5cc4886e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### Fixed - crash when cataloguing some videos +- workflow when moving to an album with insufficient storage ## [v1.9.4] - 2023-09-13 diff --git a/lib/widgets/common/action_mixins/entry_storage.dart b/lib/widgets/common/action_mixins/entry_storage.dart index 171d3341f..3cb84cb70 100644 --- a/lib/widgets/common/action_mixins/entry_storage.dart +++ b/lib/widgets/common/action_mixins/entry_storage.dart @@ -154,9 +154,10 @@ mixin EntryStorageMixin on FeedbackMixin, PermissionAwareMixin, SizeAwareMixin { final originAlbums = entries.map((e) => e.directory).whereNotNull().toSet(); if ({MoveType.move, MoveType.toBin}.contains(moveType) && !await checkStoragePermissionForAlbums(context, originAlbums, entries: entries)) return; - await Future.forEach(destinationAlbums, (destinationAlbum) async { - if (!await checkFreeSpaceForMove(context, entries, destinationAlbum, moveType)) return; - }); + final hasEnoughSpaceByDestination = await Future.wait(destinationAlbums.map((destinationAlbum) { + return checkFreeSpaceForMove(context, entries, destinationAlbum, moveType); + })); + if (hasEnoughSpaceByDestination.any((v) => !v)) return; final l10n = context.l10n; var nameConflictStrategy = NameConflictStrategy.rename;