Application Initialization Process
Profitocracy may contain some bugs and errors which can lead to a corrupted persisted application state. As we store all the user data locally on a user's device, we can't access it directly, so we can do nothing for now if such a bug appears. So I propose to implement self-healing initialization in AppInit class while the application startup process. Here is the list of the components which should be checked before passing control to the main page:
- Correct Profile state
- Correctness of the all Transactions' state (may take a while, but it's better than not working application :)
- Correct Categories' state
Also, while the initialization process we can load all the data into memory. Because now we query all the data on each page navigation. For example, every time you navigate to the Transactions Page, the app queries the database to get all transactions, then maps them to a model and then renders. It would be better to create a singleton service inside the Mobile app project and load all the data there and access that loaded data from this service. So, it will be some sort of a caching layer.