Skip to content

[Gutenberg] Support Theme Colors and Gradients#12041

Merged
chipsnyder merged 24 commits intodevelopfrom
rnmobile/issue/1744-themeColor
Jun 17, 2020
Merged

[Gutenberg] Support Theme Colors and Gradients#12041
chipsnyder merged 24 commits intodevelopfrom
rnmobile/issue/1744-themeColor

Conversation

@chipsnyder
Copy link
Copy Markdown
Contributor

@chipsnyder chipsnyder commented May 27, 2020

Fixes: wordpress-mobile/gutenberg-mobile#1744

Related PRs
gutenberg WordPress/gutenberg#22197
gutenberg-mobile wordpress-mobile/gutenberg-mobile#2241
WordPress-FluxC-Android wordpress-mobile/WordPress-FluxC-Android#1593
WordPress-iOS wordpress-mobile/WordPress-iOS#14085


Description

Adds support for theme defined colors and gradients to be injected into the editor from the mobile apps.

Colors can then be displayed by the same mechanisms that utilize the settings lookup for colors and gradients. This is currently supported on Cover and Button blocks

How has this been tested?

Note Atomic sites don't seem to support the wp/v2/themes API changes yet so this can be tested with a free site or a self-hosted site
To help with testing this theme can be added to a self-hosted site: twentytwenty-copy.zip

Colors

1.) Select a theme with custom colors (such as TwentyTwenty)
2.) Create a post with blocks that have a custom color set (such as Cover or Button)
3.) Load editor on mobile

Expect to see the custom color on the block

Gradients

1.) Select a theme with custom gradients or add gradients to a theme
2.) Create a post with blocks that have a custom gradient set (such as Cover or Button)
3.) Load editor on mobile

Expect to see the custom gradient on the block

No Wifi

1.) Set up blocks for custom color and gradient
2.) View the post on mobile to cache the theme
3.) Turn off wifi to the device
4.) Reload the editor

Expect to see the custom colors on the blocks

No Wifi - Force kill the app

1.) Set up blocks for custom color and gradient
2.) View the post on mobile to cache the theme
3.) Turn off wifi to the device
4.) Stop the app from running in the background
5.) Reload the editor

Expect to see the custom colors on the blocks

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented May 27, 2020

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented May 27, 2020

You can test the changes on this Pull Request by downloading the APK here.

@chipsnyder chipsnyder added Gutenberg Editing and display of Gutenberg blocks. gutenberg-mobile labels May 28, 2020
@chipsnyder chipsnyder requested review from mchowning and mkevins May 28, 2020 13:14
@chipsnyder
Copy link
Copy Markdown
Contributor Author

@mchowning I'm not sure how busy you are with the release stuff these days but I was wondering if you could review this PR for me. It uses the ReactNativeStore under the covers but does a longer persistence so I thought you might be a good resource to take a look.

I CC'd @mkevins as a possible backup though if you are busy right now.

@chipsnyder chipsnyder marked this pull request as ready for review May 28, 2020 14:55
@mchowning
Copy link
Copy Markdown
Contributor

👋 @chipsnyder ! Thanks for the ping. Unfortunately I do have a lot of tasks on my plate right now, so I don't really have timento get to this until the later part of this week. It may be a good idea to go ahead and get a review from @mkevins if he is available. Of course, if this is high-priority and needs review ASAP, let me know.

FWIW, at a quick glance, what you're doing in these PRs looks reasonable to me.

@mkevins
Copy link
Copy Markdown
Contributor

mkevins commented Jun 2, 2020

I have begun reviewing this (and the related PRs), and agree with mchowning that the approach looks good. I have a few groundskeeping items at the moment, so just a heads up that I may be a little delayed in providing more thorough feedback, but please let me know if this needs more urgent attention.

@chipsnyder
Copy link
Copy Markdown
Contributor Author

Thanks @mkevins and @mchowning, for helping review this and the other PRs. I'd like to get this in before the next Gutenberg release but I know you have other commitments too. I'd rather you have the time to give your good thorough feedback.

