I'm developing an Android app whose architecture is based on the well known Uncle's Bob Clean Architecture.
I have the following Use Case:
Validate User Subscription
It's based on this use case descryption( main success scenario)
Check if validation warning was already shown
Yes -> Go to step 6
No -> Go to step 2
Check if user has internet connection
Yes -> Access remote repository
No -> Access local repository
System gets user's subscription hash in repository
System generates a key to decrypt the subscription hash
System decrypts the hash using the previously generated key and returns the status of the subscription ( Valid / Invalid)
Status is valid: System saves the subscription on device and changes the user type to Premium
Status is invalid: System saves the subscription on device changes the user type to Free
Use case terminates
I'm facing a problem on step 2. As you can see, I need to change my repository during the use case execution, but I don't know the best way to implement it.
One of my ideas was to inject the repository through method injection ( using some sort of
setRepository(Repository repository) instead of constructor injection. Is this ok?