π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob] Slightly faster indexed file count
laurenspriem5a5cdc8b6bf3
diff --git a/mobile/lib/face/db.dart b/mobile/lib/face/db.dartindex a49e920da0..23e6a5935c 100644--- a/mobile/lib/face/db.dart+++ b/mobile/lib/face/db.dart@@ -136,6 +136,14 @@ class FaceMLDataDB {return result;}+ Future<int> getIndexedFileCount() async {+ final db = await instance.sqliteAsyncDB;+ final List<Map<String, dynamic>> maps = await db.getAll(+ 'SELECT COUNT(DISTINCT $fileIDColumn) as count FROM $facesTable',+ );+ return maps.first['count'] as int;+ }+Future<Map<int, int>> clusterIdToFaceCount() async {final db = await instance.database;final List<Map<String, dynamic>> maps = 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.dartindex 17d891b678..40ba38be6b 100644--- a/mobile/lib/ui/settings/debug/face_debug_section_widget.dart+++ b/mobile/lib/ui/settings/debug/face_debug_section_widget.dart@@ -57,14 +57,14 @@ class _FaceDebugSectionWidgetState extends State<FaceDebugSectionWidget> {return Column(children: [MenuItemWidget(- captionedTextWidget: FutureBuilder<Map<int, int>>(- future: FaceMLDataDB.instance.getIndexedFileIds(),+ captionedTextWidget: FutureBuilder<int>(+ future: FaceMLDataDB.instance.getIndexedFileCount(),builder: (context, snapshot) {if (snapshot.hasData) {return CaptionedTextWidget(title: LocalSettings.instance.isFaceIndexingEnabled- ? "Disable indexing (${snapshot.data!.length})"- : "Enable indexing (${snapshot.data!.length})",+ ? "Disable indexing (${snapshot.data!})"+ : "Enable indexing (${snapshot.data!})",);}return const SizedBox.shrink();@@ -92,8 +92,8 @@ class _FaceDebugSectionWidgetState extends State<FaceDebugSectionWidget> {},),MenuItemWidget(- captionedTextWidget: FutureBuilder<Map<int, int>>(- future: FaceMLDataDB.instance.getIndexedFileIds(),+ captionedTextWidget: FutureBuilder<int>(+ future: FaceMLDataDB.instance.getIndexedFileCount(),builder: (context, snapshot) {if (snapshot.hasData) {return CaptionedTextWidget(@@ -306,12 +306,12 @@ class _FaceDebugSectionWidgetState extends State<FaceDebugSectionWidget> {if (kDebugMode) sectionOptionSpacing,if (kDebugMode)MenuItemWidget(- captionedTextWidget: FutureBuilder<Map<int, int>>(- future: FaceMLDataDB.instance.getIndexedFileIds(),+ captionedTextWidget: FutureBuilder<int>(+ future: FaceMLDataDB.instance.getIndexedFileCount(),builder: (context, snapshot) {if (snapshot.hasData) {return CaptionedTextWidget(- title: "Read embeddings for ${snapshot.data!.length} files",+ title: "Read embeddings for ${snapshot.data!} files",);}return const CaptionedTextWidget(