Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

fix(pwa): give the installed app icon a safe area (#2966)

Guillem Arias Fauste914547ffdbaa
diff --git a/app/views/pwa/manifest.json.erb b/app/views/pwa/manifest.json.erb
index 820c221a81..ca13d1f363 100644
--- a/app/views/pwa/manifest.json.erb
+++ b/app/views/pwa/manifest.json.erb
@@ -1,3 +1,25 @@
+<%#
+ Icon safe areas — read before regenerating any of these PNGs.
+
+ A `maskable` icon is cropped by the launcher to its own shape (circle,
+ squircle, teardrop…). Per the W3C spec only the centred circle of diameter
+ 80% of the icon is guaranteed to survive. One file may serve both purposes
+ (an icon can declare `"any maskable"`), but only if its artwork already sits
+ inside that circle — a full-bleed image cannot. Ours is full-bleed at the
+ `any` size, so maskable gets its own more-padded file; pointing both at the
+ one full-bleed image is what clipped the wordmark's outer letters on Android.
+
+ Current geometry (artwork is 160x145, from public/logo-offline.svg):
+ any / apple-touch -> artwork at 72% of the canvas (~14% side margin)
+ maskable -> artwork at 59%, so its corners need a 79.6% circle
+ and clear the 80% safe zone
+
+ iOS reads this file (manifest `icons` since 15.4), but the
+ <link rel="apple-touch-icon"> tags in layouts/shared/_head.html.erb take
+ precedence for the Home Screen icon, so in practice those are what ship.
+ iOS reserves no safe area and composites transparency onto black, so they
+ must stay opaque and self-padded.
+%>
{
"name": "<%= j product_name %>",
"short_name": "<%= j product_name %>",
@@ -13,7 +35,7 @@
"sizes": "512x512"
},
{
- "src": "/logo-pwa.png",
+ "src": "/logo-pwa-maskable.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
diff --git a/public/android-chrome-192x192.png b/public/android-chrome-192x192.png
index b456e5ca86..266a95418e 100644
Binary files a/public/android-chrome-192x192.png and b/public/android-chrome-192x192.png differ
diff --git a/public/android-chrome-512x512.png b/public/android-chrome-512x512.png
index 6003d58b77..7645c00e6f 100644
Binary files a/public/android-chrome-512x512.png and b/public/android-chrome-512x512.png differ
diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png
index 14b53edd32..33c5f1fbe5 100644
Binary files a/public/apple-touch-icon.png and b/public/apple-touch-icon.png differ
diff --git a/public/logo-pwa-maskable.png b/public/logo-pwa-maskable.png
new file mode 100644
index 0000000000..faa32554bf
Binary files /dev/null and b/public/logo-pwa-maskable.png differ
diff --git a/public/logo-pwa.png b/public/logo-pwa.png
index d387ae48e9..7645c00e6f 100644
Binary files a/public/logo-pwa.png and b/public/logo-pwa.png differ
diff --git a/public/mstile-150x150.png b/public/mstile-150x150.png
index bb83f7cd8d..d93ccdabc7 100644
Binary files a/public/mstile-150x150.png and b/public/mstile-150x150.png differ