I'm trying to find a way around the integration of Google and Facebook login for an Android application using the Clean Architecture.
My application has 3 Android Studio modules :
- presentation : contains the Interface Adapter layer of the Clean Architecture (Presenters), along with all my UI (Activity, Fragment, Custom Views) (part of the Framework and Driver layer)
- domain : This is the Use Case layer of the Clean Architecture. It contains the business models, Use Cases, and repository interfaces
- data : This contains all the Driver and Framework classes, the libraries (retrofit, databases, etc) and repository implementations
I would like to isolate the login specific SDKs in my data layer (which is a separate module in Android Studio).
The issue I have for this particular use case (Google login for example) is that the SDK need to talk directly to my Activity (presentation layer). Once I have built a specific object, I need to call startActivityForResult from an Activity, and I receive a callback in the onActivityResult method of my launching activity, containing the login informations.
These 2 things make an obligation to :
- either keep the Google/Facebook SDK dependencies in the presentation layer. BUT this violates the clean architecture principle, I would like to keep these dependencies in my data layer
- or add a call which will go through all my layers (presentation, domain and data) to give back the login informations from the onActivityResult method. BUT this means that I would modify my domain contract because of a particular login SDK
None of this seems OK. Do you know a proper way to handle this use case ?