Skip to content
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

Add maskable icon checkbox in customizer settings #698

Merged
merged 39 commits into from
Feb 24, 2022

Conversation

ankitrox
Copy link
Collaborator

Closes #304

thelovekesh and others added 30 commits February 14, 2022 18:16
… as maskable

* Lighthouse gives an error if icon is not maskable.
* Add a checkbox to allow user to save icon as maskable icon.
* If user have not opt-in for maskable icon then manifest will add icon purpose as `any maskable`.
@codecov-commenter
Copy link

codecov-commenter commented Feb 14, 2022

Codecov Report

Merging #698 (c82d070) into develop (6efeba2) will increase coverage by 0.69%.
The diff coverage is 80.76%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop     #698      +/-   ##
=============================================
+ Coverage      19.05%   19.75%   +0.69%     
- Complexity       324      326       +2     
=============================================
  Files             55       56       +1     
  Lines           2062     2086      +24     
=============================================
+ Hits             393      412      +19     
- Misses          1669     1674       +5     
Flag Coverage Δ
php 19.75% <80.76%> (+0.69%) ⬆️
unit 19.75% <80.76%> (+0.69%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pwa.php 0.00% <0.00%> (ø)
wp-includes/class-wp-web-app-manifest.php 73.51% <71.42%> (-0.38%) ⬇️
wp-includes/class-wp-customize-manager.php 88.88% <88.88%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6efeba2...c82d070. Read the comment docs.

@ankitrox ankitrox requested a review from westonruter February 14, 2022 12:58
@ankitrox ankitrox added the enhancement New feature or request label Feb 14, 2022
@ankitrox ankitrox added this to the 0.7 milestone Feb 14, 2022
wp-admin/js/customizer.js Outdated Show resolved Hide resolved
wp-admin/js/customizer.js Outdated Show resolved Hide resolved
'pwa_maskable_icon',
array(
'capability' => 'manage_options',
'type' => 'option',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since it is a specific icon that is maskable, and the icon is an image uploaded to the media library, I wonder if it would be preferable to store this maskable flag as postmeta instead. That may be overkill.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@westonruter site_icon is getting store in *_options table and maskable property is associated with site_icon itself. IMO, it makes sense to store maskable in options as there will be only one site_icon in customizer.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But if someone picks a different image for the site icon, then it may not be maskable. So that's why I was thinking it could be useful to associate the “maskability“ with the image attachment post specifically. But this would add quite a bit of complexity and it isn't necessary as the user would clearly see that the icon is maskable or not upon selecting a new image.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@westonruter Before your code changes, when user was picking new image for site icon, I was resetting the maskable toggle value.

Here, we can consider that every newly uploaded image may not be maskable and if user want he can explicitly mark the maskable input.

Only drawback of this approach is next time user selects previously uploaded icon, check box will not be marked/unmarked based on last input for that icon.

IMO, considering the tradeoff of simplicity vs experience, for now we can proceed with options and may change it in future if such requests are raised.

wp-includes/class-wp-customize-manager.php Outdated Show resolved Hide resolved
wp-includes/class-wp-customize-manager.php Outdated Show resolved Hide resolved
wp-admin/js/customizer.js Outdated Show resolved Hide resolved
wp-admin/js/customizer.js Outdated Show resolved Hide resolved
wp-includes/class-wp-web-app-manifest.php Outdated Show resolved Hide resolved
wp-includes/class-wp-web-app-manifest.php Outdated Show resolved Hide resolved
tests/test-class-wp-web-app-manifest.php Outdated Show resolved Hide resolved
@ankitrox ankitrox requested a review from westonruter February 18, 2022 14:30
@ankitrox
Copy link
Collaborator Author

@westonruter If all seems good, can we proceed with merging this one?

Copy link
Collaborator

@westonruter westonruter left a comment

Choose a reason for hiding this comment

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

Yes, sorry for the delay.

@westonruter westonruter merged commit 9806304 into develop Feb 24, 2022
@westonruter westonruter deleted the feature/304-makable-icon-setting branch February 24, 2022 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelogged enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Facilitate indicating the site icon as being maskable
4 participants