Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: fix/av_offline_files_removed_locally_with_local_only_option
Choose a base branch
from

Conversation

Aitorbp
Copy link
Contributor

@Aitorbp Aitorbp commented May 10, 2024

Related Issues

App: #4402

  • Add changelog files for the fixed issues in folder changelog/unreleased. More info here
  • Add feature to Release Notes in ReleaseNotesViewModel.kt creating a new ReleaseNote() with String resources (No required)

QA

@Aitorbp Aitorbp self-assigned this May 10, 2024
@Aitorbp Aitorbp force-pushed the fix/av_offline_operation_does_not_work_when_run_from_parent_folder branch 2 times, most recently from 402f620 to 35ce6ba Compare May 13, 2024 07:16
@Aitorbp
Copy link
Contributor Author

Aitorbp commented May 13, 2024

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.

Copy link
Collaborator

@JuancaG05 JuancaG05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some changes requested here @Aitorbp

@@ -51,6 +53,7 @@ class SynchronizeFolderUseCase(
accountName = accountName,
spaceId = ocFile.spaceId,
syncMode = params.syncMode,
isActionSetFolderAvailableOffline = params.isActionSetFolderAvailableOffline,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this parameter needed in both calls to refresh? I mean, in line 44 and here, maybe we can save the one from line 44?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to be on both sides. When we encounter a subfolder scenario, if we do not continue setting the isActionSetFolderAvailableOffline parameter it will default to false, when in reality we are setting all content available offline. Then the content of these subfolders will not be downloaded or synchronized.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this should only apply to files, right? Passing it as parameter to folders is just needed to transmit it until we arrive to a file, and we're doing it in the recursive call. In line 44 we're passing it to a refresh, where we don't need to check the new condition. Am I missing something?

@Aitorbp Aitorbp changed the base branch from master to fix/av_offline_files_removed_locally_with_local_only_option June 3, 2024 15:22
@Aitorbp Aitorbp requested a review from JuancaG05 June 3, 2024 15:24
@Aitorbp Aitorbp force-pushed the fix/av_offline_files_removed_locally_with_local_only_option branch from c753572 to 3f9a8e8 Compare June 3, 2024 15:52
@JuancaG05 JuancaG05 changed the title [BUG] Av.offline operation does not work correctly when run from a parent folder [BUG] Av. offline operation does not work correctly when run from a parent folder Jun 4, 2024
@Aitorbp Aitorbp force-pushed the fix/av_offline_files_removed_locally_with_local_only_option branch from c3f0242 to 9d25437 Compare June 4, 2024 11:56
@Aitorbp Aitorbp force-pushed the fix/av_offline_operation_does_not_work_when_run_from_parent_folder branch from 89a67e4 to 399b174 Compare June 4, 2024 12:22
@Aitorbp Aitorbp force-pushed the fix/av_offline_operation_does_not_work_when_run_from_parent_folder branch from 399b174 to a4b67f9 Compare June 4, 2024 12:46
Copy link
Collaborator

@JuancaG05 JuancaG05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check my reply to a comment of the previous CR @Aitorbp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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