Fixed problem with Recent (isAll) album is both in exclude and include album list at the same time

This commit is contained in:
Alex Tran 2022-07-31 21:56:41 -05:00
parent 03e7a254a2
commit f7dc916e80
2 changed files with 14 additions and 0 deletions

View file

@ -77,6 +77,8 @@ class BackupNotifier extends StateNotifier<BackUpState> {
}
void addExcludedAlbumForBackup(AssetPathEntity album) {
print("Excluded album: $album");
if (state.selectedBackupAlbums.contains(album)) {
removeAlbumForBackup(album);
}

View file

@ -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);