Simplify
This commit is contained in:
@@ -121,16 +121,19 @@ class RemoteSyncService {
|
||||
// use flag to decide if we should start marking files for upload before
|
||||
// remote-sync is done. This is done to avoid adding existing files to
|
||||
// the same or different collection when user had already uploaded them
|
||||
// before.
|
||||
final bool hasSyncedBefore = _prefs.containsKey(_isFirstRemoteSyncDone);
|
||||
if (hasSyncedBefore) {
|
||||
await queueLocalAssetForUpload();
|
||||
}
|
||||
await _pullDiff();
|
||||
await trashSyncService.syncTrash();
|
||||
if (!hasSyncedBefore) {
|
||||
// Handle first-time sync vs subsequent syncs
|
||||
final bool isFirstSync = !_prefs.containsKey(_isFirstRemoteSyncDone);
|
||||
if (isFirstSync) {
|
||||
// For first sync, pull remote diff first, then queue uploads
|
||||
await _pullDiff();
|
||||
await trashSyncService.syncTrash();
|
||||
await _prefs.setBool(_isFirstRemoteSyncDone, true);
|
||||
await queueLocalAssetForUpload();
|
||||
} else {
|
||||
// For subsequent syncs, queue uploads before remote sync
|
||||
await queueLocalAssetForUpload();
|
||||
await _pullDiff();
|
||||
await trashSyncService.syncTrash();
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user