I am developing a login function in my Android application with a clean architecture. And on other screens I need to observe the login state and do some logic according to the login state. The question is where to store the login state? In the Domain layer or the Data layer?
CodePudding user response:
You have to save it in the data layer, in the database or sharedPreferences
Check this image
CodePudding user response:
Usually store the login state in the android Data layer(SharePreference or sqlite), every time when the login in or login out.
login in and login out may make an HTTP network request.
Store in the Data layer could reduce the number of HTTP network requests, and make activity which needs the login state launchs more faster.