In my module I am using a singleton global state which I need to read from in the view models [ and some time I depend on some internal values in it like I check if the state.link.isEmpty()] and also I update it with some values in the UseCase like state.link = receivedLink.
1- First is it valid to inject this object and reuse it in many viewmodels in my module or not?
2- is it valid to also use it again in the usecases to edit the state values and update it.
3- Right now I need a data source to provide this state to get it from memory if existed and if not to get it from the disk cache; therefore, I will create something like StateDataSource which has two methods
getState() and updateState; however, I do not want to change the entire module because of that so I will still need to inject it directly in the viewmodels and the usecases
so is this valid to use this DataSource in the daggerModule to provide this state and whenever I want to update the state I talk to the repository to talk to the created datasource to call update method
Do you support these ideas, do you have different solutions I know there are too many questions in one question.
Please let me know if I couldn’t explain the question well.