owncloud / android

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

Fix Issue #4402 : Ensure all files are synchronized when setting folder to availab… #4407

Closed praveen7512 closed 3 weeks ago

praveen7512 commented 1 month ago

…le offline

This fix addresses the issue where setting a folder to available offline did not correctly synchronize all its contents, especially when some files were deleted locally. Now, all files within the folder will be synchronized and set to available offline as expected.

Related Issues

App:


QA

CLAassistant commented 1 month ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

jesmrec commented 1 month ago

Thanks for your contribution. We have another PR that fixes #4402, that is #4403... we will check yours as well.

JuancaG05 commented 1 month ago

Thanks for your contribution. We have another PR that fixes #4402, that is #4403... we will check yours as well.

That's right 😄, in any case, @praveen7512 you need to sign the Contributor License Agreement to be able to contribute to the ownCloud project (check https://github.com/owncloud/android/pull/4407#issuecomment-2120779790) 👍

Aitorbp commented 3 weeks ago

Hello @praveen7512! Thank you very much for sending us this PR. I advise you that before you start working on an issue, you see if there is already someone else working on it with another solution. I recommend you take a look at this PR where the solution is more accurate than the one you propose.

I'm afraid I'm going to close this PR because it's invalid, due to the following points:

  1. First of all, you've implemented the development logic in the wrong class. Before the code goes to SynchronizeFileUseCase, it has to go through SynchronizeFolderUseCase. It's in the fileRepository.refreshFolder function where you have to check if we've clicked on the available offline option. If you go back to the case I proposed in the issue, with the implementation you've developed it's not going to work.
  2. On the other hand, the variable isActionSetFolderAvailable Offline is not set to true in any case. Therefore it will always be set to false. Also in the FileOperationsHelper.java class you need to set the value of the parameter isActionSetFolderAvailable, otherwise Android Studio won't compile.
  3. Finally, the forceRefresh function is not necessary, since the problem is not that the data is not downloaded and synchronized, but that the files that are to be made available offline are not being transferred correctly.

So, due to all these errors and that it implies the majority of code in this PR, I'm closing it. In any case, thanks for your PR and do not hesitate to open more PRs, we will be happy to review your code again. 😃