2022-04-23 19:08:45 -07:00
|
|
|
import 'package:collection/collection.dart';
|
2022-11-08 10:00:24 -07:00
|
|
|
import 'package:immich_mobile/shared/models/asset.dart';
|
2022-04-23 19:08:45 -07:00
|
|
|
|
|
|
|
class AssetSelectionState {
|
|
|
|
final Set<String> selectedMonths;
|
2022-11-08 10:00:24 -07:00
|
|
|
final Set<Asset> selectedNewAssetsForAlbum;
|
|
|
|
final Set<Asset> selectedAdditionalAssetsForAlbum;
|
|
|
|
final Set<Asset> selectedAssetsInAlbumViewer;
|
2022-04-23 19:08:45 -07:00
|
|
|
final bool isMultiselectEnable;
|
|
|
|
|
|
|
|
/// Indicate the asset selection page is navigated from existing album
|
|
|
|
final bool isAlbumExist;
|
|
|
|
AssetSelectionState({
|
|
|
|
required this.selectedMonths,
|
|
|
|
required this.selectedNewAssetsForAlbum,
|
|
|
|
required this.selectedAdditionalAssetsForAlbum,
|
|
|
|
required this.selectedAssetsInAlbumViewer,
|
|
|
|
required this.isMultiselectEnable,
|
|
|
|
required this.isAlbumExist,
|
|
|
|
});
|
|
|
|
|
|
|
|
AssetSelectionState copyWith({
|
|
|
|
Set<String>? selectedMonths,
|
2022-11-08 10:00:24 -07:00
|
|
|
Set<Asset>? selectedNewAssetsForAlbum,
|
|
|
|
Set<Asset>? selectedAdditionalAssetsForAlbum,
|
|
|
|
Set<Asset>? selectedAssetsInAlbumViewer,
|
2022-04-23 19:08:45 -07:00
|
|
|
bool? isMultiselectEnable,
|
|
|
|
bool? isAlbumExist,
|
|
|
|
}) {
|
|
|
|
return AssetSelectionState(
|
|
|
|
selectedMonths: selectedMonths ?? this.selectedMonths,
|
2022-06-25 13:12:47 -07:00
|
|
|
selectedNewAssetsForAlbum:
|
|
|
|
selectedNewAssetsForAlbum ?? this.selectedNewAssetsForAlbum,
|
|
|
|
selectedAdditionalAssetsForAlbum: selectedAdditionalAssetsForAlbum ??
|
|
|
|
this.selectedAdditionalAssetsForAlbum,
|
|
|
|
selectedAssetsInAlbumViewer:
|
|
|
|
selectedAssetsInAlbumViewer ?? this.selectedAssetsInAlbumViewer,
|
2022-04-23 19:08:45 -07:00
|
|
|
isMultiselectEnable: isMultiselectEnable ?? this.isMultiselectEnable,
|
|
|
|
isAlbumExist: isAlbumExist ?? this.isAlbumExist,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() {
|
|
|
|
return 'AssetSelectionState(selectedMonths: $selectedMonths, selectedNewAssetsForAlbum: $selectedNewAssetsForAlbum, selectedAdditionalAssetsForAlbum: $selectedAdditionalAssetsForAlbum, selectedAssetsInAlbumViewer: $selectedAssetsInAlbumViewer, isMultiselectEnable: $isMultiselectEnable, isAlbumExist: $isAlbumExist)';
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool operator ==(Object other) {
|
|
|
|
if (identical(this, other)) return true;
|
|
|
|
final setEquals = const DeepCollectionEquality().equals;
|
|
|
|
|
|
|
|
return other is AssetSelectionState &&
|
|
|
|
setEquals(other.selectedMonths, selectedMonths) &&
|
|
|
|
setEquals(other.selectedNewAssetsForAlbum, selectedNewAssetsForAlbum) &&
|
2022-06-25 13:12:47 -07:00
|
|
|
setEquals(
|
2022-07-13 05:23:48 -07:00
|
|
|
other.selectedAdditionalAssetsForAlbum,
|
|
|
|
selectedAdditionalAssetsForAlbum,
|
|
|
|
) &&
|
|
|
|
setEquals(
|
|
|
|
other.selectedAssetsInAlbumViewer,
|
|
|
|
selectedAssetsInAlbumViewer,
|
|
|
|
) &&
|
2022-04-23 19:08:45 -07:00
|
|
|
other.isMultiselectEnable == isMultiselectEnable &&
|
|
|
|
other.isAlbumExist == isAlbumExist;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get hashCode {
|
|
|
|
return selectedMonths.hashCode ^
|
|
|
|
selectedNewAssetsForAlbum.hashCode ^
|
|
|
|
selectedAdditionalAssetsForAlbum.hashCode ^
|
|
|
|
selectedAssetsInAlbumViewer.hashCode ^
|
|
|
|
isMultiselectEnable.hashCode ^
|
|
|
|
isAlbumExist.hashCode;
|
|
|
|
}
|
|
|
|
}
|