khmyznikov / pwa-install

Installation dialog for Progressive Web Application. Provides a more convenient user experience and fixes the lack of native dialogs in some browsers.
https://www.khmyznikov.com/pwa-install
MIT License
358 stars 59 forks source link

Allow to disable screenshots by platform #73

Closed cillian-cwb closed 2 months ago

cillian-cwb commented 2 months ago

The only forceStyle that work is 'chrome'.

'apple-mobile' and 'apple-desktop' must be possible to set. They now get what is set in forceStyle 'chrome.

khmyznikov commented 2 months ago

Not sure what do you mean. Can you describe what do you trying to do?

cillian-cwb commented 2 months ago

I am trying to disable screenshots on chrome, since install leads to native install dialog with screenshots as well.

But if I disable for chrome, it also disable for Safari mobile and desktop. And for Safari mobile and desktop it is necessary with the screenshots.

khmyznikov commented 2 months ago

Hmm I see. You can try to work around this by checking the isAppleDesktopPlatform and isAppleMobilePlatform values, and toggle screenshots. But I'll think about it.

cillian-cwb commented 2 months ago

I have checked their values and detection code. Detection code seems ok, but none of the isAppleDesktopPlatform and isAppleMobilePlatform values change anything for them. Only the 'chrome' values

khmyznikov commented 2 months ago

@cillian-cwb check the demo page or in package.json use the github version: "github:khmyznikov/pwa-install". I've added disable-screenshots-apple and disable-screenshots-chrome params

cillian-cwb commented 2 months ago

@cillian-cwb check the demo page or in package.json use the github version: "github:khmyznikov/pwa-install". I've added disable-screenshots-apple and disable-screenshots-chrome params

@khmyznikov Great!!! Works nicely in your demo. But I'm having problem to get it updated in my project. I have downloaded pwa-install and uploaded the files to pwa-install in node-modules and replaced pwa-install.bundle.js with your current one. Can't I use forceStyle('apple-mobile'); disableInstallDescription({ checked: false }); disableScreenshots({ checked: false }); disableClose({ checked: false }); setAttr('attr', 'any value');

forceStyle('chrome'); disableInstallDescription({ checked: false }); disableScreenshots({ checked: true }); disableClose({ checked: false }); setAttr('attr', 'any value'); anymore???

khmyznikov commented 2 months ago

Looks like you're using it the wrong way. Check readme section about supported parameters https://github.com/khmyznikov/pwa-install?tab=readme-ov-file#supported-params

cillian-cwb commented 2 months ago

Looks like you're using it the wrong way. Check readme section about supported parameters https://github.com/khmyznikov/pwa-install?tab=readme-ov-file#supported-params

Ok. Do you recommend using it with your control panel???? I have so far excluded that part.

khmyznikov commented 2 months ago

@cillian-cwb what framework do you use? The control panel on demo site is mostly just for demo, not a guide. You don't need to force any style, just set the parameters on element, listen events and call methods.

khmyznikov commented 2 months ago

added in 0.4.3

cillian-cwb commented 2 months ago

@cillian-cwb what framework do you use? The control panel on demo site is mostly just for demo, not a guide. You don't need to force any style, just set the parameters on element, listen events and call methods.

I don't use any framework. Not viable for my project. Sorry for late feedback. So still I'm not able to figure out how to set my code to get your last updates. Any further tips would be to great help.

I see you closed this now, but Android and iOS still doesn't get nb-NO. So with 'no' they still get English in your demo. Same for desktop Safari. Lower case-Upper case is needed.

khmyznikov commented 2 months ago

@cillian-cwb

<pwa-install id="pwa-install" disable-screenshots-chrome="true"></pwa-install>

like this you can set by default any supported properties. Use removeAttribute/setAttribute from js only if you need to set something dynamically.

cillian-cwb commented 2 months ago

Thank you @khmyznikov

I cleaned out all pwa-install from my js and it worked.

How to use removeAttribute/setAttributein in js? I removed the forceStyle, createElement and addeventListeners, since I noticed this gave me double.

khmyznikov commented 2 months ago

@cillian-cwb https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute

cillian-cwb commented 2 months ago

Hello. I'm trying to use showDialog() and hideDialog() on manual-apple="true". How can I do that without a framework???

khmyznikov commented 2 months ago

@cillian-cwb

<pwa-install id="pwa-install" manual-apple="true"></pwa-install>

var pwaInstall = document.getElementById("pwa-install");
pwaInstall.showDialog();