traccar / traccar-web

Traccar GPS Tracking System
https://www.traccar.org
Apache License 2.0
814 stars 1.13k forks source link

Feature Request: PWA Install button/prompt #1169

Closed jinzo closed 10 months ago

jinzo commented 1 year ago

Hi,

I know that there are wrappers for iOS and Android, but as I'm trying to avoid deploying apps to the both app stores - I was thinking if we would add a menu item or a prompt that would allow the users to install the (new) PWA. I'm willing to implement this PR, but I'm not 100% sure where to put the button or if we would raither go with a floating prompt? I personally prefer a menu button, and in the new interface the only feasible position would be under Account alongside Log Out. It does not fit 100%, but it's the best position I can come up on? Any other ideas?

Ofcourse, the button would only show if it's possible to install the PWA.

See as a sample: https://dev.to/woile/simplest-react-hook-component-for-pwa-install-button-2die

tananaev commented 1 year ago

I guess if the change is small, I don't mind adding it, but only with a server settings flag. I don't want it to be the default.

As for the location, maybe we can put it in the settings screen somewhere?

jinzo commented 1 year ago

Yes the change is small, and I can put it in the settings screen yes. I started prototyping this and from what I see this would be better suited in .env setting, not server side config? As I did not find any similar server side setting that affects only the frontend/web display? Or did I miss any? On the other hand, I see that .env nowadays doesen't actually contain any settings (it did before afaik? or are they just not in the default .env?)

tananaev commented 1 year ago

It has to be user configurable, not developer configurable. You should add a server attribute for it.

jinzo commented 10 months ago

After some proof of concept work and tests I noticed that unfortunately this is only kinda-sorta supported on Chrome. See https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeinstallprompt_event#browser_compatibility

So it's not really worth it currently, I will keep an eye on this and reopen if if becomes feasible.