Skip to content
Merged
Prev Previous commit
Next Next commit
Try to prioritise maskable icon
  • Loading branch information
ellatrix committed Jul 3, 2021
commit 19cb71afc9c33e102720a8f392db93120fd439c5
24 changes: 12 additions & 12 deletions lib/pwa-load.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,44 +112,44 @@ window.addEventListener( 'load', () => {
const svgElement = createSvgElement( logo );

Promise.all( [
// The "normal" icon should be round. This is used for Chrome
// Desktop PWAs. To do: check which sizes are really needed.
// The maskable icon should have its background filled. This is used
// for iOS. To do: check which sizes are really needed.
...[ 180, 192, 512 ].map( ( size ) =>
createIcon( {
svgElement,
size: 180,
color,
backgroundColor,
circle: true,
} ).then( ( base64data ) => {
manifest.icons.push( {
src: base64data,
sizes: size + 'x' + size,
type: 'image/png',
purpose: 'any',
purpose: 'maskable',
} );

// iOS doesn't seem to look at the manifest.
if ( size === 180 ) {
addAppleTouchIcon( size, base64data );
}
} )
),
// The maskable icon should have its background filled. This is used
// for iOS. To do: check which sizes are really needed.
// The "normal" icon should be round. This is used for Chrome
// Desktop PWAs. To do: check which sizes are really needed.
...[ 180, 192, 512 ].map( ( size ) =>
createIcon( {
svgElement,
size: 180,
color,
backgroundColor,
circle: true,
} ).then( ( base64data ) => {
manifest.icons.push( {
src: base64data,
sizes: size + 'x' + size,
type: 'image/png',
purpose: 'maskable',
purpose: 'any',
} );

// iOS doesn't seem to look at the manifest.
if ( size === 180 ) {
addAppleTouchIcon( size, base64data );
}
} )
),
] ).then( () => {
Expand Down