File tree 1 file changed +22
-2
lines changed
app/src/main/java/com/owncloud/android/operations
1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ protected RemoteOperationResult run(OwnCloudClient client) {
138
138
}
139
139
140
140
if (result .isSuccess ()) {
141
- syncContents ();
141
+ syncContents (client );
142
142
}
143
143
}
144
144
@@ -440,9 +440,29 @@ private void prepareOpsFromLocalKnowledge() throws OperationCancelledException {
440
440
}
441
441
}
442
442
443
- private void syncContents () throws OperationCancelledException {
443
+ private void syncContents (OwnCloudClient client ) throws OperationCancelledException {
444
444
startDirectDownloads ();
445
445
startContentSynchronizations (mFilesToSyncContents );
446
+ updateETag (client );
447
+ }
448
+
449
+ /**
450
+ * Updates the eTag of the local folder after a successful synchronization.
451
+ * This ensures that any changes to local files, which may alter the eTag, are correctly reflected.
452
+ *
453
+ * @param client the OwnCloudClient instance used to execute remote operations.
454
+ */
455
+ private void updateETag (OwnCloudClient client ) {
456
+ ReadFolderRemoteOperation operation = new ReadFolderRemoteOperation (mRemotePath );
457
+ final var result = operation .execute (client );
458
+
459
+ if (result .getData ().get (0 ) instanceof RemoteFile remoteFile ) {
460
+ String eTag = remoteFile .getEtag ();
461
+ mLocalFolder .setEtag (eTag );
462
+
463
+ final FileDataStorageManager storageManager = getStorageManager ();
464
+ storageManager .saveFile (mLocalFolder );
465
+ }
446
466
}
447
467
448
468
private void startDirectDownloads () {
You can’t perform that action at this time.
0 commit comments