From f7dc916e80ec579eae58635e6281a22796c3aaf7 Mon Sep 17 00:00:00 2001 From: Alex Tran Date: Sun, 31 Jul 2022 21:56:41 -0500 Subject: [PATCH] Fixed problem with Recent (isAll) album is both in exclude and include album list at the same time --- .../modules/backup/providers/backup.provider.dart | 2 ++ mobile/lib/modules/backup/ui/album_info_card.dart | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/mobile/lib/modules/backup/providers/backup.provider.dart b/mobile/lib/modules/backup/providers/backup.provider.dart index e71a8dbfd8..bdb9eb4dd0 100644 --- a/mobile/lib/modules/backup/providers/backup.provider.dart +++ b/mobile/lib/modules/backup/providers/backup.provider.dart @@ -77,6 +77,8 @@ class BackupNotifier extends StateNotifier { } void addExcludedAlbumForBackup(AssetPathEntity album) { + print("Excluded album: $album"); + if (state.selectedBackupAlbums.contains(album)) { removeAlbumForBackup(album); } diff --git a/mobile/lib/modules/backup/ui/album_info_card.dart b/mobile/lib/modules/backup/ui/album_info_card.dart index 370db0c3b2..b523c713b1 100644 --- a/mobile/lib/modules/backup/ui/album_info_card.dart +++ b/mobile/lib/modules/backup/ui/album_info_card.dart @@ -102,10 +102,12 @@ class AlbumInfoCard extends HookConsumerWidget { HapticFeedback.selectionClick(); if (isExcluded) { + // Remove from exclude album list ref .watch(backupProvider.notifier) .removeExcludedAlbumForBackup(albumInfo); } else { + // Add to exclude album list if (ref.watch(backupProvider).selectedBackupAlbums.length == 1 && ref .watch(backupProvider) @@ -120,6 +122,16 @@ class AlbumInfoCard extends HookConsumerWidget { return; } + if (albumInfo.id == 'isAll') { + ImmichToast.show( + context: context, + msg: 'Cannot exclude album contains all assets', + toastType: ToastType.error, + gravity: ToastGravity.BOTTOM, + ); + return; + } + ref .watch(backupProvider.notifier) .addExcludedAlbumForBackup(albumInfo);