Sync remote assets to local

This commit is contained in:
Neeraj Gupta
2025-04-18 14:00:14 +05:30
parent 747b1b84c6
commit 151a0d13a4
2 changed files with 6 additions and 2 deletions

View File

@@ -100,7 +100,7 @@ class RemoteSyncService {
}
Future<void> sync({bool silently = false}) async {
if (!_config.hasConfiguredAccount() || true) {
if (!_config.hasConfiguredAccount()) {
_logger.info("Skipping remote sync since account is not configured");
return;
}
@@ -130,7 +130,7 @@ class RemoteSyncService {
await syncDeviceCollectionFilesForUpload();
}
await _pullDiff();
await trashSyncService.syncTrash();
// await trashSyncService.syncTrash();
if (!hasSyncedBefore) {
await _prefs.setBool(_isFirstRemoteSyncDone, true);
await syncDeviceCollectionFilesForUpload();
@@ -197,6 +197,8 @@ class RemoteSyncService {
}
}
} finally {
_existingSync?.complete();
_existingSync = null;
_isExistingSyncSilent = false;
}
}
@@ -219,6 +221,7 @@ class RemoteSyncService {
Future<void> _pullDiff() async {
await newService.syncFromRemote();
return;
_logger.info("Pulling remote diff");
final isFirstSync = !_collectionsService.hasSyncedCollections();
if (isFirstSync && !_isExistingSyncSilent) {

View File

@@ -195,6 +195,7 @@ class SyncService {
if (localSyncOnly) {
await LocalImportService.instance.incrementalSync();
await LocalImportService.instance.fullSync();
await _remoteSyncService.sync();
unawaited(LocalImportService.instance.metadataScan());
return;
}