[mob][photos] More debug options

This commit is contained in:
laurenspriem 2024-05-17 18:15:43 +05:30
parent b0ef3a070e
commit b1ccc39178
2 changed files with 30 additions and 15 deletions

View file

@ -126,10 +126,10 @@ class FaceMlService {
}
isInitialized = true;
canRunMLController = !Platform.isAndroid;
canRunMLController = !Platform.isAndroid || kDebugMode;
/// hooking FaceML into [MachineLearningController]
if (Platform.isAndroid) {
if (Platform.isAndroid && !kDebugMode) {
Bus.instance.on<MachineLearningControlEvent>().listen((event) {
if (LocalSettings.instance.isFaceIndexingEnabled == false) {
return;
@ -153,7 +153,7 @@ class FaceMlService {
void listenIndexOnDiffSync() {
Bus.instance.on<DiffSyncCompleteEvent>().listen((event) async {
if (LocalSettings.instance.isFaceIndexingEnabled == false) {
if (LocalSettings.instance.isFaceIndexingEnabled == false || kDebugMode) {
return;
}
// [neeraj] intentional delay in starting indexing on diff sync, this gives time for the user

View file

@ -92,18 +92,10 @@ class _FaceDebugSectionWidgetState extends State<FaceDebugSectionWidget> {
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: FutureBuilder<int>(
future: FaceMLDataDB.instance.getIndexedFileCount(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return CaptionedTextWidget(
title: LocalSettings.instance.remoteFetchEnabled
? "Remote fetch Enabled"
: "Remote fetch Disabled",
);
}
return const SizedBox.shrink();
},
captionedTextWidget: CaptionedTextWidget(
title: LocalSettings.instance.remoteFetchEnabled
? "Remote fetch enabled"
: "Remote fetch disabled",
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
@ -121,6 +113,29 @@ class _FaceDebugSectionWidgetState extends State<FaceDebugSectionWidget> {
},
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: FaceMlService.instance.canRunMLController
? "canRunML enabled"
: "canRunML disabled",
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
try {
FaceMlService.instance.canRunMLController =
!FaceMlService.instance.canRunMLController;
if (mounted) {
setState(() {});
}
} catch (e, s) {
_logger.warning('canRunML toggle failed ', e, s);
await showGenericErrorDialog(context: context, error: e);
}
},
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: FutureBuilder<double>(
future: FaceMLDataDB.instance.getClusteredToTotalFacesRatio(),