π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Logging
laurenspriem71d342787970
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 7c29b4ab65..9e72f4c55a 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@@ -143,10 +143,13 @@ class FaceMlService {}canRunMLController = event.shouldRun;if (canRunMLController) {- _logger.info("MLController allowed running ML, faces indexing starting");+ _logger.info(+ "MLController allowed running ML, faces indexing starting",+ );unawaited(indexAndClusterAll());} else {- _logger.info("MLController stopped running ML, faces indexing paused");+ _logger+ .info("MLController stopped running ML, faces indexing paused");pauseIndexing();}});@@ -1014,6 +1017,7 @@ class FaceMlService {file = await getThumbnailForUploadedFile(enteFile);} else {file = await getFile(enteFile, isOrigin: true);+ // TODO: This is returning null for Pragadees for all files, so something is wrong here!}if (file == null) {_logger.warning("Could not get file for $enteFile");diff --git a/mobile/lib/ui/settings/machine_learning_settings_page.dart b/mobile/lib/ui/settings/machine_learning_settings_page.dartindex 9fa98e46fe..1e63cf6458 100644--- a/mobile/lib/ui/settings/machine_learning_settings_page.dart+++ b/mobile/lib/ui/settings/machine_learning_settings_page.dart@@ -3,6 +3,7 @@ import "dart:math" show max, min;import "package:flutter/material.dart";import "package:intl/intl.dart";+import "package:logging/logging.dart";import "package:photos/core/event_bus.dart";import 'package:photos/events/embedding_updated_event.dart';import "package:photos/face/db.dart";@@ -26,6 +27,8 @@ import "package:photos/ui/components/toggle_switch_widget.dart";import "package:photos/utils/data_util.dart";import "package:photos/utils/local_settings.dart";+final _logger = Logger("MachineLearningSettingsPage");+class MachineLearningSettingsPage extends StatefulWidget {const MachineLearningSettingsPage({super.key});@@ -65,6 +68,7 @@ class _MachineLearningSettingsPageState@overrideWidget build(BuildContext context) {final bool facesFlag = flagService.faceSearchEnabled;+ _logger.info("On page open, facesFlag: $facesFlag");return Scaffold(body: CustomScrollView(primary: false,@@ -435,16 +439,22 @@ class FaceRecognitionStatusWidgetState}Future<(int, int, int, double)> getIndexStatus() async {- final indexedFiles = await FaceMLDataDB.instance- .getIndexedFileCount(minimumMlVersion: faceMlVersion);- final indexableFiles = (await FaceMlService.getIndexableFileIDs()).length;- final showIndexedFiles = min(indexedFiles, indexableFiles);- final pendingFiles = max(indexableFiles - indexedFiles, 0);- final foundFaces = await FaceMLDataDB.instance.getTotalFaceCount();- final clusteredFaces = await FaceMLDataDB.instance.getClusteredFaceCount();- final clusteringDoneRatio = clusteredFaces / foundFaces;-- return (showIndexedFiles, pendingFiles, foundFaces, clusteringDoneRatio);+ try {+ final indexedFiles = await FaceMLDataDB.instance+ .getIndexedFileCount(minimumMlVersion: faceMlVersion);+ final indexableFiles = (await FaceMlService.getIndexableFileIDs()).length;+ final showIndexedFiles = min(indexedFiles, indexableFiles);+ final pendingFiles = max(indexableFiles - indexedFiles, 0);+ final foundFaces = await FaceMLDataDB.instance.getTotalFaceCount();+ final clusteredFaces =+ await FaceMLDataDB.instance.getClusteredFaceCount();+ final clusteringDoneRatio = clusteredFaces / foundFaces;++ return (showIndexedFiles, pendingFiles, foundFaces, clusteringDoneRatio);+ } catch (e, s) {+ _logger.severe('Error getting face recognition status', e, s);+ rethrow;+ }}@overridediff --git a/mobile/lib/utils/file_util.dart b/mobile/lib/utils/file_util.dartindex b845d2ff66..35240a3cc6 100644--- a/mobile/lib/utils/file_util.dart+++ b/mobile/lib/utils/file_util.dart@@ -37,25 +37,30 @@ Future<File?> getFile(bool isOrigin = false,} // only relevant for live photos) async {- if (file.isRemoteFile) {- return getFileFromServer(file, liveVideo: liveVideo);- } else {- final String key = file.tag + liveVideo.toString() + isOrigin.toString();- final cachedFile = FileLruCache.get(key);- if (cachedFile == null) {- final diskFile = await _getLocalDiskFile(- file,- liveVideo: liveVideo,- isOrigin: isOrigin,- );- // do not cache origin file for IOS as they are immediately deleted- // after usage- if (!(isOrigin && Platform.isIOS) && diskFile != null) {- FileLruCache.put(key, diskFile);+ try {+ if (file.isRemoteFile) {+ return getFileFromServer(file, liveVideo: liveVideo);+ } else {+ final String key = file.tag + liveVideo.toString() + isOrigin.toString();+ final cachedFile = FileLruCache.get(key);+ if (cachedFile == null) {+ final diskFile = await _getLocalDiskFile(+ file,+ liveVideo: liveVideo,+ isOrigin: isOrigin,+ );+ // do not cache origin file for IOS as they are immediately deleted+ // after usage+ if (!(isOrigin && Platform.isIOS) && diskFile != null) {+ FileLruCache.put(key, diskFile);+ }+ return diskFile;}- return diskFile;+ return cachedFile;}- return cachedFile;+ } catch (e, s) {+ _logger.warning("Failed to get file", e, s);+ return null;}}