owncloud / android

:phone: The ownCloud Android App
GNU General Public License v2.0
3.76k stars 3.09k forks source link

[BUG] Av. offline operation does not work correctly when run from a parent folder #4403

Closed Aitorbp closed 4 weeks ago

Aitorbp commented 1 month ago

Related Issues

App: https://github.com/owncloud/android/issues/4402


QA

Aitorbp commented 1 month ago

Following this same use case:

  1. If we have the following tree of files in our account: Folder1 File1 -> downloaded Folder2 FIle2 -> downloaded File3 -> downloaded
  2. We delete the file file2 locally
  3. We go to the parent folder and set it to av.offline
  4. We wait for the process to finish and click on Unset available offline.
  5. We navigate to folder2 and observe that file2 has not been downloaded.

The problem is that when doing a Set available offline on a folder that has subfolders with downloaded files, the remote and local etag does not change, this is fine because there has been no remote change that updates the etag.

But in addition to that, another condition that we have for it to refresh the files in that folder will not be fulfit either. When we compared on Folder2 if the localChildToSync.localModificationTimestamp > remoteChild.lastSyncDateForData they will both result in 0 as this value for folders will always be zero.

Therefore, with the new logic there would be nothing to refresh and it will not synchronize the files contained in that subfolder.

Another option that was considered to fix this was to control the keepInSync parameter, but this is not updated until the end of the refresh function, when we have already received the files that we want to synchronize and sub folder2 is not among them.

To not further change the logic of the refreshFolder function as a conclusion, a new parameter in SynchronizeFolderUseCase called isActionSetFolderAvailableOffline set by default to false will be created. When we perform the operation it will be set to true and a refresh of all the contents of that folder will be performed.