Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Make implementation of abstract fn isSameFilter() more accurate when the fn is used to compare two same sub-HierarchicalSearchFilter types

ashilkn66a13392a920
diff --git a/mobile/lib/models/search/hierarchical/album_filter.dart b/mobile/lib/models/search/hierarchical/album_filter.dart
index cf55a94a30..2c126db9a7 100644
--- a/mobile/lib/models/search/hierarchical/album_filter.dart
+++ b/mobile/lib/models/search/hierarchical/album_filter.dart
@@ -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();
}
diff --git a/mobile/lib/models/search/hierarchical/contacts_filter.dart b/mobile/lib/models/search/hierarchical/contacts_filter.dart
index e700a84bdc..b328ecc0df 100644
--- a/mobile/lib/models/search/hierarchical/contacts_filter.dart
+++ b/mobile/lib/models/search/hierarchical/contacts_filter.dart
@@ -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();
}
diff --git a/mobile/lib/models/search/hierarchical/face_filter.dart b/mobile/lib/models/search/hierarchical/face_filter.dart
index 463f22d9df..42d2daeef9 100644
--- a/mobile/lib/models/search/hierarchical/face_filter.dart
+++ b/mobile/lib/models/search/hierarchical/face_filter.dart
@@ -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();
}
diff --git a/mobile/lib/models/search/hierarchical/file_type_filter.dart b/mobile/lib/models/search/hierarchical/file_type_filter.dart
index 9e18715641..4f5e616a80 100644
--- a/mobile/lib/models/search/hierarchical/file_type_filter.dart
+++ b/mobile/lib/models/search/hierarchical/file_type_filter.dart
@@ -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();
}
diff --git a/mobile/lib/models/search/hierarchical/location_filter.dart b/mobile/lib/models/search/hierarchical/location_filter.dart
index edc5f728c2..f38228cdc9 100644
--- a/mobile/lib/models/search/hierarchical/location_filter.dart
+++ b/mobile/lib/models/search/hierarchical/location_filter.dart
@@ -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();
}