π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Don't show PeopleSection when faces is disabled
laurenspriem1e5512b36f01
diff --git a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dartindex 98e75b32ab..93a6587a5d 100644--- a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart+++ b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart@@ -127,6 +127,9 @@ class FaceMlService {/// hooking FaceML into [MachineLearningController]if (Platform.isAndroid) {Bus.instance.on<MachineLearningControlEvent>().listen((event) {+ if (LocalSettings.instance.isFaceIndexingEnabled == false) {+ return;+ }canRunMLController = event.shouldRun;if (canRunMLController) {unawaited(indexAllImages());@@ -332,6 +335,11 @@ class FaceMlService {_logger.info("clusterAllImages is already running, skipping");return;}+ // verify faces is enabled+ if (LocalSettings.instance.isFaceIndexingEnabled == false) {+ _logger.warning("clustering is disabled by user");+ return;+ }final indexingCompleteRatio = await _getIndexedDoneRatio();if (indexingCompleteRatio < 0.6) {@@ -538,7 +546,7 @@ class FaceMlService {_logger.warning("indexAllImages is already running, skipping");return;}- // verify indexing is enabled+ // verify faces is enabledif (LocalSettings.instance.isFaceIndexingEnabled == false) {_logger.warning("indexing is disabled by user");return;diff --git a/mobile/lib/ui/settings/debug/face_debug_section_widget.dart b/mobile/lib/ui/settings/debug/face_debug_section_widget.dartindex ab35c5f64b..5c590818a0 100644--- a/mobile/lib/ui/settings/debug/face_debug_section_widget.dart+++ b/mobile/lib/ui/settings/debug/face_debug_section_widget.dart@@ -64,8 +64,8 @@ class _FaceDebugSectionWidgetState extends State<FaceDebugSectionWidget> {if (snapshot.hasData) {return CaptionedTextWidget(title: LocalSettings.instance.isFaceIndexingEnabled- ? "Disable indexing (${snapshot.data!})"- : "Enable indexing (${snapshot.data!})",+ ? "Disable faces (${snapshot.data!})"+ : "Enable faces (${snapshot.data!})",);}return const SizedBox.shrink();@@ -78,9 +78,7 @@ class _FaceDebugSectionWidgetState extends State<FaceDebugSectionWidget> {try {final isEnabled =await LocalSettings.instance.toggleFaceIndexing();- if (isEnabled) {- FaceMlService.instance.indexAllImages().ignore();- } else {+ if (!isEnabled) {FaceMlService.instance.pauseIndexing();}if (mounted) {diff --git a/mobile/lib/ui/viewer/search_tab/search_tab.dart b/mobile/lib/ui/viewer/search_tab/search_tab.dartindex 427b705835..46dcfda036 100644--- a/mobile/lib/ui/viewer/search_tab/search_tab.dart+++ b/mobile/lib/ui/viewer/search_tab/search_tab.dart@@ -20,6 +20,7 @@ import "package:photos/ui/viewer/search_tab/file_type_section.dart";import "package:photos/ui/viewer/search_tab/locations_section.dart";import "package:photos/ui/viewer/search_tab/moments_section.dart";import "package:photos/ui/viewer/search_tab/people_section.dart";+import "package:photos/utils/local_settings.dart";class SearchTab extends StatefulWidget {const SearchTab({Key? key}) : super(key: key);@@ -114,6 +115,9 @@ class _AllSearchSectionsState extends State<AllSearchSections> {itemBuilder: (context, index) {switch (searchTypes[index]) {case SectionType.face:+ if (!LocalSettings.instance.isFaceIndexingEnabled) {+ return const SizedBox.shrink();+ }return PeopleSection(examples: snapshot.data!.elementAt(index)as List<GenericSearchResult>,