diff --git a/lib/objectbox.dart b/lib/objectbox.dart index e37c6e6..3edd90c 100644 --- a/lib/objectbox.dart +++ b/lib/objectbox.dart @@ -353,8 +353,8 @@ class ObjectBox { }); } - Future DeletePreviousVisitWithoutPhoto() async { - final visits = getPreviousVisit(); + Future DeleteVisitWithoutPhoto() async { + final visits = getAllVisit(); for (final visit in visits) { final photoCount = getVisitPhotoCount(visit.id_visite); diff --git a/lib/ui/sync/tab_synchro.dart b/lib/ui/sync/tab_synchro.dart index 73ffa1f..85be5b1 100644 --- a/lib/ui/sync/tab_synchro.dart +++ b/lib/ui/sync/tab_synchro.dart @@ -206,6 +206,12 @@ class _SynchronizationPageState extends State final ApiProvider _apiProvider = ApiProvider(); + // upload photo to server + await _uploadVisitPhotos(_apiProvider); + + // delete visits without a photo! + await objectbox.DeleteVisitWithoutPhoto(); + // synchronous calendar synchronization final syncCalendarResult = await _apiProvider.SyncCalendar(); @@ -214,19 +220,14 @@ class _SynchronizationPageState extends State _backofficeSyncCompleted = true; } - // upload photo to server - await _uploadVisitPhotos(_apiProvider); - - final syncLogResult = _syncLog ? await _apiProvider.SyncCalendar() : 'OK'; + // synchronous logs synchronization + final syncLogResult = _syncLog ? await _apiProvider.SyncLog() : 'OK'; // log synchronization OK ? if (syncLogResult == 'OK') { _logSyncCompleted = true; } - // delete visits without a photo! - await objectbox.DeletePreviousVisitWithoutPhoto(); - // deletes photos that are no longer in any visits await _cleanVisitPhotoDir(); diff --git a/lib/ui/visit/visit_photo_typology_detail.dart b/lib/ui/visit/visit_photo_typology_detail.dart index cb99345..70c307c 100644 --- a/lib/ui/visit/visit_photo_typology_detail.dart +++ b/lib/ui/visit/visit_photo_typology_detail.dart @@ -174,7 +174,7 @@ class _VisitPhotoTypologyDetailPageState //_shoppingCartCount++; }); Fluttertoast.showToast( - msg: 'Item has been added to Shopping Cart', + msg: 'Item has been added to Shopping Card', toastLength: Toast.LENGTH_LONG); }, child: Container(