Skip to content

[19.0][IMP] web_pwa_customize: apple-touch-icon + settings visibility - #3663

Open
LadyHwesta wants to merge 2 commits into
OCA:19.0from
LadyHwesta:apple-touch-icon-and-visibility-19.0
Open

LadyHwesta wants to merge 2 commits into
OCA:19.0from
LadyHwesta:apple-touch-icon-and-visibility-19.0

Conversation

@LadyHwesta

Copy link
Copy Markdown

What's missing today

web_pwa_customize lets you configure a short name, colors, and icon for Odoo's "Install app" prompt - but only for /web/manifest.webmanifest, which Chrome, Edge, and Android read. iOS Safari's "Add to Home Screen" reads a separate apple-touch-icon link tag instead, which this module never touches - so an icon configured here never shows up there at all.

Its own settings also inherit an existing restriction: the pwa_settings block (which also holds core's own web.web_app_name field, itself not surfaced anywhere else) is hidden behind base.group_no_one, i.e. invisible unless developer mode is on.

What this PR does

  • Adds a /web_pwa_customize/apple_touch_icon route that finds the best available configured icon - preferring the 192x192 PNG variant this module already generates, falling through the other sizes, then an SVG upload, then Odoo's own stock artwork if nothing is configured - and points the apple-touch-icon tag at it via a one-attribute template inherit on web.webclient_bootstrap.
  • Drops the pwa_settings block's groups="base.group_no_one" restriction. General Settings itself already requires admin access, so this doesn't expose anything that wasn't already admin-only - it just stops requiring developer mode on top of that.

No new dependencies, no changes to how the icon/colors are stored - purely additive on top of the existing res.config.settings fields and ir.attachment-based icon storage.

Testing

5 new tests (apple-touch-icon fallback with nothing configured, redirect to a configured PNG, redirect to a configured SVG, the link tag itself, and settings-block visibility for a plain admin without base.group_no_one), all green alongside the 3 existing ones. Ran the full pre-commit suite (ruff, prettier, pylint-odoo, README regeneration) clean.

Happy to adjust the approach if maintainers would rather see this split differently (e.g. a separate module) or handled another way.

web_pwa_customize only ever touched /web/manifest.webmanifest (Chrome,
Edge, Android). iOS Safari's "Add to Home Screen" reads the
apple-touch-icon link tag instead, which this module never set, so an
icon configured here never showed up there at all.

Adds a /web_pwa_customize/apple_touch_icon route that finds the best
available configured icon (preferring the 192x192 PNG variant, falling
through the other generated sizes, then an SVG upload, then Odoo's own
artwork if nothing is configured) and points the apple-touch-icon tag
at it via a one-attribute template inherit on web.webclient_bootstrap.

Also drops the pwa_settings block's base.group_no_one restriction -
this module's own fields (and core's pre-existing web.web_app_name,
which nothing else surfaces either) were only ever reachable with
developer mode on. General Settings already requires admin access, so
this doesn't expose anything that wasn't already admin-only.

5 new tests, all passing alongside the 3 existing ones.
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @victoralmau,
some modules you are maintaining are being modified, check this out!

…brittle

CI failed 3 of the 5 new tests: Werkzeug renders a redirect's Location
header as a bare path in some environments and as an absolute URL in
others (both are valid per RFC 7231) - the tests asserted exact
equality against a bare path, which only happened to match locally.
Assert on the path suffix instead, so either form passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:web_pwa_customize Module web_pwa_customize series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants