Implement Facebook login for android using MVP patttern

I need to embed the facebook login in my application using the Model-View-Presenter (MVP) template, but the problem is how to avoid injecting my host with an activity link (which will negate the MVP template, since the presenter should not contain platform components).

LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("email", "public_profile"));

As you can see above, the function logInWithReadPermissins()takes as an argument a link to activity.

+4
source share
1 answer

In this repository, they are a good solution.

https://github.com/SergeyBurlaka/Android-MVP-FacebookSDK-GoogleAPI-SocialViewer-App

-

LoginManager.getInstance().logInWithReadPermissions((Activity) view,
            Arrays.asList("email", "public_profile"));

kotlin

LoginManager.getInstance().logInWithReadPermissions(view as Activity,
            Arrays.asList("email", "public_profile"))
0

Source: https://habr.com/ru/post/1667472/


All Articles