We have build a mobile app with offline first support. It works in the following way
- Initial we do a Master Data Sync (download some records from the server before the app gets functional/ ready to use, with a updatedAt[before] now())
- Delta Data Sync (download updated records from server after the last Delta Sync or Master Data sync “updatedAt[after]”)
The delta sync always does 2 calls: getter for new/updated data and a getter for deleted data (so we can delete them locally)
Because our data set is large we use pagination, in the Master Data sync this also give the ability to continue on page 20 after it gets interrupted.
As said earlier we also have a check inside the Delta Data sync that removes deleted item’s locally. If a record in the server is deleted it will be returned in this call. This works perfectly with one big exception.
But when a server record is modified and the user has NO permissions to the record anymore (so its bassicly “deleted” for the user) it won’t be returned by the deleted call, but neither by the getter cal.
So when you change the permissions of a record for the user, the local record NEVER gets deleted.
We are working on a lot of fixes, for example we are thinking of returning all the records that the user has no permissions to after the updated date (only the ID of the record) so the mobile phone can delete it offline.
But we can’t quite seem to find a working way,
We also tought about a “touched” system, but this means we should get all records everytime and remove the “untouched” onces.
Do you guys have any idea on how to solve this issue?