What is the best practise when logging out a user in a realm offline first application?
In the docs it says:
"You can log out any user, regardless of the authentication provider used to log in, using the user.logOut() or user.logOutAsync() methods. Both methods:
- delete locally stored user credentials from the device
- immediately halt any synchronization to and from the user’s realms
- mark the user’s realms for deletion the next time the app restarts
Because logging out halts synchronization, you should only log out after all local Realm updates have uploaded to the server."
As I understand this, if a user logs out while being offline, all recently changed data by this user is deleted and no longer present on the next login. How can I prevent this from happening.
I could check whether a user has internet connection and only allow users to logout if they have. But what if the connection is poor, but present and not all changes have been uploaded yet? Can I check somehow if the data is up to date with the server, before logging the user out?