We’re starting to introduce real time sync of shopping lists in our app. i.e. device A is adding items, removing, marking as checked… reflected on device B with a little message while the UI is being updated.
My objective is to update the UI on the second device when modifications are made on the shopping list, when the sync starts (show a loader), and hide it when the sync ends.
Here’s where it gets tricky. This top level object, call it “ShoppingList”, actually contains multiple objects (mostly Lists), also managed in the realm.
When the shopping list is being edited (items added or removed, etc.), actually, it’s multiple embedded objects that are being edited. We can’t simply observe the top level object “ShoppingList”. We must observe all embedded objects that may be modified as well.
I tried using
syncSession.addProgressNotification and observe this realm, to know when the sync is complete (top level + all lower level objects). But within addProgressNotification,
isTransferComplete is called each time 1 single object from this realm is done syncing. I can never know when the shopping list and all its embedded objects are actually done synching.
Any clue on how we could track the sync completion for such an object, containing dozens of other objects also being updated?