From b8c7079c940b1a7eb3a7d4def006121a72bd6e73 Mon Sep 17 00:00:00 2001 From: Prateek Sunal Date: Fri, 25 Jul 2025 19:56:28 +0530 Subject: [PATCH] fix: update ML service event handling and improve UI element dimensions --- .../services/machine_learning/ml_service.dart | 42 ++++++++++--------- .../actions/smart_albums_status_widget.dart | 7 ++-- .../gallery/gallery_app_bar_widget.dart | 2 + 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/mobile/apps/photos/lib/services/machine_learning/ml_service.dart b/mobile/apps/photos/lib/services/machine_learning/ml_service.dart index c059512d37..48849d2b12 100644 --- a/mobile/apps/photos/lib/services/machine_learning/ml_service.dart +++ b/mobile/apps/photos/lib/services/machine_learning/ml_service.dart @@ -70,31 +70,33 @@ class MLService { _logger.info("client: $client"); // Listen on ComputeController - Bus.instance.on().listen((event) { - if (!flagService.hasGrantedMLConsent) { - return; - } + if (!isProcessBg) { + Bus.instance.on().listen((event) { + if (!flagService.hasGrantedMLConsent) { + return; + } - _mlControllerStatus = event.shouldRun; - if (_mlControllerStatus) { - if (_shouldPauseIndexingAndClustering) { - _cancelPauseIndexingAndClustering(); - _logger.info( - "MLController allowed running ML, faces indexing undoing previous pause", - ); + _mlControllerStatus = event.shouldRun; + if (_mlControllerStatus) { + if (_shouldPauseIndexingAndClustering) { + _cancelPauseIndexingAndClustering(); + _logger.info( + "MLController allowed running ML, faces indexing undoing previous pause", + ); + } else { + _logger.info( + "MLController allowed running ML, faces indexing starting", + ); + } + unawaited(runAllML()); } else { _logger.info( - "MLController allowed running ML, faces indexing starting", + "MLController stopped running ML, faces indexing will be paused (unless it's fetching embeddings)", ); + pauseIndexingAndClustering(); } - unawaited(runAllML()); - } else { - _logger.info( - "MLController stopped running ML, faces indexing will be paused (unless it's fetching embeddings)", - ); - pauseIndexingAndClustering(); - } - }); + }); + } _isInitialized = true; _logger.info('init done'); diff --git a/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart index 63db239dc6..3ce25a884d 100644 --- a/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart +++ b/mobile/apps/photos/lib/ui/viewer/actions/smart_albums_status_widget.dart @@ -1,4 +1,5 @@ import "dart:async"; +import "dart:ui"; import 'package:flutter/material.dart'; import "package:flutter_spinkit/flutter_spinkit.dart"; @@ -66,7 +67,7 @@ class _SmartAlbumsStatusWidgetState extends State firstCurve: Curves.easeInOutExpo, secondCurve: Curves.easeInOutExpo, sizeCurve: Curves.easeInOutExpo, - crossFadeState: !(_syncingCollection == null || + crossFadeState: (_syncingCollection == null || _syncingCollection!.$1 != widget.collection?.id) ? CrossFadeState.showSecond : CrossFadeState.showFirst, @@ -80,9 +81,7 @@ class _SmartAlbumsStatusWidgetState extends State .copyWith(left: 14), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), - color: EnteTheme.isDark(context) - ? Colors.white.withOpacity(0.20) - : Colors.black.withOpacity(0.65), + color: Colors.black.withOpacity(0.65), ), child: Row( mainAxisSize: MainAxisSize.min, diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart index dcd184b9eb..9a999ad5d8 100644 --- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart +++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart @@ -540,6 +540,8 @@ class _GalleryAppBarWidgetState extends State { (value?[widget.collection!.id]?.personIDs.isEmpty ?? true) ? "assets/auto-add-people.png" : "assets/edit-auto-add-people.png", + width: 20, + height: 20, color: EnteTheme.isDark(context) ? Colors.white : Colors.black, ), ),