-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[FEATURE REQUEST] Folder with "Local only" remove option #4289
[FEATURE REQUEST] Folder with "Local only" remove option #4289
Conversation
Hey @JuancaG05, I did implement the recursive logic to check for local files. However, I had a question before going further. Could you give it a quick high level look to my logic below and let me know If I'm going right? Here's how the flow looks ->
I wanted to put the common logic of launching a usecase in a common place and I believe These question involves architectural decisions so needed an advice. Also, If whole approach isn't the correct approach let me know. |
Hi @parneet-guraya! I'm happy that you asked so that we can see if it is in the correct path before going further 😃. Some things to consider here:
In recursivity, there is a basic case and a recursive case. The basic case has to return something, and the recursive case just iterate again over the same function. In our case, the basic case would be the I hope these points could help you. Keep the good work! 💪 |
Initially I added the usecase in
Didn't need to use the file. Will definitely do the migration if ever touch this file in future and yes I'm also comfortable with java.
Again I originally added the usecase in domain layer and yes you're right business logic should be the part of domain layer. It's just that I saw the usecases in the UI layer as well and thought maybe I can add this here as it is closely related to UI and not being used elsewhere. But, as you said those usecases were exceptions :-)
Thankyou for clearing my doubts 👍 @JuancaG05 |
Let me see If I can explain it. For one shot operations like this let's see which one is more suitable
However we can set Another solution I have seen being used is Coroutines There is an interesting article (from the guy who is part of coroutines team) talking about how
Right now I just pushed the code with LiveData and it works fine. I think we can go forward with LiveData for this one and I can migrate from using LiveData to better solution for the all the file operations in the |
4d35efb
to
7f3e89c
Compare
Well, you can see that there are some operations in that VM that take care of the deep link, setting last usage in the file, etc, so it's not only that you do operations with the file but also related to it 😄 like this one. But in case you wanted to make it available for single files, this ViewModel is already accessible from every preview.
Let's use |
Also, this will be merged or not depending on performance. It implies several accesses to DB in the worst case (very deep hierarchy and none of the files is available offline, so we have to check all of them) to just show the dialog, so we'll see when it is in QA phase if this is really worth it or it is actually better to live without it despite not having the feature 😄 |
Hi @parneet-guraya! Will you continue the work started here? Just to take it into account in our planning or not 😃 |
Hi, @JuancaG05 . I'm going to, just lagging behind with my other stuff. Will update this ASAP :-). And yes I'm aware and thought the same about the case when folder hierarchy is deep. So let's see how it performs in QA. |
Hi @JuancaG05, 👋 About returning |
Hey @parneet-guraya! I think the best option here is keeping those selected files in a variable in the fragment. Indeed, we already have one variable for that in |
Hey @parneet-guraya, this seems a bit blocked, do you want us to continue the work started here or will you finish it when you have some time? 😃 |
Hi @JuancaG05 👋, unfortunately due to some ongoing situation in our state. The internet is shut down temporarily by gov in some cities and one of them is mine. So that's why I couldn't get to work on this. I was in another city today and now I saw this comment. I will finish this as soon as I get a chance :-) . |
hi @JuancaG05 👋 , I'm back :-). I can see the point about making usecases reusable, I will remove the usage of Pair in this case. However, I need a little help in deciding what observable should we choose to reflect ui state for this one shot operation?
Livedata works similar to StateFlow which is upon coming back we would get latest value and the problem of consuming same success state again on config change already have a solution in place, usage of Event class to only handle event that are not consumed earlier using MediatorLiveData. Could you help me out here in deciding what should be ideal Flow api to use in this case? |
Hi @parneet-guraya! Nice to hear from you again!
I would say using |
0cfe906
to
e756e89
Compare
Hi @JuancaG05 👋 , It's good to be back :-) I used |
Nice @parneet-guraya! Let me know then when it is ready for code review. Just request me a review in the PR and I will do 😸 |
@JuancaG05, I'm not seeing any option to request review. Anyways it's ready for it. |
It's in the upper right part of the PR, where it says "Reviewers". I'll request myself a review for you to see it 😁 |
@JuancaG05 , I'm aware of this :-) but I didn't see the options to choose a reviewer maybe because I don't have permission to do that? |
Aaah, could be! Ok, no worries, I'll review it whenever I'm available 😁 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @parneet-guraya! Nice work here! I just left some comments for you to review, sorry for the delay 😄. Also, two more things:
- I see you finally used
SharedFlow
as I recommended, but I can see that we sometimes useStateFlow
withEvent
, just as you said that could work withLiveData
to avoid processing success more than once. If you feel more comfortable with this or you don't feel sure about usingSharedFlow
, you can use it, just as we do indeepLinkFlow
👍 - I modified the PR first message for you to take into account that, now, in addition to calens, we also add the release note in the corresponding ViewModel in each PR so that it can be translated to different languages before releasing. The check indicates where it is located, but if you have any doubt just ask me, shouldn't be difficult 😃
...main/src/main/java/com/owncloud/android/domain/files/usecases/GetIfFileFolderLocalUseCase.kt
Outdated
Show resolved
Hide resolved
...main/src/main/java/com/owncloud/android/domain/files/usecases/GetIfFileFolderLocalUseCase.kt
Outdated
Show resolved
Hide resolved
...main/src/main/java/com/owncloud/android/domain/files/usecases/GetIfFileFolderLocalUseCase.kt
Outdated
Show resolved
Hide resolved
...main/src/main/java/com/owncloud/android/domain/files/usecases/GetIfFileFolderLocalUseCase.kt
Outdated
Show resolved
Hide resolved
...rc/main/java/com/owncloud/android/presentation/files/removefile/RemoveFilesDialogFragment.kt
Outdated
Show resolved
Hide resolved
...rc/main/java/com/owncloud/android/presentation/files/removefile/RemoveFilesDialogFragment.kt
Outdated
Show resolved
Hide resolved
.../src/main/java/com/owncloud/android/presentation/files/operations/FileOperationsViewModel.kt
Outdated
Show resolved
Hide resolved
...udApp/src/main/java/com/owncloud/android/presentation/files/filelist/MainFileListFragment.kt
Show resolved
Hide resolved
...udApp/src/main/java/com/owncloud/android/presentation/files/filelist/MainFileListFragment.kt
Show resolved
Hide resolved
Signed-off-by: parneet-guraya <[email protected]>
Signed-off-by: parneet-guraya <[email protected]>
Signed-off-by: parneet-guraya <[email protected]>
Signed-off-by: parneet-guraya <[email protected]>
e756e89
to
18017ca
Compare
Hi @JuancaG05 , you are correct with the fact that we can use Event to avoid duplicate updates with using StateFlow. But, I encountered a strange behavior that it only emits first update and subsequent updates were not getting collected. After a deep dive I came to conclusion that it is because the But, I also tried to put some delay before emitting But to keep this one going, for now we have these options to choose from -->
Now after this only key difference of behavior we will get is, with PS: I pushed the requested changes and kept implementation to |
...udApp/src/main/java/com/owncloud/android/presentation/files/filelist/MainFileListFragment.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @parneet-guraya! Just a tiny change here for the release note and we're done. All right, let's keep SharedFlow
and we'll see if the behaviour is the expected in the QA phase 😁
Signed-off-by: parneet-guraya <[email protected]>
18017ca
to
3b57080
Compare
@JuancaG05 Done 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!! Great job @parneet-guraya!! 🚀 Let's move it to QA, where @jesmrec will do his stuff 😁
On it... |
Feature works fine and is performant for deep and wide folder structures to look for downloaded files as "removables" While checking this, i detected a bad behaviour that will be moved to another issue because is out of scope here: If there is av. offline stuff inside the folder, the This one is approved on my side |
Fixes: #3936
ReleaseNotesViewModel.kt
creating a newReleaseNote()
with String resources (if required)Record_2024-01-26-09-45-11.mp4