π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Add option to make 'only them' filter work a little different only for testing, for feedback on which option is better
ashilknebae813ee37f
diff --git a/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart b/mobile/lib/ui/settings/debug/ml_debug_section_widget.dartindex bfac4549c1..5cd8dda2a7 100644--- a/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart+++ b/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart@@ -59,6 +59,23 @@ class _MLDebugSectionWidgetState extends State<MLDebugSectionWidget> {final colorScheme = getEnteColorScheme(context);return Column(children: [+ MenuItemWidget(+ captionedTextWidget: const CaptionedTextWidget(+ title:+ "Exclude files of face IDs that are not in any cluster on applying 'only them' filter.",+ ),+ trailingWidget: ToggleSwitchWidget(+ value: () => localSettings+ .excludeFilesOfFaceIDsThatAreNotInAnyClusterOnOnlyThemFilter,+ onChanged: () async {+ await localSettings+ .setExcludeFilesOfFaceIDsThatAreNotInAnyClusterOnOnlyThemFilter(+ !localSettings+ .excludeFilesOfFaceIDsThatAreNotInAnyClusterOnOnlyThemFilter,+ );+ },+ ),+ ),sectionOptionSpacing,MenuItemWidget(captionedTextWidget: FutureBuilder<IndexStatus>(diff --git a/mobile/lib/utils/hierarchical_search_util.dart b/mobile/lib/utils/hierarchical_search_util.dartindex fe494699e9..f8fa9545e5 100644--- a/mobile/lib/utils/hierarchical_search_util.dart+++ b/mobile/lib/utils/hierarchical_search_util.dart@@ -55,7 +55,10 @@ Future<List<EnteFile>> getFilteredFiles(} catch (e) {logger.severe("Error in filtering face filter: $e");}- } else if (filter is OnlyThemFilter) {+ }+ //TODO: Add result to matchedUploadedIDs to avoid recomputation and check if+ // it is already computed.+ else if (filter is OnlyThemFilter) {try {late Set<int> intersectionOfSelectedFaceFiltersFileIDs;final selectedClusterIDs = <String>[];@@ -91,10 +94,13 @@ Future<List<EnteFile>> getFilteredFiles(exceptClusters: selectedClusterIDs,);- final filesOfFaceIDsNotInAnyCluster =- await MLDataDB.instance.getAllFileIDsOfFaceIDsNotInAnyCluster();+ if (localSettings+ .excludeFilesOfFaceIDsThatAreNotInAnyClusterOnOnlyThemFilter) {+ final filesOfFaceIDsNotInAnyCluster =+ await MLDataDB.instance.getAllFileIDsOfFaceIDsNotInAnyCluster();- fileIDsToAvoid.addAll(filesOfFaceIDsNotInAnyCluster);+ fileIDsToAvoid.addAll(filesOfFaceIDsNotInAnyCluster);+ }final result =intersectionOfSelectedFaceFiltersFileIDs.difference(fileIDsToAvoid);diff --git a/mobile/lib/utils/local_settings.dart b/mobile/lib/utils/local_settings.dartindex 1ea9c4af95..a13b98de6f 100644--- a/mobile/lib/utils/local_settings.dart+++ b/mobile/lib/utils/local_settings.dart@@ -16,6 +16,8 @@ class LocalSettings {static const kRateUsPromptThreshold = 2;static const shouldLoopVideoKey = "video.should_loop";static const onGuestViewKey = "on_guest_view";+ static const kExcludeFilesOfFaceIDsThatAreNotInAnyClusterOnOnlyThemFilter =+ "excludeFilesOfFaceIDsThatAreNotInAnyClusterOnOnlyThemFilter";final SharedPreferences _prefs;@@ -66,6 +68,22 @@ class LocalSettings {bool get userEnabledMultiplePart =>_prefs.getBool(kEnableMultiplePart) ?? false;+ bool get excludeFilesOfFaceIDsThatAreNotInAnyClusterOnOnlyThemFilter =>+ _prefs.getBool(+ kExcludeFilesOfFaceIDsThatAreNotInAnyClusterOnOnlyThemFilter,+ ) ??+ true;++ Future<bool> setExcludeFilesOfFaceIDsThatAreNotInAnyClusterOnOnlyThemFilter(+ bool value,+ ) async {+ await _prefs.setBool(+ kExcludeFilesOfFaceIDsThatAreNotInAnyClusterOnOnlyThemFilter,+ value,+ );+ return value;+ }+Future<bool> setUserEnabledMultiplePart(bool value) async {await _prefs.setBool(kEnableMultiplePart, value);return value;