π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob] Persist setting for disabling remote fetch
Neeraj Gupta5fec61fc1b2d
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 254d5136f0..37ba11626a 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@@ -510,7 +510,7 @@ class FaceMlService {/// Analyzes all the images in the database with the latest ml version and stores the results in the database.////// This function first checks if the image has already been analyzed with the lastest faceMlVersion and stored in the database. If so, it skips the image.- Future<void> indexAllImages({withFetching = true}) async {+ Future<void> indexAllImages() async {if (isImageIndexRunning) {_logger.warning("indexAllImages is already running, skipping");return;@@ -562,7 +562,7 @@ class FaceMlService {for (final f in chunk) {fileIds.add(f.uploadedFileID!);}- if (withFetching) {+ if (LocalSettings.instance.remoteFetchEnabled) {try {final EnteWatch? w = kDebugMode ? EnteWatch("face_em_fetch") : null;w?.start();diff --git a/mobile/lib/ui/settings/debug/face_debug_section_widget.dart b/mobile/lib/ui/settings/debug/face_debug_section_widget.dartindex 7a924dacde..17d891b678 100644--- a/mobile/lib/ui/settings/debug/face_debug_section_widget.dart+++ b/mobile/lib/ui/settings/debug/face_debug_section_widget.dart@@ -97,9 +97,9 @@ class _FaceDebugSectionWidgetState extends State<FaceDebugSectionWidget> {builder: (context, snapshot) {if (snapshot.hasData) {return CaptionedTextWidget(- title: LocalSettings.instance.isFaceIndexingEnabled- ? "Disable indexing (no fetch) (${snapshot.data!.length})"- : "Enable indexing (${snapshot.data!.length})",+ title: LocalSettings.instance.remoteFetchEnabled+ ? "Remote fetch Enabled"+ : "Remote fetch Disabled",);}return const SizedBox.shrink();@@ -110,15 +110,7 @@ class _FaceDebugSectionWidgetState extends State<FaceDebugSectionWidget> {trailingIconIsMuted: true,onTap: () async {try {- final isEnabled =- await LocalSettings.instance.toggleFaceIndexing();- if (isEnabled) {- FaceMlService.instance- .indexAllImages(withFetching: false)- .ignore();- } else {- FaceMlService.instance.pauseIndexing();- }+ await LocalSettings.instance.toggleRemoteFetch();if (mounted) {setState(() {});}diff --git a/mobile/lib/utils/local_settings.dart b/mobile/lib/utils/local_settings.dartindex 10d1ad57bd..8050c1d732 100644--- a/mobile/lib/utils/local_settings.dart+++ b/mobile/lib/utils/local_settings.dart@@ -84,6 +84,14 @@ class LocalSettings {return isFaceIndexingEnabled;}+ //#region todo:(NG) remove this section, only needed for internal testing to see+ // if the OS stops the app during indexing+ bool get remoteFetchEnabled => _prefs.getBool("remoteFetchEnabled") ?? false;+ Future<void> toggleRemoteFetch() async {+ await _prefs.setBool("remoteFetchEnabled", !remoteFetchEnabled);+ }+ //#endregion+/// toggleFaceClustering toggles the face clustering setting and returns the new valueFuture<bool> toggleFaceClustering() async {await _prefs.setBool(kEnableFaceClustering, !isFaceClusteringEnabled);