fix: Synchro
parent
1ddc35136a
commit
b27126cac2
|
|
@ -353,8 +353,8 @@ class ObjectBox {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> DeletePreviousVisitWithoutPhoto() async {
|
Future<void> DeleteVisitWithoutPhoto() async {
|
||||||
final visits = getPreviousVisit();
|
final visits = getAllVisit();
|
||||||
|
|
||||||
for (final visit in visits) {
|
for (final visit in visits) {
|
||||||
final photoCount = getVisitPhotoCount(visit.id_visite);
|
final photoCount = getVisitPhotoCount(visit.id_visite);
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,12 @@ class _SynchronizationPageState extends State<SynchronizationPage>
|
||||||
|
|
||||||
final ApiProvider _apiProvider = ApiProvider();
|
final ApiProvider _apiProvider = ApiProvider();
|
||||||
|
|
||||||
|
// upload photo to server
|
||||||
|
await _uploadVisitPhotos(_apiProvider);
|
||||||
|
|
||||||
|
// delete visits without a photo!
|
||||||
|
await objectbox.DeleteVisitWithoutPhoto();
|
||||||
|
|
||||||
// synchronous calendar synchronization
|
// synchronous calendar synchronization
|
||||||
final syncCalendarResult = await _apiProvider.SyncCalendar();
|
final syncCalendarResult = await _apiProvider.SyncCalendar();
|
||||||
|
|
||||||
|
|
@ -214,19 +220,14 @@ class _SynchronizationPageState extends State<SynchronizationPage>
|
||||||
_backofficeSyncCompleted = true;
|
_backofficeSyncCompleted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// upload photo to server
|
// synchronous logs synchronization
|
||||||
await _uploadVisitPhotos(_apiProvider);
|
final syncLogResult = _syncLog ? await _apiProvider.SyncLog() : 'OK';
|
||||||
|
|
||||||
final syncLogResult = _syncLog ? await _apiProvider.SyncCalendar() : 'OK';
|
|
||||||
|
|
||||||
// log synchronization OK ?
|
// log synchronization OK ?
|
||||||
if (syncLogResult == 'OK') {
|
if (syncLogResult == 'OK') {
|
||||||
_logSyncCompleted = true;
|
_logSyncCompleted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete visits without a photo!
|
|
||||||
await objectbox.DeletePreviousVisitWithoutPhoto();
|
|
||||||
|
|
||||||
// deletes photos that are no longer in any visits
|
// deletes photos that are no longer in any visits
|
||||||
await _cleanVisitPhotoDir();
|
await _cleanVisitPhotoDir();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ class _VisitPhotoTypologyDetailPageState
|
||||||
//_shoppingCartCount++;
|
//_shoppingCartCount++;
|
||||||
});
|
});
|
||||||
Fluttertoast.showToast(
|
Fluttertoast.showToast(
|
||||||
msg: 'Item has been added to Shopping Cart',
|
msg: 'Item has been added to Shopping Card',
|
||||||
toastLength: Toast.LENGTH_LONG);
|
toastLength: Toast.LENGTH_LONG);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue