diff --git a/app/lib/entity/collection/adapter/nc_album.dart b/app/lib/entity/collection/adapter/nc_album.dart index 96dfc898..2a1a97d3 100644 --- a/app/lib/entity/collection/adapter/nc_album.dart +++ b/app/lib/entity/collection/adapter/nc_album.dart @@ -53,7 +53,14 @@ class CollectionNcAlbumAdapter ); return items.map((i) { final f = found.firstWhereOrNull((e) => e.fdId == i.fileId); - return CollectionFileItemNcAlbumItemAdapter(i, f); + return CollectionFileItemNcAlbumItemAdapter( + i, + // retain the path such that it is correct recognized as part of an + // album + f?.copyWith( + fdPath: i.path, + ), + ); }).toList(); }); } diff --git a/app/lib/entity/file_descriptor.dart b/app/lib/entity/file_descriptor.dart index d93a8513..ac5de1c8 100644 --- a/app/lib/entity/file_descriptor.dart +++ b/app/lib/entity/file_descriptor.dart @@ -1,3 +1,4 @@ +import 'package:copy_with/copy_with.dart'; import 'package:equatable/equatable.dart'; import 'package:nc_photos/entity/file.dart'; import 'package:np_common/type.dart'; @@ -18,6 +19,7 @@ int compareFileDescriptorDateTimeDescending( } } +@genCopyWith @toString class FileDescriptor with EquatableMixin { const FileDescriptor({ diff --git a/app/lib/entity/file_descriptor.g.dart b/app/lib/entity/file_descriptor.g.dart index 06816861..a606130c 100644 --- a/app/lib/entity/file_descriptor.g.dart +++ b/app/lib/entity/file_descriptor.g.dart @@ -2,6 +2,56 @@ part of 'file_descriptor.dart'; +// ************************************************************************** +// CopyWithLintRuleGenerator +// ************************************************************************** + +// ignore_for_file: library_private_types_in_public_api, duplicate_ignore + +// ************************************************************************** +// CopyWithGenerator +// ************************************************************************** + +abstract class $FileDescriptorCopyWithWorker { + FileDescriptor call( + {String? fdPath, + int? fdId, + String? fdMime, + bool? fdIsArchived, + bool? fdIsFavorite, + DateTime? fdDateTime}); +} + +class _$FileDescriptorCopyWithWorkerImpl + implements $FileDescriptorCopyWithWorker { + _$FileDescriptorCopyWithWorkerImpl(this.that); + + @override + FileDescriptor call( + {dynamic fdPath, + dynamic fdId, + dynamic fdMime = copyWithNull, + dynamic fdIsArchived, + dynamic fdIsFavorite, + dynamic fdDateTime}) { + return FileDescriptor( + fdPath: fdPath as String? ?? that.fdPath, + fdId: fdId as int? ?? that.fdId, + fdMime: fdMime == copyWithNull ? that.fdMime : fdMime as String?, + fdIsArchived: fdIsArchived as bool? ?? that.fdIsArchived, + fdIsFavorite: fdIsFavorite as bool? ?? that.fdIsFavorite, + fdDateTime: fdDateTime as DateTime? ?? that.fdDateTime); + } + + final FileDescriptor that; +} + +extension $FileDescriptorCopyWith on FileDescriptor { + $FileDescriptorCopyWithWorker get copyWith => _$copyWith; + $FileDescriptorCopyWithWorker get _$copyWith => + _$FileDescriptorCopyWithWorkerImpl(this); +} + // ************************************************************************** // ToStringGenerator // **************************************************************************