mirror of
https://github.com/ente-io/ente.git
synced 2025-08-08 07:28:26 +00:00
[mob][photos] Make implementation of abstract fn isSameFilter() more accurate when the fn is used to compare two same sub-HierarchicalSearchFilter types
This commit is contained in:
parent
6c5b0a6578
commit
66a13392a9
@ -43,6 +43,12 @@ class AlbumFilter extends HierarchicalSearchFilter {
|
||||
|
||||
@override
|
||||
bool isSameFilter(HierarchicalSearchFilter other) {
|
||||
if (other is AlbumFilter) {
|
||||
return other.collectionID == collectionID;
|
||||
}
|
||||
// (other is AlbumFilter) can be false and this.resultType() can be same as
|
||||
// other.resultType() if other is a TopLevelGenericFilter of resultType
|
||||
// ResultType.collection
|
||||
return resultType() == other.resultType() && other.name() == name();
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,12 @@ class ContactsFilter extends HierarchicalSearchFilter {
|
||||
|
||||
@override
|
||||
bool isSameFilter(HierarchicalSearchFilter other) {
|
||||
if (other is ContactsFilter) {
|
||||
return other.user.id == user.id;
|
||||
}
|
||||
// (other is ContactsFilter) can be false and this.resultType() can be same as
|
||||
// other.resultType() if other is a TopLevelGenericFilter of resultType
|
||||
// ResultType.shared
|
||||
return resultType() == other.resultType() && other.name() == name();
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,12 @@ class FaceFilter extends HierarchicalSearchFilter {
|
||||
|
||||
@override
|
||||
bool isSameFilter(HierarchicalSearchFilter other) {
|
||||
if (other is FaceFilter) {
|
||||
return other.id == id;
|
||||
}
|
||||
// (other is FaceFilter) can be false and this.resultType() can be same as
|
||||
// other.resultType() if other is a TopLevelGenericFilter of resultType
|
||||
// ResultType.faces
|
||||
return resultType() == other.resultType() && other.name() == name();
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,12 @@ class FileTypeFilter extends HierarchicalSearchFilter {
|
||||
|
||||
@override
|
||||
bool isSameFilter(HierarchicalSearchFilter other) {
|
||||
if (other is FileTypeFilter) {
|
||||
return other.fileType == fileType;
|
||||
}
|
||||
// (other is FileTypeFilter) can be false and this.resultType() can be same as
|
||||
// other.resultType() if other is a TopLevelGenericFilter of resultType
|
||||
// ResultType.fileType
|
||||
return resultType() == other.resultType() && other.name() == name();
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,17 @@ class LocationFilter extends HierarchicalSearchFilter {
|
||||
|
||||
@override
|
||||
bool isSameFilter(HierarchicalSearchFilter other) {
|
||||
if (other is LocationFilter) {
|
||||
return other.locationTag.radius.toString() +
|
||||
other.locationTag.centerPoint.toString() +
|
||||
other.locationTag.name ==
|
||||
locationTag.radius.toString() +
|
||||
locationTag.centerPoint.toString() +
|
||||
locationTag.name;
|
||||
}
|
||||
// (other is LocationFilter) can be false and this.resultType() can be same as
|
||||
// other.resultType() if other is a TopLevelGenericFilter of resultType
|
||||
// ResultType.location
|
||||
return resultType() == other.resultType() && other.name() == name();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user