[mob][photos] Show when clustering is running

This commit is contained in:
laurenspriem
2024-05-31 14:47:03 +05:30
parent 029872e54e
commit f6bdeef33d
2 changed files with 12 additions and 2 deletions

View File

@@ -91,7 +91,10 @@ class FaceMlService {
bool isInitialized = false;
late String client;
bool get showClusteringIsHappening => _showClusteringIsHappening;
bool debugIndexingDisabled = false;
bool _showClusteringIsHappening = false;
bool _mlControllerStatus = false;
bool _isIndexingOrClusteringRunning = false;
bool _shouldPauseIndexingAndClustering = false;
@@ -572,6 +575,8 @@ class FaceMlService {
await PersonService.instance.fetchRemoteClusterFeedback();
try {
_showClusteringIsHappening = true;
// Get a sense of the total number of faces in the database
final int totalFaces =
await FaceMLDataDB.instance.getTotalFaceCount(minFaceScore: minFaceScore);
@@ -711,6 +716,7 @@ class FaceMlService {
} catch (e, s) {
_logger.severe("`clusterAllImages` failed", e, s);
} finally {
_showClusteringIsHappening = false;
_isIndexingOrClusteringRunning = false;
_shouldPauseIndexingAndClustering = false;
}

View File

@@ -513,14 +513,18 @@ class FaceRecognitionStatusWidgetState extends State<FaceRecognitionStatusWidget
title: S.of(context).clusteringProgress,
),
trailingWidget: Text(
"${clusteringPercentage.toStringAsFixed(0)}%",
FaceMlService.instance.showClusteringIsHappening
? "currently running"
: "${clusteringPercentage.toStringAsFixed(0)}%",
style: Theme.of(context).textTheme.bodySmall,
),
singleBorderRadius: 8,
alignCaptionedTextToLeft: true,
isGestureDetectorDisabled: true,
key: ValueKey(
"clustering_progress_" + clusteringPercentage.toStringAsFixed(0),
FaceMlService.instance.showClusteringIsHappening
? "currently running"
: "clustering_progress_" + clusteringPercentage.toStringAsFixed(0),
),
),
],