feat: implement custom mobile PWA install prompt with dual-lock devic…#85
feat: implement custom mobile PWA install prompt with dual-lock devic…#85the-madhankumar wants to merge 4 commits into
Conversation
|
@the-madhankumar is attempting to deploy a commit to the karan3431's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
🎉 Thank you for your Pull Request! We're thrilled to have your contribution to FreshScan AI. Before we review, please make sure you have:
A maintainer will review your code as soon as possible! |
|
Frontend lint and build test are failing fix that. |
|
The lock file is missing three packages that are declared in your package.json: @emnapi/core@1.10.0 Problem: The npm ci command failed because package.json and package-lock.json are out of sync. The lock file is missing these packages: @emnapi/core@1.10.0 |
Description [Reference Issue: #74]
This Pull Request implements a custom installation prompt for mobile and tablet devices. The solution addresses the requirements for FreshScan AI by prompting mobile users to install the application to their home screen while ensuring that desktop users do not see the pop-up, even if their browser windows are resized or compressed.
This update also introduces a functional Service Worker to ensure Progressive Web App compliance.
Changes Made
1. Service Worker Setup and Compliance
public/sw.js: Created a service worker file that handles basic install, activate, and fetch events. It uses a network-first approach with an offline fallback. This ensures that the application structure remains accessible if a user loses internet connectivity in a market.src/main.tsxto register the service worker when the page loads.2. Device and Hardware Detection
beforeinstallpromptevent listener.src/components/InstallPrompt.tsxto ensure the banner only displays on true mobile devices:3. Custom Installation User Interface
4. Development Environment Configuration
vite.config.tsto allow network access to the local development server. This allowed testing the setup directly on a physical mobile device using local network port forwarding.Installation Dialog UI
Testing and Verification
The entire workflow was verified on a physical mobile phone using the following steps:
Checklist