[Modal Layout Picker] "Preview" button functionality#13022
Conversation
|
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
|
You can test the changes on this Pull Request by downloading the APK here. |
# Conflicts: # WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java # libs/editor/WordPressEditor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergPropsBuilder.kt # libs/gutenberg-mobile
ace2a61 to
5852c21
Compare
4a6784e to
db36fd0
Compare
# Conflicts: # WordPress/src/test/java/org/wordpress/android/viewmodel/mlp/ModalLayoutPickerViewModelTest.kt
malinajirka
left a comment
There was a problem hiding this comment.
Great job @antonis! The code looks good.
I'm not sure if this was discussed or not, so I'm better sharing it. We used to have support for local previews in the past. They were removed in this ticket. Mostly because the local preview never looks the same as the actual site - it's missing css. Since we removed local previews I'm wondering if it make sense to re-introduce them for page layouts. AFAIK they have exactly the same issues - I tested a few layouts and encountered differences between the editor view and preview in a webview. If this was already discussed, please ignore this comment.
Some issues I noticed
-
When the app crashes/the user restarts the app while in preview, a draft is created. I'm not sure it's an issue, just mentioning it so we are aware of it.
-
Title is always empty - I tested 6 layouts on a self-hosted and .com sites.

-
"Don't keep activities" in developer settings results in an empty layout chooser.

|
Hello @malinajirka 👋 , thank you for taking the time to review this 🙇
Tbh, I was not aware that local previews were intentionally removed in the past. In my understanding the limitations of the preview functionality were considered during design and there will be a separate project in the future to expand this preview to provide a more WYSIWYG experience. (cc @chipsnyder )
I will investigate this further.
I fixed this as part of a next pr with 1c3f941
I will investigate this further. |
Tried to handle this in the
Fixed with 32e255f and 2b24ee1 (depends on wordpress-mobile/WordPress-FluxC-Android#1715) |
Thanks for sharing that ticket about Previews @malinajirka. When planning this project we discussed more of WYSIWYG experience but it was determined that reusing the Preview that is currently shown as part of the Gutenberg preview would be sufficient for this project. (internal reference: pb3aDo-ny) but we are discussing with @iamthomasbishop about what the next phase of the preview will look like. |
# Conflicts: # build.gradle
malinajirka
left a comment
There was a problem hiding this comment.
LGTM, thanks @antonis!

Fixes: wordpress-mobile/gutenberg-mobile#2452
Related PRs:
Depends on: [Modal Layout Picker] Filter layouts based on supported blocks #13018
gutenberg:gutenberg-mobile:WordPress-FluxC-AndroidTo test:
Layout Picker should show when creating a new page from My Site or Site Pages the Modal Layout Picker appears.
Preview a layout
Preview a layout, then a different one
Preview a layout, then cancel
Preview a layout, then create a page
Spot check for regressions
Open an existing page or blog, expect the content to be loaded and for normal editing to take place.
Spot check Modal Layout Picker Disabled
Screenshots
NOTES
I tried another approach by creating a separate Gutenberg Editor just for the preview functionality (this is the approach on iOS). This proved quite complex and the amount of code that needed to be duplicated (and maintained) made it a worst approach in my view.
Thus the approach followed in this PR is passing a
isPreviewflag and making the less changes possible to achieve the desired result.PR submission checklist:
RELEASE-NOTES.txtif necessary.