Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Refactor delete progress calculation in DeleteEmptyAlbums component

AmanRajSinghMourya605f407e755a
diff --git a/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart b/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart
index 5a2548b872..53186ee8e3 100644
--- a/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart
+++ b/mobile/apps/photos/lib/ui/viewer/actions/delete_empty_albums.dart
@@ -147,14 +147,18 @@ class _DeleteEmptyAlbumsState extends State<DeleteEmptyAlbums> {
(c) => !c.type.canDelete || idToFileTimeStamp.containsKey(c.id),
);
int failedCount = 0;
- for (int i = 0; i < collections.length; i++) {
+ final int totalCount = collections.length;
+ final int totalDigits = totalCount.toString().length;
+
+ for (int i = 0; i < totalCount; i++) {
if (mounted && !_isCancelled) {
- final String currentlyDeleting = (i + 1)
- .toString()
- .padLeft(collections.length.toString().length, '0');
+ final int current = i + 1;
+ final String currentlyDeleting =
+ current.toString().padLeft(totalDigits, '0');
+
_deleteProgress.value = AppLocalizations.of(context).deleteProgress(
currentlyDeleting: currentlyDeleting,
- totalCount: collections.length,
+ totalCount: totalCount,
);
try {
await CollectionsService.instance.trashEmptyCollection(