Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Refactor

Neeraj Guptad769cfad55cb
diff --git a/mobile/ios/Podfile.lock b/mobile/ios/Podfile.lock
index 3e4684855a..05b45bbd44 100644
--- a/mobile/ios/Podfile.lock
+++ b/mobile/ios/Podfile.lock
@@ -223,6 +223,8 @@ PODS:
- sqlite3/fts5
- sqlite3/perf-threadsafe
- sqlite3/rtree
+ - system_info_plus (0.0.1):
+ - Flutter
- Toast (4.1.1)
- ua_client_hints (1.4.0):
- Flutter
@@ -290,6 +292,7 @@ DEPENDENCIES:
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
- sqlite3_flutter_libs (from `.symlinks/plugins/sqlite3_flutter_libs/ios`)
+ - system_info_plus (from `.symlinks/plugins/system_info_plus/ios`)
- ua_client_hints (from `.symlinks/plugins/ua_client_hints/ios`)
- uni_links (from `.symlinks/plugins/uni_links/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
@@ -418,6 +421,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/sqflite_darwin/darwin"
sqlite3_flutter_libs:
:path: ".symlinks/plugins/sqlite3_flutter_libs/ios"
+ system_info_plus:
+ :path: ".symlinks/plugins/system_info_plus/ios"
ua_client_hints:
:path: ".symlinks/plugins/ua_client_hints/ios"
uni_links:
@@ -501,6 +506,7 @@ SPEC CHECKSUMS:
sqflite_darwin: a553b1fd6fe66f53bbb0fe5b4f5bab93f08d7a13
sqlite3: 0bb0e6389d824e40296f531b858a2a0b71c0d2fb
sqlite3_flutter_libs: c00457ebd31e59fa6bb830380ddba24d44fbcd3b
+ system_info_plus: 5393c8da281d899950d751713575fbf91c7709aa
Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e
ua_client_hints: 46bb5817a868f9e397c0ba7e3f2f5c5d90c35156
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
diff --git a/mobile/ios/Runner.xcodeproj/project.pbxproj b/mobile/ios/Runner.xcodeproj/project.pbxproj
index 142efc1059..86d7aa2535 100644
--- a/mobile/ios/Runner.xcodeproj/project.pbxproj
+++ b/mobile/ios/Runner.xcodeproj/project.pbxproj
@@ -334,6 +334,7 @@
"${BUILT_PRODUCTS_DIR}/sqflite_darwin/sqflite_darwin.framework",
"${BUILT_PRODUCTS_DIR}/sqlite3/sqlite3.framework",
"${BUILT_PRODUCTS_DIR}/sqlite3_flutter_libs/sqlite3_flutter_libs.framework",
+ "${BUILT_PRODUCTS_DIR}/system_info_plus/system_info_plus.framework",
"${BUILT_PRODUCTS_DIR}/ua_client_hints/ua_client_hints.framework",
"${BUILT_PRODUCTS_DIR}/uni_links/uni_links.framework",
"${BUILT_PRODUCTS_DIR}/url_launcher_ios/url_launcher_ios.framework",
@@ -428,6 +429,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite_darwin.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqlite3.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqlite3_flutter_libs.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/system_info_plus.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ua_client_hints.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/uni_links.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher_ios.framework",
diff --git a/mobile/lib/services/machine_learning/face_ml/face_recognition_service.dart b/mobile/lib/services/machine_learning/face_ml/face_recognition_service.dart
index 942a20ea34..25985e534b 100644
--- a/mobile/lib/services/machine_learning/face_ml/face_recognition_service.dart
+++ b/mobile/lib/services/machine_learning/face_ml/face_recognition_service.dart
@@ -37,7 +37,7 @@ class FaceRecognitionService {
// Listen on DiffSync
Bus.instance.on<DiffSyncCompleteEvent>().listen((event) async {
- unawaited(_syncPersonFeedback());
+ unawaited(syncPersonFeedback());
});
// Listen on PeopleChanged
@@ -50,23 +50,22 @@ class FaceRecognitionService {
_logger.info('init done');
}
- Future<void> sync() async {
- await _syncPersonFeedback();
- }
-
- Future<void> _syncPersonFeedback() async {
+ Future<void> syncPersonFeedback() async {
if (_isSyncing) {
return;
}
_isSyncing = true;
- if (_shouldReconcilePeople) {
- await PersonService.instance.reconcileClusters();
- Bus.instance.fire(PeopleChangedEvent(type: PeopleEventType.syncDone));
- _shouldReconcilePeople = false;
- } else {
- await entityService.syncEntity(EntityType.cgroup);
+ try {
+ if (_shouldReconcilePeople) {
+ await PersonService.instance.reconcileClusters();
+ Bus.instance.fire(PeopleChangedEvent(type: PeopleEventType.syncDone));
+ _shouldReconcilePeople = false;
+ } else {
+ await entityService.syncEntity(EntityType.cgroup);
+ }
+ } finally {
+ _isSyncing = false;
}
- _isSyncing = false;
}
static Future<List<FaceResult>> runFacesPipeline(
diff --git a/mobile/lib/services/machine_learning/ml_service.dart b/mobile/lib/services/machine_learning/ml_service.dart
index ef064068fd..a9f300d74c 100644
--- a/mobile/lib/services/machine_learning/ml_service.dart
+++ b/mobile/lib/services/machine_learning/ml_service.dart
@@ -116,7 +116,7 @@ class MLService {
Future<void> sync() async {
await FileDataService.instance.syncFDStatus();
- await faceRecognitionService.sync();
+ await faceRecognitionService.syncPersonFeedback();
}
Future<void> runAllML({bool force = false}) async {
diff --git a/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart b/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart
index 098845c657..b51515c5c1 100644
--- a/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart
+++ b/mobile/lib/ui/settings/debug/ml_debug_section_widget.dart
@@ -288,7 +288,7 @@ class _MLDebugSectionWidgetState extends State<MLDebugSectionWidget> {
trailingIconIsMuted: true,
onTap: () async {
try {
- await faceRecognitionService.sync();
+ await faceRecognitionService.syncPersonFeedback();
showShortToast(context, "Done");
} catch (e, s) {
logger.warning('sync person mappings failed ', e, s);