kevinmarrec / nuxt-pwa-module

⚠️ DEPRECATED ⚠️ Zero config PWA solution for Nuxt 3
MIT License
338 stars 32 forks source link

Icon gets cropped #48

Closed toniengelhardt closed 1 year ago

toniengelhardt commented 1 year ago

The auto-generated icon gets cropped on Android (Chrome) and iOS (Safari). Chrome desktop seems to work fine. Maybe an issue with the maskable option, which I think is missing.

Icon size is 512x512, is that too small? I have another app with the @nuxtjs/pwa where 512x512 works fine. If that is the issue and x1024 is required or so I think it would not be a problem and would be happy to create a PR mentioning that in the README.

Screenshot_20221012-100539

Simulator Screen Shot - iPhone 13 Pro - 2022-10-12 at 10 21 06

kevinmarrec commented 1 year ago

@toniengelhardt

It sounds like normal to me, your icon has white background, and Android is fitting your icon within a circle, therefore your white rectangle it just hidden by the circle shape.

EDIT: That said, if the exactly same icon works with @nuxtjs/pwa, there must be something to improve indeed. I would need to know what is the display result with @nuxtjs/pwa with your icon.

toniengelhardt commented 1 year ago

@kevinmarrec

Maybe related to the maskable option. @nuxtjs/pwa has a general icon setting for purpose, which is by default ['any', 'maskable']. But this is actually also not ideal. I think the most convenient option would be to be able to specify two icons, 'default' and 'maskable' and the module generates all specified sizes (or the defaults) for both.

kevinmarrec commented 1 year ago

@kevinmarrec Yep, having icons with both any & maskable purposes lead to Google Lighthouse warnings.

This is why I've been implementing independent generation of maskable icons.

Sounds like a great idea to be able to give path to another icon for maskable purpose !

toniengelhardt commented 1 year ago

Yes exactly and devices (Android, iOS) seem to have different preferences with [any, maskable].

The problem with @nuxtjs/pwa ism as far as I understand it, that you can either have auto-generated icons with the same setting, or you have to generate all icons yourself if you want both, which is kinda annoying.

kevinmarrec commented 1 year ago

@toniengelhardt

Good.

Will work on https://github.com/kevinmarrec/nuxt-pwa-module/issues/50 as part of v0.8.0 Milestone.

kevinmarrec commented 1 year ago

@toniengelhardt Please have a try on v0.8.0, with icon.maskableSource, or just add icon.maskable.png in public folder, it will be taken out of the box :)

toniengelhardt commented 1 year ago

@kevinmarrec amazing, epic idea to use icon.maskable.png as default!

However, it doesn't solve the original problem. I can see the maskable icons in Chrome dev tools but the black borders are still around. Maybe the PWA needs to be configured to use the maskable icon as default for the icon/install/launch screen somehow?

A few more insights...

On Android the black borders show up when installing the PWA and in the launch screen, but are not present in the home screen icon.

On iOS they are present in install screen and icon, but not in the launch screen.

Screen Shot 2022-10-12 at 17 57 04
kevinmarrec commented 1 year ago

@toniengelhardt Well if you check the icons generated there is no black border, so I'm note sure what causes it on install 👀

toniengelhardt commented 1 year ago

@kevinmarrec I'll investigate

LukaZeleznik commented 1 year ago

@toniengelhardt I am having the same issue, did you manage to resolve it?

toniengelhardt commented 1 year ago

@LukaZeleznik yes, it works when you set the padding to 0 in the settings, but I feel like that should be the default setting to work out of the box.

LukaZeleznik commented 1 year ago

@toniengelhardt I came to the same solution, and I agree that that should be the expected behaviour out of the box.

Did you notice any issues on iOS/Android with this approach though? I am thinking on using icon.maskable.png, with the image having a bit more padding, or is that unnecessary?

toniengelhardt commented 1 year ago

@LukaZeleznik haven't tried it yet, but I also have an Android TWA that I still need to upgrade from Nuxt 2 and the original pwa module (which worked for me out of the box but didn't have proper maskable support).

kevinmarrec commented 1 year ago

I would need to have one more look on this one, I don't remember having able to reproduce it as it may differ from device to device ? It may have different behavior depending on the OS ? I don't know

kevinmarrec commented 1 year ago

We should create another issue for it

toniengelhardt commented 1 year ago

I would need to have one more look on this one, I don't remember having able to reproduce it as it may differ from device to device ? It may have different behavior depending on the OS ? I don't know

Probably, I see it on the latest Android on a Pixel 5. Might be different with different Android flavors.

kevinmarrec commented 1 year ago

Opened #77 to track it