Mortar-Flow-Dagger2-demo icon indicating copy to clipboard operation
Mortar-Flow-Dagger2-demo copied to clipboard

Calling specific callbacks that take Activity as parameter

Open leonardo2204 opened this issue 9 years ago • 1 comments

Hi Lukas,

First of all, thanks for the outstanding job that you have been doing ! I have a question, I've checked out this example and I'm trying to login using FB login. The problem is, inside my view I have a button callback that must call 'LoginManager.getInstance().logInWithReadPermissions(activity, permissions);'

How can I accomplish this ? Thanks for your time !

leonardo2204 avatar Jan 22 '16 19:01 leonardo2204

Hi! You need to create a link between the activity and the views/presenters. The class that represents that link, which could be called ActivityPresenter or ActivityOwner, will be linked to the activity on the activity's onCreate() and unlinked in the activity's onDestroy(). You can then pass that activity owner to the views/presenters, either by adding it as a service of the mortar scope, or by dagger2.

You can find more info on that SO post: http://stackoverflow.com/questions/21927990/mortar-flow-with-third-party-libraries-hooked-to-activity-lifecycle

lukaspili avatar Jan 29 '16 17:01 lukaspili