antoniolg / androidmvp

MVP Android Example
5.94k stars 1.58k forks source link

More advanced use cases #18

Closed Knight704 closed 6 years ago

Knight704 commented 8 years ago

Could you share some tips for more advanced scenarios. By this I mean cases, when we should somehow interact with android framework layer. Let's say we wanted to login via Google Signin (from Google Play Services), this approach requires GoogleApiClient and tightly coupled to method onActivityResult. This is just an example, for simplicity it could be slightly changed.

From my point of view example provided is great, very simple and intuitive, but when it comes to real use cases, questions appears.

Cheers.

antoniolg commented 8 years ago

I'd love to, but honestly I probably won't have time. This example was created two years ago, where almost nobody had talked about MVP on Android, so it required a very simple example to be understood. But nowadays I'm sure there are more complex examples out there.

Anyway, if I have some time, your idea for an example looks great to me.

micromingle commented 7 years ago

antoniolg, thanks for your demo;

When reading the code, I kind of stuck with LoginInteractor and LoginInteractorImpl, because as far as my knowleged is concerned, I found them redundant.
So can we remove them and do login logic directly under LoginPresenterImpl ? If not , can you explain why ?

Cheers.

antoniolg commented 7 years ago

Yes, the LoginInteractor here is not necessary, you can omit it.

alinhayati commented 7 years ago

@micromingle , I think the reason for separating the LoginInteractor and LoginInteractorImpl is to separate the model logic (as outlined in LoginInteractor) from its implementation (LoginInteractorImpl). This may seem redundant if you consider only a single platform (Android), but in a multi-platform project, the model logic would be the same for all platforms and the implementation would be different.

micromingle commented 7 years ago

@antoniolg thank you

micromingle commented 7 years ago

@alinhayati yeah, that makes perfect sense