Issue/11133 update page item labels - #11278
Conversation
…update-page-item-labels
Generated by 🚫 dangerJS |
|
You can test the changes on this Pull Request by downloading the APK here. |
| uploadUiState, | ||
| pagePostStatus | ||
| ) | ||
| uploadUiState.error.postError != null -> UploadUtils.getErrorMessageResIdFromPostError( |
There was a problem hiding this comment.
Hi Jirka, the error labels that are returned from here all say post instead of page I think it's because the UploadUtils.getErrorMessageResIdFromPostError only support posts at the moment and it's isPage parameter is set to false. Let me know what you think.
There was a problem hiding this comment.
Great job on this @malinajirka! Most of the states and their respective labels work except for a few.
- These were the labels that didn't have page :
Auto-upload failed but the changes are still enqueued for auto-upload
- We couldn't publish this page, but we'll try again later. * says post instead.
- We couldn't publish this private page, but we'll try again later. * says post instead
- We couldn't schedule this page, but we'll try again later. * says post instead.
- We couldn't submit this page for review, but we'll try again later.* says post instead.
- I wasn't able to get these labels showing due to the constant issues :
Auto-upload failed multiple times and the changes were removed from the queue
- We couldn't upload this media, and didn't publish the page.
- We couldn't upload this media, and didn't publish this private page.
- We couldn't upload this media, and didn't schedule this page.
- We couldn't upload this media, and didn't submit this page for review.
Doing some of the tests proved difficult, due to the constant NullPointerExceptions with the PostModel which we have constantly encountered while doing this project so we will have to do another round of tests once we have resolved this.
- One of the exemptions I got were
E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-12
Process: org.wordpress.android.beta, PID: 14952
java.lang.IllegalStateException: postModel must not be null
at org.wordpress.android.viewmodel.pages.PageListViewModel.createItemUiStateData(PageListViewModel.kt:364)
at org.wordpress.android.viewmodel.pages.PageListViewModel.prepareTrashedPages(PageListViewModel.kt:310)
at org.wordpress.android.viewmodel.pages.PageListViewModel.access$prepareTrashedPages(PageListViewModel.kt:51)
at org.wordpress.android.viewmodel.pages.PageListViewModel$loadPagesAsync$1.invokeSuspend(PageListViewModel.kt:178)
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)
- And another one was
java.lang.IllegalStateException: page must not be null
at org.wordpress.android.viewmodel.pages.PagesViewModel.onItemTapped(PagesViewModel.kt:472)
at org.wordpress.android.viewmodel.pages.PageListViewModel.onItemTapped(PageListViewModel.kt:140)
at org.wordpress.android.ui.pages.PageListFragment$setPages$2.invoke(PageListFragment.kt:109)
at org.wordpress.android.ui.pages.PageListFragment$setPages$2.invoke(PageListFragment.kt:27)
at org.wordpress.android.ui.pages.PageItemViewHolder$PageViewHolder$onBind$$inlined$let$lambda$1.onClick(PageItemViewHolder.kt:89)
at android.view.View.performClick(View.java:7125)
When I attempted to open a DraftPage that had several media items attached in offline mode.
Two other issues I noticed that weren't related to this PR but are up for discussion.
-
Sometimes there is a delay before all pages are loaded. There will be a few
PageItemswithin the list and then the rest appear. -
I created a new page and when I set it's status to "Private" the action changes from "Publish" to "Update" even though the page was never published. I am not sure if this is intended since the status of the page is indeed being changed so let me know.
|
Thanks for the great review!!
Fixed in 0718d72
I tested these scenarios and they look okay.
We should fix both these issues in #11271
I'm not sure it's the issue you are talking about. But this happens to me when the pages are loaded from local database before they are fetched from the remote. Or is it happening to you even when the pages should already be in the local database? If so, can you reproduce the steps?
This is an expected state, having said that I agree it's not optimal and we'll hopefully improve it in one of the upcoming projects. |
There was a problem hiding this comment.
Thanks for the changes @malinajirka I ran another set of test on the changes and all the labels are behaving as expected!
There was a minor conflict when I changed the base branch so I resolved it & formatted the code so it could be merged!
I noticed an issue I think is unrelated but sharing for your perusal.
- Create a page and publish.
- While it’s being published turn airplane mode on.
- Turn it off and back on again in quick succession. (Sometimes, you don’t even need this step for the below behavior to begin.)
- There’s a flicker of the UI and the notification.
| Flicker Issue |
|---|
| https://drive.google.com/file/d/1KWf9_zPJjMV6M66L-jbLBeoth_R7QfRR/view?usp=sharing |
Let me know your thoughts on it after reproduction. I am going to create an issue once necessary after you review. Thanks
In response to your responses 😄
I tested these scenarios and they look okay.
Set emulator's network type to EDGE
Create a draft and publish it
Turn on the airplane mode
Wait until the upload fails
Turn off the airplade mode and turn it on again
Wait until the upload fails
Repeat 5 and 6 three times and the message appears
and 4.
Thanks! I did this and got things working appropriately!
We should fix both these issues in #11271
Indeed!
I'm not sure it's the issue you are talking about. But this happens to me when the pages are loaded from local database before they are fetched from the remote. Or is it happening to you even when the pages should already be in the local database? If so, can you reproduce the steps?
Oh yes! That's exactly when it happens! Thanks for clearing this up!
This is an expected state, having said that I agree it's not optimal and we'll hopefully improve it in one of the upcoming projects.
Understood!
|
Thanks you for testing this again @jd-alexander !!
I wasn't able to reproduce it. Could you please fill a bug report and ideally include
Thanks! |
Fixes #11133
Review instructions:
feature/master-pages-offline-supportintounhandled_autosavefeature/master-pages-offline-supportAdds the following labels to page list items. The size of the PR seems bigger than it actually is. Most of the code was copy-pasted from post list.
Page state
Changes are enqueued for auto-upload
Auto-upload failed but the changes are still enqueued for auto-upload
Auto-upload failed multiple times and the changes were removed from the queue
I decided to introduce unit tests in another PR - #11281.
To test:
The business logic was copy pasted from PostListItemUiStateHelper. I'd suggest testing just a couple of scenarios. Also please make sure to review all the changes in strings.xml - I tried to replace all mentions of
postwithpagebut I might have missed something.We'll test all the scenarios before we merge the master branch into develop.
PR submission checklist:
RELEASE-NOTES.txtif necessary.