[mob][photos] Keep the galleryType as GalleryType.peopleTag when an 'Only them' filter is applied when, the initial filter is a face filter so that the selection option are of the inital face filter's

Needed to write extra code to make it work for 'Only them' face since the current logic checks if inital filter is in applied list, and if yes keep the gallery type unchanged and if not, change gallery type to GalleryType.searchResults. Since an 'Only them' filter is not exactly the same as a Face filter, had to write more code to handle this case since the 'Only them' filter can have the inital Face filter in it
This commit is contained in:
ashilkn 2024-11-06 22:03:40 +05:30
parent d355d4c1f0
commit f2e99d5efd

View File

@ -2,7 +2,9 @@ import 'package:flutter/material.dart';
import 'package:photos/models/collection/collection.dart';
import 'package:photos/models/gallery_type.dart';
import "package:photos/models/ml/face/person.dart";
import "package:photos/models/search/hierarchical/face_filter.dart";
import "package:photos/models/search/hierarchical/hierarchical_search_filter.dart";
import "package:photos/models/search/hierarchical/only_them_filter.dart";
import 'package:photos/models/selected_files.dart';
import "package:photos/theme/effects.dart";
import "package:photos/theme/ente_theme.dart";
@ -185,6 +187,17 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {
initalFilterIsInAppliedFiters = true;
break;
}
if (initialFilter is FaceFilter) {
for (HierarchicalSearchFilter filter in appliedFilters) {
if (filter is OnlyThemFilter) {
if (filter.faceFilters
.any((faceFilter) => faceFilter.isSameFilter(initialFilter))) {
initalFilterIsInAppliedFiters = true;
break;
}
}
}
}
}
if (!initalFilterIsInAppliedFiters) {