From 1ec7e026950ea1be4d7d50879009d0b461cda739 Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Sat, 25 May 2024 12:03:34 +0530 Subject: [PATCH 01/16] [mob][photos] Copy change --- mobile/lib/generated/intl/messages_en.dart | 2 +- mobile/lib/generated/l10n.dart | 4 ++-- mobile/lib/l10n/intl_en.arb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mobile/lib/generated/intl/messages_en.dart b/mobile/lib/generated/intl/messages_en.dart index 320df2c1d..baf50af58 100644 --- a/mobile/lib/generated/intl/messages_en.dart +++ b/mobile/lib/generated/intl/messages_en.dart @@ -814,7 +814,7 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("Incorrect recovery key"), "indexedItems": MessageLookupByLibrary.simpleMessage("Indexed items"), "indexingIsPaused": MessageLookupByLibrary.simpleMessage( - "Indexing is paused, will automatically resume when device is ready"), + "Indexing is paused. It will automatically resume when device is ready"), "insecureDevice": MessageLookupByLibrary.simpleMessage("Insecure device"), "installManually": diff --git a/mobile/lib/generated/l10n.dart b/mobile/lib/generated/l10n.dart index de8922161..a6cd47cbd 100644 --- a/mobile/lib/generated/l10n.dart +++ b/mobile/lib/generated/l10n.dart @@ -8794,10 +8794,10 @@ class S { ); } - /// `Indexing is paused, will automatically resume when device is ready` + /// `Indexing is paused. It will automatically resume when device is ready` String get indexingIsPaused { return Intl.message( - 'Indexing is paused, will automatically resume when device is ready', + 'Indexing is paused. It will automatically resume when device is ready', name: 'indexingIsPaused', desc: '', args: [], diff --git a/mobile/lib/l10n/intl_en.arb b/mobile/lib/l10n/intl_en.arb index 08e794074..a63d8674e 100644 --- a/mobile/lib/l10n/intl_en.arb +++ b/mobile/lib/l10n/intl_en.arb @@ -1236,5 +1236,5 @@ "faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.", "foundFaces": "Found faces", "clusteringProgress": "Clustering progress", - "indexingIsPaused": "Indexing is paused, will automatically resume when device is ready" -} \ No newline at end of file + "indexingIsPaused": "Indexing is paused. It will automatically resume when device is ready" +} From 7b4559f3cafaedb9b064e2a0ce38ed10675f416d Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 27 May 2024 10:49:42 +0530 Subject: [PATCH 02/16] [mob][photos] Reduce clustering frequency --- .../lib/services/machine_learning/face_ml/face_ml_service.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart index bbe719dbe..de02c5672 100644 --- a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart +++ b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart @@ -99,7 +99,7 @@ class FaceMlService { final int _fileDownloadLimit = 5; final int _embeddingFetchLimit = 200; - final int _kForceClusteringFaceCount = 4000; + final int _kForceClusteringFaceCount = 8000; Future init({bool initializeImageMlIsolate = false}) async { if (LocalSettings.instance.isFaceIndexingEnabled == false) { From b100f1d4bfe27c646bca14c761e48b320bd052c8 Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 27 May 2024 11:28:05 +0530 Subject: [PATCH 03/16] [mob][photos] Catch and stopwatch on faces db creation --- mobile/lib/face/db.dart | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/mobile/lib/face/db.dart b/mobile/lib/face/db.dart index 3ad90915d..388b30b1e 100644 --- a/mobile/lib/face/db.dart +++ b/mobile/lib/face/db.dart @@ -55,12 +55,21 @@ class FaceMLDataDB { } Future _onCreate(SqliteDatabase asyncDBConnection) async { - await asyncDBConnection.execute(createFacesTable); - await asyncDBConnection.execute(createFaceClustersTable); - await asyncDBConnection.execute(createClusterPersonTable); - await asyncDBConnection.execute(createClusterSummaryTable); - await asyncDBConnection.execute(createNotPersonFeedbackTable); - await asyncDBConnection.execute(fcClusterIDIndex); + try { + final startTime = DateTime.now(); + await asyncDBConnection.execute(createFacesTable); + await asyncDBConnection.execute(createFaceClustersTable); + await asyncDBConnection.execute(createClusterPersonTable); + await asyncDBConnection.execute(createClusterSummaryTable); + await asyncDBConnection.execute(createNotPersonFeedbackTable); + await asyncDBConnection.execute(fcClusterIDIndex); + _logger.info( + 'FaceMLDataDB tables created in ${DateTime.now().difference(startTime).inMilliseconds}ms', + ); + } catch (e, s) { + _logger.severe("Error creating FaceMLDataDB tables", e, s); + rethrow; + } } // bulkInsertFaces inserts the faces in the database in batches of 1000. From b2e8c3c0eb86c2a1b1ff07420b4031a764e347ca Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 27 May 2024 11:51:20 +0530 Subject: [PATCH 04/16] [mob][photos] Remove restriction for ML for F-Droid --- mobile/lib/main.dart | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart index 50de0b9a1..3096f8fd3 100644 --- a/mobile/lib/main.dart +++ b/mobile/lib/main.dart @@ -238,14 +238,12 @@ Future _init(bool isBackground, {String via = ''}) async { // Can not including existing tf/ml binaries as they are not being built // from source. // See https://gitlab.com/fdroid/fdroiddata/-/merge_requests/12671#note_1294346819 - if (!UpdateService.instance.isFdroidFlavor()) { - // unawaited(ObjectDetectionService.instance.init()); - if (flagService.faceSearchEnabled) { - unawaited(FaceMlService.instance.init()); - } else { - if (LocalSettings.instance.isFaceIndexingEnabled) { - unawaited(LocalSettings.instance.toggleFaceIndexing()); - } + // unawaited(ObjectDetectionService.instance.init()); + if (flagService.faceSearchEnabled) { + unawaited(FaceMlService.instance.init()); + } else { + if (LocalSettings.instance.isFaceIndexingEnabled) { + unawaited(LocalSettings.instance.toggleFaceIndexing()); } } PersonService.init( From 86fb8ebfafa83ba1a7da2ebfee4d50cdd7748fc3 Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 27 May 2024 11:57:40 +0530 Subject: [PATCH 05/16] [mob][photos] Fix indexing issue on iOS --- .../face_ml/face_ml_service.dart | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart index de02c5672..9f153ffa8 100644 --- a/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart +++ b/mobile/lib/services/machine_learning/face_ml/face_ml_service.dart @@ -43,6 +43,7 @@ import 'package:photos/services/machine_learning/face_ml/face_ml_result.dart'; import "package:photos/services/machine_learning/face_ml/person/person_service.dart"; import 'package:photos/services/machine_learning/file_ml/file_ml.dart'; import 'package:photos/services/machine_learning/file_ml/remote_fileml_service.dart'; +import "package:photos/services/machine_learning/machine_learning_controller.dart"; import "package:photos/services/search_service.dart"; import "package:photos/utils/file_util.dart"; import 'package:photos/utils/image_ml_isolate.dart'; @@ -163,9 +164,16 @@ class FaceMlService { pauseIndexingAndClustering(); } }); + if (Platform.isIOS && + MachineLearningController.instance.isDeviceHealthy) { + _logger.info("Starting face indexing and clustering on iOS from init"); + unawaited(indexAndClusterAll()); + } _listenIndexOnDiffSync(); _listenOnPeopleChangedSync(); + + _logger.info('init done'); }); } @@ -1016,9 +1024,13 @@ class FaceMlService { File? file; if (enteFile.fileType == FileType.video) { try { - file = await getThumbnailForUploadedFile(enteFile); + file = await getThumbnailForUploadedFile(enteFile); } on PlatformException catch (e, s) { - _logger.severe("Could not get thumbnail for $enteFile due to PlatformException", e, s); + _logger.severe( + "Could not get thumbnail for $enteFile due to PlatformException", + e, + s, + ); throw ThumbnailRetrievalException(e.toString(), s); } } else { From 30ade541dfe1525197f0b837f22ced8d963eac37 Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 27 May 2024 11:57:46 +0530 Subject: [PATCH 06/16] [mob][photos] Logging --- .../services/machine_learning/machine_learning_controller.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mobile/lib/services/machine_learning/machine_learning_controller.dart b/mobile/lib/services/machine_learning/machine_learning_controller.dart index 1b70ea48d..40a52a419 100644 --- a/mobile/lib/services/machine_learning/machine_learning_controller.dart +++ b/mobile/lib/services/machine_learning/machine_learning_controller.dart @@ -31,6 +31,7 @@ class MachineLearningController { bool get isDeviceHealthy => _isDeviceHealthy; void init() { + _logger.info('init called'); if (Platform.isAndroid) { _startInteractionTimer(); BatteryInfoPlugin() @@ -47,6 +48,7 @@ class MachineLearningController { }); } _fireControlEvent(); + _logger.info('init done'); } void onUserInteraction() { From baa90c42ad188ef90598f3cd8f099173d751ed23 Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 27 May 2024 11:59:36 +0530 Subject: [PATCH 07/16] [mob][photos] Remove stale comments --- mobile/lib/main.dart | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mobile/lib/main.dart b/mobile/lib/main.dart index 3096f8fd3..ac1e8441d 100644 --- a/mobile/lib/main.dart +++ b/mobile/lib/main.dart @@ -235,10 +235,6 @@ Future _init(bool isBackground, {String via = ''}) async { unawaited(SemanticSearchService.instance.init()); MachineLearningController.instance.init(); - // Can not including existing tf/ml binaries as they are not being built - // from source. - // See https://gitlab.com/fdroid/fdroiddata/-/merge_requests/12671#note_1294346819 - // unawaited(ObjectDetectionService.instance.init()); if (flagService.faceSearchEnabled) { unawaited(FaceMlService.instance.init()); } else { From ee8976e92bb8e0b0b687ad7764cb62c3c9faa919 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Mon, 27 May 2024 12:56:20 +0530 Subject: [PATCH 08/16] [mob][photos] Add schema migration easier on FaceMLDataDB --- mobile/lib/face/db.dart | 44 +++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/mobile/lib/face/db.dart b/mobile/lib/face/db.dart index 388b30b1e..c1b96767e 100644 --- a/mobile/lib/face/db.dart +++ b/mobile/lib/face/db.dart @@ -35,6 +35,15 @@ class FaceMLDataDB { static final FaceMLDataDB instance = FaceMLDataDB._privateConstructor(); + static final _migrationScripts = [ + createFacesTable, + createFaceClustersTable, + createClusterPersonTable, + createClusterSummaryTable, + createNotPersonFeedbackTable, + fcClusterIDIndex, + ]; + // only have a single app-wide reference to the database static Future? _sqliteAsyncDBFuture; @@ -50,25 +59,30 @@ class FaceMLDataDB { _logger.info("Opening sqlite_async access: DB path " + databaseDirectory); final asyncDBConnection = SqliteDatabase(path: databaseDirectory, maxReaders: 2); - await _onCreate(asyncDBConnection); + await _migrate(asyncDBConnection); + return asyncDBConnection; } - Future _onCreate(SqliteDatabase asyncDBConnection) async { - try { - final startTime = DateTime.now(); - await asyncDBConnection.execute(createFacesTable); - await asyncDBConnection.execute(createFaceClustersTable); - await asyncDBConnection.execute(createClusterPersonTable); - await asyncDBConnection.execute(createClusterSummaryTable); - await asyncDBConnection.execute(createNotPersonFeedbackTable); - await asyncDBConnection.execute(fcClusterIDIndex); - _logger.info( - 'FaceMLDataDB tables created in ${DateTime.now().difference(startTime).inMilliseconds}ms', + Future _migrate( + SqliteDatabase database, + ) async { + final result = await database.execute('PRAGMA user_version'); + final currentVersion = result[0]['user_version'] as int; + final toVersion = _migrationScripts.length; + + if (currentVersion < toVersion) { + _logger.info("Migrating database from $currentVersion to $toVersion"); + await database.writeTransaction((tx) async { + for (int i = currentVersion + 1; i <= toVersion; i++) { + await tx.execute(_migrationScripts[i - 1]); + } + await tx.execute('PRAGMA user_version = $toVersion'); + }); + } else if (currentVersion > toVersion) { + throw AssertionError( + "currentVersion($currentVersion) cannot be greater than toVersion($toVersion)", ); - } catch (e, s) { - _logger.severe("Error creating FaceMLDataDB tables", e, s); - rethrow; } } From d413c4f4c117078d8b5bfaa43ab8a1c980f1f72a Mon Sep 17 00:00:00 2001 From: ashilkn Date: Mon, 27 May 2024 12:57:25 +0530 Subject: [PATCH 09/16] [mob][photos] Add try catch + logs for debugging in FaceMLDataDB --- mobile/lib/face/db.dart | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mobile/lib/face/db.dart b/mobile/lib/face/db.dart index c1b96767e..b00d56650 100644 --- a/mobile/lib/face/db.dart +++ b/mobile/lib/face/db.dart @@ -59,7 +59,13 @@ class FaceMLDataDB { _logger.info("Opening sqlite_async access: DB path " + databaseDirectory); final asyncDBConnection = SqliteDatabase(path: databaseDirectory, maxReaders: 2); + final stopwatch = Stopwatch()..start(); + _logger.info("FaceMLDataDB: Starting migration"); await _migrate(asyncDBConnection); + _logger.info( + "FaceMLDataDB Migration took ${stopwatch.elapsedMilliseconds} ms", + ); + stopwatch.stop(); return asyncDBConnection; } @@ -75,7 +81,12 @@ class FaceMLDataDB { _logger.info("Migrating database from $currentVersion to $toVersion"); await database.writeTransaction((tx) async { for (int i = currentVersion + 1; i <= toVersion; i++) { - await tx.execute(_migrationScripts[i - 1]); + try { + await tx.execute(_migrationScripts[i - 1]); + } catch (e) { + _logger.severe("Error running migration script index ${i - 1}", e); + rethrow; + } } await tx.execute('PRAGMA user_version = $toVersion'); }); From 9f361237b1c25e4a1bfbfc6c20050ce927357743 Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 27 May 2024 13:04:20 +0530 Subject: [PATCH 10/16] [mob][photos] Fix cluster appbar not showing --- mobile/lib/ui/viewer/people/cluster_app_bar.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/lib/ui/viewer/people/cluster_app_bar.dart b/mobile/lib/ui/viewer/people/cluster_app_bar.dart index 0896d0689..83ebe5428 100644 --- a/mobile/lib/ui/viewer/people/cluster_app_bar.dart +++ b/mobile/lib/ui/viewer/people/cluster_app_bar.dart @@ -97,7 +97,7 @@ class _AppBarWidgetState extends State { maxLines: 2, overflow: TextOverflow.ellipsis, ), - actions: kDebugMode ? _getDefaultActions(context) : null, + actions: _getDefaultActions(context), ); } From ced1f0bd7948dce1ac4fce0251f6eef42fc51932 Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 27 May 2024 14:55:52 +0530 Subject: [PATCH 11/16] [mob][photos] Don't remove last cluster of person --- .../viewer/people/person_clusters_page.dart | 64 +++++++++++-------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/mobile/lib/ui/viewer/people/person_clusters_page.dart b/mobile/lib/ui/viewer/people/person_clusters_page.dart index 2c493fc21..4f7454f31 100644 --- a/mobile/lib/ui/viewer/people/person_clusters_page.dart +++ b/mobile/lib/ui/viewer/people/person_clusters_page.dart @@ -38,12 +38,17 @@ class _PersonClustersPageState extends State { .getClusterFilesForPersonID(widget.person.remoteID), builder: (context, snapshot) { if (snapshot.hasData) { - final List keys = snapshot.data!.keys.toList(); + final clusters = snapshot.data!; + final List keys = clusters.keys.toList(); + // Sort the clusters by the number of files in each cluster, largest first + keys.sort( + (b, a) => clusters[a]!.length.compareTo(clusters[b]!.length), + ); return ListView.builder( itemCount: keys.length, itemBuilder: (context, index) { final int clusterID = keys[index]; - final List files = snapshot.data![keys[index]]!; + final List files = clusters[clusterID]!; return InkWell( onTap: () { Navigator.of(context).push( @@ -93,34 +98,37 @@ class _PersonClustersPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - "${snapshot.data![keys[index]]!.length} photos", + "${files.length} photos", style: getEnteTextTheme(context).body, ), - GestureDetector( - onTap: () async { - try { - await PersonService.instance - .removeClusterToPerson( - personID: widget.person.remoteID, - clusterID: clusterID, - ); - _logger.info( - "Removed cluster $clusterID from person ${widget.person.remoteID}", - ); - Bus.instance.fire(PeopleChangedEvent()); - setState(() {}); - } catch (e) { - _logger.severe( - "removing cluster from person,", - e, - ); - } - }, - child: const Icon( - CupertinoIcons.minus_circled, - color: Colors.red, - ), - ), + (index != 0) + ? GestureDetector( + onTap: () async { + try { + await PersonService.instance + .removeClusterToPerson( + personID: widget.person.remoteID, + clusterID: clusterID, + ); + _logger.info( + "Removed cluster $clusterID from person ${widget.person.remoteID}", + ); + Bus.instance + .fire(PeopleChangedEvent()); + setState(() {}); + } catch (e) { + _logger.severe( + "removing cluster from person,", + e, + ); + } + }, + child: const Icon( + CupertinoIcons.minus_circled, + color: Colors.red, + ), + ) + : const SizedBox.shrink(), ], ), ), From 8f474a4500c9a48c12700484c9ab1bf43c82f9e7 Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 27 May 2024 15:54:10 +0530 Subject: [PATCH 12/16] [mob][photos] Set MLController timer to 10 seconds --- .../machine_learning/machine_learning_controller.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mobile/lib/services/machine_learning/machine_learning_controller.dart b/mobile/lib/services/machine_learning/machine_learning_controller.dart index 40a52a419..3b78fd8c9 100644 --- a/mobile/lib/services/machine_learning/machine_learning_controller.dart +++ b/mobile/lib/services/machine_learning/machine_learning_controller.dart @@ -4,7 +4,6 @@ import "dart:io"; import "package:battery_info/battery_info_plugin.dart"; import "package:battery_info/model/android_battery_info.dart"; import "package:battery_info/model/iso_battery_info.dart"; -import "package:flutter/foundation.dart" show kDebugMode; import "package:logging/logging.dart"; import "package:photos/core/event_bus.dart"; import "package:photos/events/machine_learning_control_event.dart"; @@ -19,8 +18,7 @@ class MachineLearningController { static const kMaximumTemperature = 42; // 42 degree celsius static const kMinimumBatteryLevel = 20; // 20% - static const kDefaultInteractionTimeout = - kDebugMode ? Duration(seconds: 3) : Duration(seconds: 5); + static const kDefaultInteractionTimeout = Duration(seconds: 10); static const kUnhealthyStates = ["over_heat", "over_voltage", "dead"]; bool _isDeviceHealthy = true; From 9cf5691e426f939253eba61f73f86d6a7c23b5df Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 27 May 2024 17:09:33 +0530 Subject: [PATCH 13/16] [mob][photos] Delete instead of drop table --- mobile/lib/face/db.dart | 26 ++++++++++++-------------- mobile/lib/face/db_fields.dart | 16 +++++----------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/mobile/lib/face/db.dart b/mobile/lib/face/db.dart index b00d56650..abe4e1922 100644 --- a/mobile/lib/face/db.dart +++ b/mobile/lib/face/db.dart @@ -229,10 +229,10 @@ class FaceMLDataDB { final db = await instance.asyncDB; await db.execute(deleteFacesTable); - await db.execute(dropClusterPersonTable); - await db.execute(dropClusterSummaryTable); - await db.execute(deletePersonTable); - await db.execute(dropNotPersonFeedbackTable); + await db.execute(deleteFaceClustersTable); + await db.execute(deleteClusterPersonTable); + await db.execute(deleteClusterSummaryTable); + await db.execute(deleteNotPersonFeedbackTable); } Future> getFaceEmbeddingsForCluster( @@ -768,7 +768,7 @@ class FaceMLDataDB { try { final db = await instance.asyncDB; - await db.execute(dropFaceClustersTable); + await db.execute(deleteFaceClustersTable); await db.execute(createFaceClustersTable); await db.execute(fcClusterIDIndex); } catch (e, s) { @@ -979,16 +979,15 @@ class FaceMLDataDB { if (faces) { await db.execute(deleteFacesTable); await db.execute(createFacesTable); - await db.execute(dropFaceClustersTable); + await db.execute(deleteFaceClustersTable); await db.execute(createFaceClustersTable); await db.execute(fcClusterIDIndex); } - await db.execute(deletePersonTable); - await db.execute(dropClusterPersonTable); - await db.execute(dropNotPersonFeedbackTable); - await db.execute(dropClusterSummaryTable); - await db.execute(dropFaceClustersTable); + await db.execute(deleteClusterPersonTable); + await db.execute(deleteNotPersonFeedbackTable); + await db.execute(deleteClusterSummaryTable); + await db.execute(deleteFaceClustersTable); await db.execute(createClusterPersonTable); await db.execute(createNotPersonFeedbackTable); @@ -1006,9 +1005,8 @@ class FaceMLDataDB { final db = await instance.asyncDB; // Drop the tables - await db.execute(deletePersonTable); - await db.execute(dropClusterPersonTable); - await db.execute(dropNotPersonFeedbackTable); + await db.execute(deleteClusterPersonTable); + await db.execute(deleteNotPersonFeedbackTable); // Recreate the tables await db.execute(createClusterPersonTable); diff --git a/mobile/lib/face/db_fields.dart b/mobile/lib/face/db_fields.dart index e6a70a7d4..8ad14ae28 100644 --- a/mobile/lib/face/db_fields.dart +++ b/mobile/lib/face/db_fields.dart @@ -29,7 +29,7 @@ const createFacesTable = '''CREATE TABLE IF NOT EXISTS $facesTable ( ); '''; -const deleteFacesTable = 'DROP TABLE IF EXISTS $facesTable'; +const deleteFacesTable = 'DELETE FROM $facesTable'; // End of Faces Table Fields & Schema Queries //##region Face Clusters Table Fields & Schema Queries @@ -48,15 +48,9 @@ CREATE TABLE IF NOT EXISTS $faceClustersTable ( // -- Creating a non-unique index on clusterID for query optimization const fcClusterIDIndex = '''CREATE INDEX IF NOT EXISTS idx_fcClusterID ON $faceClustersTable($fcClusterID);'''; -const dropFaceClustersTable = 'DROP TABLE IF EXISTS $faceClustersTable'; +const deleteFaceClustersTable = 'DELETE FROM $faceClustersTable'; //##endregion -// People Table Fields & Schema Queries -const personTable = 'person'; - -const deletePersonTable = 'DROP TABLE IF EXISTS $personTable'; -//End People Table Fields & Schema Queries - // Clusters Table Fields & Schema Queries const clusterPersonTable = 'cluster_person'; const personIdColumn = 'person_id'; @@ -69,7 +63,7 @@ CREATE TABLE IF NOT EXISTS $clusterPersonTable ( PRIMARY KEY($personIdColumn, $clusterIDColumn) ); '''; -const dropClusterPersonTable = 'DROP TABLE IF EXISTS $clusterPersonTable'; +const deleteClusterPersonTable = 'DELETE FROM $clusterPersonTable'; // End Clusters Table Fields & Schema Queries /// Cluster Summary Table Fields & Schema Queries @@ -85,7 +79,7 @@ CREATE TABLE IF NOT EXISTS $clusterSummaryTable ( ); '''; -const dropClusterSummaryTable = 'DROP TABLE IF EXISTS $clusterSummaryTable'; +const deleteClusterSummaryTable = 'DELETE FROM $clusterSummaryTable'; /// End Cluster Summary Table Fields & Schema Queries @@ -99,5 +93,5 @@ CREATE TABLE IF NOT EXISTS $notPersonFeedback ( PRIMARY KEY($personIdColumn, $clusterIDColumn) ); '''; -const dropNotPersonFeedbackTable = 'DROP TABLE IF EXISTS $notPersonFeedback'; +const deleteNotPersonFeedbackTable = 'DELETE FROM $notPersonFeedback'; // End Clusters Table Fields & Schema Queries From 380d37267b99e994dbb2be636959cbc7e5467159 Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 27 May 2024 17:19:06 +0530 Subject: [PATCH 14/16] [mob][photos] Don't pop too often --- mobile/lib/ui/settings/machine_learning_settings_page.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mobile/lib/ui/settings/machine_learning_settings_page.dart b/mobile/lib/ui/settings/machine_learning_settings_page.dart index 0ea1588a0..257d5dd0f 100644 --- a/mobile/lib/ui/settings/machine_learning_settings_page.dart +++ b/mobile/lib/ui/settings/machine_learning_settings_page.dart @@ -89,8 +89,8 @@ class _MachineLearningSettingsPageState iconButtonType: IconButtonType.secondary, onTap: () { Navigator.pop(context); - Navigator.pop(context); - Navigator.pop(context); + if (Navigator.canPop(context)) Navigator.pop(context); + if (Navigator.canPop(context)) Navigator.pop(context); }, ), ], From 89a61b3bf7ea6fd5df0fd6e9f9bec9aa9dc0723c Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 27 May 2024 17:21:29 +0530 Subject: [PATCH 15/16] [mob][photos] Bump --- mobile/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml index 1417d17f3..d3f49380f 100644 --- a/mobile/pubspec.yaml +++ b/mobile/pubspec.yaml @@ -12,7 +12,7 @@ description: ente photos application # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.8.110+634 +version: 0.8.112+636 publish_to: none environment: From f25f119ca1b6f6deab2a797f8820c775c4bd8714 Mon Sep 17 00:00:00 2001 From: laurenspriem Date: Mon, 27 May 2024 17:26:14 +0530 Subject: [PATCH 16/16] [mob][photos] Copy --- mobile/lib/generated/intl/messages_en.dart | 2 +- mobile/lib/generated/l10n.dart | 4 ++-- mobile/lib/l10n/intl_en.arb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mobile/lib/generated/intl/messages_en.dart b/mobile/lib/generated/intl/messages_en.dart index baf50af58..b715eb485 100644 --- a/mobile/lib/generated/intl/messages_en.dart +++ b/mobile/lib/generated/intl/messages_en.dart @@ -814,7 +814,7 @@ class MessageLookup extends MessageLookupByLibrary { MessageLookupByLibrary.simpleMessage("Incorrect recovery key"), "indexedItems": MessageLookupByLibrary.simpleMessage("Indexed items"), "indexingIsPaused": MessageLookupByLibrary.simpleMessage( - "Indexing is paused. It will automatically resume when device is ready"), + "Indexing is paused. It will automatically resume when device is ready."), "insecureDevice": MessageLookupByLibrary.simpleMessage("Insecure device"), "installManually": diff --git a/mobile/lib/generated/l10n.dart b/mobile/lib/generated/l10n.dart index a6cd47cbd..23b67ff0b 100644 --- a/mobile/lib/generated/l10n.dart +++ b/mobile/lib/generated/l10n.dart @@ -8794,10 +8794,10 @@ class S { ); } - /// `Indexing is paused. It will automatically resume when device is ready` + /// `Indexing is paused. It will automatically resume when device is ready.` String get indexingIsPaused { return Intl.message( - 'Indexing is paused. It will automatically resume when device is ready', + 'Indexing is paused. It will automatically resume when device is ready.', name: 'indexingIsPaused', desc: '', args: [], diff --git a/mobile/lib/l10n/intl_en.arb b/mobile/lib/l10n/intl_en.arb index a63d8674e..df2894e4c 100644 --- a/mobile/lib/l10n/intl_en.arb +++ b/mobile/lib/l10n/intl_en.arb @@ -1236,5 +1236,5 @@ "faceRecognitionIndexingDescription": "Please note that this will result in a higher bandwidth and battery usage until all items are indexed.", "foundFaces": "Found faces", "clusteringProgress": "Clustering progress", - "indexingIsPaused": "Indexing is paused. It will automatically resume when device is ready" + "indexingIsPaused": "Indexing is paused. It will automatically resume when device is ready." }