Offline Pages : PageList Item Progress State - #11191
Conversation
Note : layout isn't optimized for status labels to be displayed above overlay. This optimization is outside the scope of this PR.
|
You can test the changes on this Pull Request by downloading the APK here. |
9273eb4 to
a0a724b
Compare
malinajirka
left a comment
There was a problem hiding this comment.
Thanks @jd-alexander! I've reviewed the code again and noticed a few more things. Let me know what you think.
I also tested the app and I encountered following issues:
1.
- Open Page List
- Click on the overflow menu on one of the items
- Click eg. on "Move to drafts" or "Publish Now"
- Boom
2020-02-06 13:55:42.744 E: FATAL EXCEPTION: DefaultDispatcher-worker-5
Process: org.wordpress.android.beta, PID: 17352
java.lang.IllegalStateException: post must not be null
at org.wordpress.android.viewmodel.pages.PageItemUploadProgressHelper.getProgressStateForPage(PageItemUploadProgressHelper.kt:43)
at org.wordpress.android.viewmodel.pages.PageListViewModel.preparePublishedPages(PageListViewModel.kt:253)
at org.wordpress.android.viewmodel.pages.PageListViewModel.access$preparePublishedPages(PageListViewModel.kt:48)
at org.wordpress.android.viewmodel.pages.PageListViewModel$loadPagesAsync$1.invokeSuspend(PageListViewModel.kt:170)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:561)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:727)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:667)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:655)
-
When I open a page -> change title -> click on back -> the progress indicator never disappears.
-
Probably not related to this PR, but I'm curious if you know why. We hide the progress indicator when the upload finishes -> how come the "local changes" label disappears after another +- 3 seconds?
|
Thanks for the review!
|
|
I fixed the issues below :
|
|
Thanks for the changes @jd-alexander! I know you said you haven't had a chance to do thorough tests after the latest changes. I decided to review the PR anyway so we speed things up a bit. Have you investigated how come the post is null? I wouldn't expect it to be null after clicking on the overflow menu. 👍 If I understand the fix correctly, we won't hide the progress indicator when the upload completes and we let the existing logic handle the refresh of the item, right? Tbh I'm getting a bit lost in the logic - it feels weird that we don't need to invalidate the status when upload completes successfully. Would you mind discussing this on a call. Thanks! I've encountered the following crash
|
|
Thanks for the review!
It doesn't seem like this is the case. Based on a glance I just did at the Flux C code, an update query is run. Nonetheless, I created an issue to track this and continue the investigation. #11260
I understand this clearly. I did the invalidation but I am seeing what is causing the error now. Will share on the call. |
malinajirka
left a comment
There was a problem hiding this comment.
Thanks @jd-alexander! As we discussed I'm approving this PR even though it still contains some issues. We are merging it into a feature-branch, so it shouldn't matter. We'll be able to create more smaller PRs.
I can't merge since the connected test failed. Feel free to merge it when the issue is fixed (it's probably just a flaky test and restart of the flow should fix it).
|
Thanks @malinajirka I created issues for all the outstanding bugs that need to be resolved based on our exploration. I will merge this now since they are being tracked. Thanks for the reviews! Now time to add the other PRs that depend on the |
Fixes #11127
Findings
The Post List support showing progress for uploads and since pages are posts then the implementation for the Post List can be adapted for the Page List.
Solution
To utilize existing classes and logic that's used for the Post List progress state to power the Page List. This primarily involves creating new classes for this behavior since refactoring the logic for the Post List to support Pages might not be in our best interest at this point since we aren't sure what will need to be shared.
An additional improvement that was made in this PR was to create a component similar to
PostListEventListenercalledPageListEventListenerso that the calls and events from thedispatcherare encapsulated in a central component to reduce the clutter in thePagesViewModel. While doing the review, I would appreciate if the coroutine and overall thread usage could be checked to ensure it is correct.Testing
For all these tests it's best to change the device's network type to GSM and it's signal strength to poor to observe the state changes in the list.
Upload Page Offline
Page List Itemto display an indeterminateProgressBarand an overlay on the row contents.Upload Page with Image/Video Offline
Page List Itemto display a determinateProgressBarand an overlay on the row contents.ProgressBarshould show the percentage of the current upload.ProgressBarswitches back toIndeterminateto finish the upload.Other testing considerations
My Sitepage and then click thePagesbutton and ensure the correct state is being shown.Hiddenonce the upload is complete or an error takes place. (Error wasn't implemented in this PR, it possibly just switches back to the local changes label and shows the error in the notification section.)PostListEventListenerthat inspired thePageListEventListenerIt's important that a comparison between both behaviors are done to ensure that the upload state is reacting effectively to this. Some of the events that weren't copied over were related to showing error and success states so those were left for future PRs. Only events that modify the upload state were utilized.statuslabel being above the overlay since it was outside the scope of this PR, so in the tests that will be noticeable.Reviewing
Only 1 reviewer is needed but anyone can review.
Submitter Checklist
RELEASE-NOTES.txtif necessary.