@chipsnyder
Copy link
Copy Markdown
Contributor Author

@mkevins I updated your callout good catch on that one. I'm not 100% sure if that was just one comment from reviewing or if that was your full initial review, but that said, I goofed and didn't think about how this PR might block other Gutenberg changes. If you get a chance could you double-check this after these changes and I can tackle anything on Monday morning?

If there are any bigger changes though I opened up a draft PR that just puts a default value in place to unblock develop @marecar3 and I can merge that one in if more discussion and time is needed here.

FYI @marecar3

@mkevins
Copy link
Copy Markdown
Contributor

mkevins commented Jun 8, 2020

If there are any bigger changes though I opened up a draft PR that just puts a default value in place to unblock develop @marecar3 and I can merge that one in if more discussion and time is needed here.

This PR looks good to go, IMO. I had some questions / comments on the FluxC PR, so I guess that's a dependency of this one? I'll review the draft one too, in case the timing is tight (and it's just a stub, so an easy review).

@mkevins
Copy link
Copy Markdown
Contributor

mkevins commented Jun 10, 2020

I've reviewed this, and from a code perspective, it looks good. While testing, I encountered some issues for some reason.

Tested via https://55113-9306568-gh.circle-artifacts.com/0/Artifacts/WordPress-pr-12041-build-55113.apk on Pixel 3a w/ Android 10.

The button gradient did not show when I put the button inside the cover block:

Screenshot HTML
button-gradient-not-showing button-gradient-not-showing-html

The button did not render when it was placed after the cover block:

Screenshot HTML
button-not-showing button-not-showing-html

I wonder if I'm missing something in the testing steps? I tried with both the twentytwenty theme, and the copied version (where only a single gradient was present in the picker).

@chipsnyder
Copy link
Copy Markdown
Contributor Author

chipsnyder commented Jun 10, 2020

Great catch on that @mkevins It looks like something got a bit out of sync on Gutenberg. Opened up a new PR to resolve the button not appearing: WordPress/gutenberg#23075

I found another issue related that where the editor doesn't seem to reload while you're on it. Looking into that now.

@chipsnyder
Copy link
Copy Markdown
Contributor Author

@mkevins I figured out the error on this. For some reason when I was generating the bundle the keys after moving them to a constant were reading as null. So I just pulled them out to a new location wordpress-mobile/WordPress-FluxC-Android@9efb81f

I also made a tweak in the Gutenberg and updated the dependency here.

@mkevins
Copy link
Copy Markdown
Contributor

mkevins commented Jun 15, 2020

Tested again with the Gutenberg changes and the latest FluxC changes. Everything is working as expected now. LGTM! Nice work Chip!

@chipsnyder chipsnyder added this to the 15.2 milestone Jun 15, 2020
@chipsnyder
Copy link
Copy Markdown
Contributor Author

Tested again with the Gutenberg changes and the latest FluxC changes. Everything is working as expected now. LGTM! Nice work Chip!

Thanks for the review @mkevins. I updated the build file for the FluxC beta and bumped the Gutenberg-Mobile version, once the 15.1 branch is cut I think this will be ready to merge.

If you could would you be able to hit approve on this either after the branch is cut or in preparation for it? Or if you'd like another set of eyes just let me know :)

@mkevins mkevins self-requested a review June 16, 2020 00:29
Copy link
Copy Markdown
Contributor

@mkevins mkevins left a comment

Choose a reason for hiding this comment

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

If you could would you be able to hit approve on this either after the branch is cut or in preparation for it? Or if you'd like another set of eyes just let me know :)

Not sure why, but I thought I already hit approve. I guess that was the FluxC PR 😅 . Sorry for the delay

@chipsnyder chipsnyder merged commit 3810b95 into develop Jun 17, 2020
@chipsnyder chipsnyder deleted the rnmobile/issue/1744-themeColor branch June 17, 2020 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gutenberg Editing and display of Gutenberg blocks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants