Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob] Debug option to reset feedback

laurenspriema3b6a7231503
diff --git a/mobile/lib/face/db.dart b/mobile/lib/face/db.dart
index ffda695d14..601c15679f 100644
--- a/mobile/lib/face/db.dart
+++ b/mobile/lib/face/db.dart
@@ -681,6 +681,20 @@ class FaceMLDataDB {
await db.execute(createClusterSummaryTable);
}
+ /// WARNING: This will delete ALL data in the database! Only use this for debug/testing purposes!
+ Future<void> dropPeople() async {
+ final db = await instance.database;
+
+ await db.execute(deletePeopleTable);
+ await db.execute(dropClustersTable);
+ await db.execute(dropNotPersonFeedbackTable);
+
+ // await db.execute(createFacesTable);
+ await db.execute(createPeopleTable);
+ await db.execute(createClusterTable);
+ await db.execute(createNotPersonFeedbackTable);
+ }
+
Future<void> removePersonFromFiles(List<EnteFile> files, Person p) async {
final db = await instance.database;
final result = await db.rawQuery(
diff --git a/mobile/lib/ui/settings/debug/face_debug_section_widget.dart b/mobile/lib/ui/settings/debug/face_debug_section_widget.dart
index f50c8d91d8..ae549b6739 100644
--- a/mobile/lib/ui/settings/debug/face_debug_section_widget.dart
+++ b/mobile/lib/ui/settings/debug/face_debug_section_widget.dart
@@ -167,19 +167,42 @@ class _FaceDebugSectionWidgetState extends State<FaceDebugSectionWidget> {
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: const CaptionedTextWidget(
- title: "Reset feedback & labels",
+ title: "Reset feedback",
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
- await FaceMLDataDB.instance.resetClusterIDs();
- await FaceMLDataDB.instance.dropClustersAndPeople();
+ await FaceMLDataDB.instance.dropPeople();
Bus.instance.fire(PeopleChangedEvent());
showShortToast(context, "Done");
},
),
sectionOptionSpacing,
+ MenuItemWidget(
+ captionedTextWidget: const CaptionedTextWidget(
+ title: "Reset feedback & labels",
+ ),
+ pressedColor: getEnteColorScheme(context).fillFaint,
+ trailingIcon: Icons.chevron_right_outlined,
+ trailingIconIsMuted: true,
+ onTap: () async {
+ await showChoiceDialog(
+ context,
+ title: "Are you sure?",
+ body:
+ "You will need to again cluster all the faces. You can drop feedback if you want to return to original cluster labels",
+ firstButtonLabel: "Yes, confirm",
+ firstButtonOnTap: () async {
+ await FaceMLDataDB.instance.resetClusterIDs();
+ await FaceMLDataDB.instance.dropClustersAndPeople();
+ Bus.instance.fire(PeopleChangedEvent());
+ showShortToast(context, "Done");
+ },
+ );
+ },
+ ),
+ sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: const CaptionedTextWidget(
title: "Drop embeddings & feedback",