Skip to content

Commit

Permalink
Fixed problem with Recent (isAll) album is both in exclude and includ…
Browse files Browse the repository at this point in the history
…e album list at the same time
  • Loading branch information
alextran1502 committed Aug 1, 2022
1 parent 03e7a25 commit f7dc916
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mobile/lib/modules/backup/providers/backup.provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ class BackupNotifier extends StateNotifier<BackUpState> {
}

void addExcludedAlbumForBackup(AssetPathEntity album) {
print("Excluded album: $album");

if (state.selectedBackupAlbums.contains(album)) {
removeAlbumForBackup(album);
}
Expand Down
12 changes: 12 additions & 0 deletions mobile/lib/modules/backup/ui/album_info_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down

0 comments on commit f7dc916

Please sign in to comment.