Description
This issue introduces comprehensive offline capabilities for the FreshScan AI Progressive Web App (PWA). Fish landing docks, wholesale markets, and remote coastal landing sites frequently suffer from highly unstable, low-speed, or completely offline cellular coverage. This poses a major barrier to adoption, as the cloud-based scanning API cannot be reached under standard operating conditions.
To resolve this connectivity issue and build a true resilient PWA, we will implement local storage of scans using IndexedDB on the client frontend and set up a Service Worker to manage background synchronization loops. When a user runs a scan while offline, the application will automatically catch the network failure, run local inference using ONNX Runtime Web (ort-wasm) directly in the browser, and queue the scan result—including base64 encoded images, geolocation details, and prediction metadata—locally inside an IndexedDB object store.
Once network connectivity is restored (detected using window online event hooks), the background sync loop will automatically synchronize the queued scans with the backend database. We will also implement a duplicate upload resolver to prevent data integrity issues and display a sleek, non-intrusive offline sync progress banner in the dashboard.
Technical Implementation Details
- IndexedDB Schema: Create
offlineDb.ts to manage the offline scan queue, storing scan payloads and raw image blobs.
- Inference Fallback: Modify
ScannerPage.tsx to handle connection errors gracefully and route flow to the local ONNX edge model path.
- PWA Background Sync: Register status listeners to trigger sequential uploads of queued records.
- UI Progress Indicator: Add a dynamic status bar showing sync counts with clear success/failure states.
Description
This issue introduces comprehensive offline capabilities for the FreshScan AI Progressive Web App (PWA). Fish landing docks, wholesale markets, and remote coastal landing sites frequently suffer from highly unstable, low-speed, or completely offline cellular coverage. This poses a major barrier to adoption, as the cloud-based scanning API cannot be reached under standard operating conditions.
To resolve this connectivity issue and build a true resilient PWA, we will implement local storage of scans using IndexedDB on the client frontend and set up a Service Worker to manage background synchronization loops. When a user runs a scan while offline, the application will automatically catch the network failure, run local inference using ONNX Runtime Web (
ort-wasm) directly in the browser, and queue the scan result—including base64 encoded images, geolocation details, and prediction metadata—locally inside an IndexedDB object store.Once network connectivity is restored (detected using window online event hooks), the background sync loop will automatically synchronize the queued scans with the backend database. We will also implement a duplicate upload resolver to prevent data integrity issues and display a sleek, non-intrusive offline sync progress banner in the dashboard.
Technical Implementation Details
offlineDb.tsto manage the offline scan queue, storing scan payloads and raw image blobs.ScannerPage.tsxto handle connection errors gracefully and route flow to the local ONNX edge model path.