Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add option to delete all reactions from local db

ashilkna23be8b0bacf
diff --git a/mobile/apps/photos/lib/db/social_db.dart b/mobile/apps/photos/lib/db/social_db.dart
index cf7037c038..07c3a76a0f 100644
--- a/mobile/apps/photos/lib/db/social_db.dart
+++ b/mobile/apps/photos/lib/db/social_db.dart
@@ -218,6 +218,14 @@ class SocialDB {
return deletedCount;
}
+ /// Delete all reactions from the database
+ Future<int> deleteAllReactions() async {
+ final db = await database;
+ final deletedCount = await db.delete(reactionsTable);
+ _logger.info('Deleted $deletedCount reactions');
+ return deletedCount;
+ }
+
/// Seeds the database with example comments and reactions for testing.
Future<void> seedExampleData() async {}
diff --git a/mobile/apps/photos/lib/ui/settings/debug/social_debug_screen.dart b/mobile/apps/photos/lib/ui/settings/debug/social_debug_screen.dart
index 026bfa2298..a5045490cd 100644
--- a/mobile/apps/photos/lib/ui/settings/debug/social_debug_screen.dart
+++ b/mobile/apps/photos/lib/ui/settings/debug/social_debug_screen.dart
@@ -75,6 +75,24 @@ class SocialDebugScreen extends StatelessWidget {
showShortToast(context, "Deleted $count comments");
},
),
+ const SizedBox(height: 24),
+ MenuItemWidget(
+ captionedTextWidget: const CaptionedTextWidget(
+ title: "Delete all reactions",
+ ),
+ menuItemColor: colorScheme.fillFaint,
+ trailingWidget: Icon(
+ Icons.chevron_right_outlined,
+ color: colorScheme.strokeBase,
+ ),
+ singleBorderRadius: 8,
+ alignCaptionedTextToLeft: true,
+ onTap: () async {
+ final count =
+ await SocialDB.instance.deleteAllReactions();
+ showShortToast(context, "Deleted $count reactions");
+ },
+ ),
],
),
);