1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-25 10:43:13 +02:00

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) { void addExcludedAlbumForBackup(AssetPathEntity album) {
print("Excluded album: $album");
if (state.selectedBackupAlbums.contains(album)) { if (state.selectedBackupAlbums.contains(album)) {
removeAlbumForBackup(album); removeAlbumForBackup(album);
} }

View File

@ -102,10 +102,12 @@ class AlbumInfoCard extends HookConsumerWidget {
HapticFeedback.selectionClick(); HapticFeedback.selectionClick();
if (isExcluded) { if (isExcluded) {
// Remove from exclude album list
ref ref
.watch(backupProvider.notifier) .watch(backupProvider.notifier)
.removeExcludedAlbumForBackup(albumInfo); .removeExcludedAlbumForBackup(albumInfo);
} else { } else {
// Add to exclude album list
if (ref.watch(backupProvider).selectedBackupAlbums.length == 1 && if (ref.watch(backupProvider).selectedBackupAlbums.length == 1 &&
ref ref
.watch(backupProvider) .watch(backupProvider)
@ -120,6 +122,16 @@ class AlbumInfoCard extends HookConsumerWidget {
return; return;
} }
if (albumInfo.id == 'isAll') {
ImmichToast.show(
context: context,
msg: 'Cannot exclude album contains all assets',
toastType: ToastType.error,
gravity: ToastGravity.BOTTOM,
);
return;
}
ref ref
.watch(backupProvider.notifier) .watch(backupProvider.notifier)
.addExcludedAlbumForBackup(albumInfo); .addExcludedAlbumForBackup(albumInfo);