-
Notifications
You must be signed in to change notification settings - Fork 966
Add PWA install button for Android users to increase adoption #2504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
5bcbcdb to
ae82931
Compare
| <%= filter_place_menu_item notifications_settings_path, "Notification Settings", "settings" %> | ||
|
|
||
| <%= tag.li class: "popup__item", hidden: true, data: { controller: "pwa-install", filter_target: "item", navigable_list_target: "item" } do %> | ||
| <%= icon_tag "install-edge", class: "popup__icon" %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Placeholder icon for now, will likely want to use something else. Possibly something like https://www.shadcn.io/icon/mdi-cellphone-arrow-down-variant
| "purpose": "maskable" | ||
| } | ||
| ], | ||
| "screenshots": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are needed to add support for rich PWA install flow: https://developer.chrome.com/blog/richer-pwa-installation
These are placeholders for now, will need proper examples if ya'll want to support this rich UI
| @@ -0,0 +1,9 @@ | |||
| window.addEventListener("beforeinstallprompt", (e) => { | |||
| const ua = navigator.userAgent | |||
| if (!(/Android/i.test(ua) && /Chrome/i.test(ua))) return; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS does not support calling the install prompt, and from what I can tell it only works in Chrome on Android. Don't think it's necessary for Desktop users as mobile seems like the main target audience.
| <%= tag.li class: "popup__item hidden", data: { controller: "pwa-install", filter_target: "item", navigable_list_target: "item" } do %> | ||
| <%= icon_tag "install-edge", class: "popup__icon" %> | ||
| <button class="popup__btn btn" data-action="pwa-install#install" data-pwa-install-target="button"> | ||
| <span>Install Fizzy App</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want some different copy for this, just what I came up with 💁♂️
Summary
This PR adds a PWA install button to the user settings menu, specifically targeting Android Chrome users. It leverages the
beforeinstallpromptevent to detect installation eligibility and implements the richer PWA installation UIKey Changes
app/views/my/menus/_settings.html.erb).pwa_install_controller.jsto manage the installation flow, listen for availability events, and toggle visibility of the install button.app/javascript/initializers/pwa_install.jsto capture thebeforeinstallpromptevent and store the deferred prompt for later use.manifest.json.erbwith high-quality screenshots of the Activity Feed, Project Board, and Card Details to enhance the "Rich Install" experience on supported platforms.Test Plan