简体   繁体   中英

View Firestore offline persistance pending transactions

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM