Offline inspections (P8)
A checklist with photos that works with no network and syncs when the network comes back.
Working offline
A service worker keeps the app on the device, so it opens with no network. With a network each file is fetched fresh and the copy is updated; without one the copy is used.
Changes and the queue
Every edit is a field change with a time, stored on the device at once and put in a queue. Photos are shrunk on the device to 960 pixels. Each field has its own pause while typing, so typing in the next field never drops the last one.
Sync
When the network is there, the queue is sent. The server keeps every change and answers with the changes from other devices since the last sync. For each field the change with the newest time wins, on the server and on every device, so an edit made offline is kept unless someone changed the same field later.
Previous: Whistleblower channel (P7). Next: Booking (P9).