File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed
app/src/main/java/com/owncloud/android/operations Expand file tree Collapse file tree 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) {
138138 }
139139
140140 if (result .isSuccess ()) {
141- syncContents ();
141+ syncContents (client );
142142 }
143143 }
144144
@@ -440,9 +440,29 @@ private void prepareOpsFromLocalKnowledge() throws OperationCancelledException {
440440 }
441441 }
442442
443- private void syncContents () throws OperationCancelledException {
443+ private void syncContents (OwnCloudClient client ) throws OperationCancelledException {
444444 startDirectDownloads ();
445445 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+ }
446466 }
447467
448468 private void startDirectDownloads () {
You can’t perform that action at this time.
0 commit comments