I'm using react-native-firebase's firestore library, specifically offline persistence for an app that needs to record transactions offline at events, it works very well, when the device goes online it syncs pending transactions.

However I haven't found a way to know which transactions are pending to be sync'ed or at least that transactions are indeed pending. I'd like to display this information so when the event closes the manager could connect the devices to a portable wifi, and know that all transactions where correctly uploaded to the server.

1 Answers

0
user37309 On

Have a cloud function that listens for all new documents in a collection and then updates them with a Boolean true "synchronised" field. Listen with the client for an update to the synchronised field. Tally up all those without/with a false synchronised field to find out how many are yet to sync/use this data in whatever way you need to.