From 86fb8ebfafa83ba1a7da2ebfee4d50cdd7748fc3 Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 27 May 2024 11:57:40 +0530 Subject: [PATCH] [mob][photos] Fix indexing issue on iOS --- .../face_ml/face_ml_service.dart | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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.dart index de02c5672..9f153ffa8 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 @@ -43,6 +43,7 @@ import 'package:photos/services/machine_learning/face_ml/face_ml_result.dart'; import "package:photos/services/machine_learning/face_ml/person/person_service.dart"; import 'package:photos/services/machine_learning/file_ml/file_ml.dart'; import 'package:photos/services/machine_learning/file_ml/remote_fileml_service.dart'; +import "package:photos/services/machine_learning/machine_learning_controller.dart"; import "package:photos/services/search_service.dart"; import "package:photos/utils/file_util.dart"; import 'package:photos/utils/image_ml_isolate.dart'; @@ -163,9 +164,16 @@ class FaceMlService { pauseIndexingAndClustering(); } }); + if (Platform.isIOS && + MachineLearningController.instance.isDeviceHealthy) { + _logger.info("Starting face indexing and clustering on iOS from init"); + unawaited(indexAndClusterAll()); + } _listenIndexOnDiffSync(); _listenOnPeopleChangedSync(); + + _logger.info('init done'); }); } @@ -1016,9 +1024,13 @@ class FaceMlService { File? file; if (enteFile.fileType == FileType.video) { try { - file = await getThumbnailForUploadedFile(enteFile); + file = await getThumbnailForUploadedFile(enteFile); } on PlatformException catch (e, s) { - _logger.severe("Could not get thumbnail for $enteFile due to PlatformException", e, s); + _logger.severe( + "Could not get thumbnail for $enteFile due to PlatformException", + e, + s, + ); throw ThumbnailRetrievalException(e.toString(), s); } } else {