First of all, this won't be a "standard" SO question as I don't have a problem per se it's more of a topic to see how other people are working with offline designs pattern.
Context
I'm developping an "offline first" Android application. Which mean that my users must be able to use the application regardless of the availability of an internet connection. Everything is working fine at the moment but the more I get into adding new functionnalities the more I feel like my way might not be the smartest.
How I am doing it currently
To ensure that my application work offline at everytime I set a service up that will synchronize data from the server when it needs it. I am therefore working with 2 databases. The one on my phone and the one on the server. Each time the user makes a request, the application checks in the local database and if it finds nothing it request the data on the server and saves it on the local database. With my first use cases where there was only one way read or one way response it worked perfectly. But now that I'm creating a way for user to comment about some entities I feel like my way is causing more wrong than right. Because I can't ensure that the user had not erased data from the database. And now, to check everything and make sure it works fine I am getting each time a messier code.
What I would like to discuss
In the end I would love to get as much people to share their experiences, to see if I'm good in my way of thinking or if there is/are better way(s) to make it work.
I'm not looking for a cheap solution just to see with other people how they would do it.
Cordially, Matthieu
PS :Android
and IOS
are taggued here because I think this "offline first" method is more a mobile programming problem in general.
Aucun commentaire:
Enregistrer un commentaire