lundi 4 juillet 2022

Android. How to reuse one screen for different flow

I need to implement one screen with same UI for different flow and different business logic for every flow. My project has three layer: data, domain (with interactors), presentation.

Thus, in the domain layer, I need to create a separate interactor for each flow. To do this, my screen must accept the flow type and then in the general interactor, through the factory according to the flow type, create the appropriate interactor.

However, I don't really like this approach, since the number of different flows can be very large and then my factory will become too cumbersome.

Please tell me how they usually do when it is necessary to reuse the same screen, with different business logic. Speaking of different business logic, I mean accessing different repositories (to perform different network requests) and also different handling of these requests. But at its core, each flow has three requests of the same type, which for each flow I have to get from different repositories.

Aucun commentaire:

Enregistrer un commentaire