Created
September 5, 2016 17:41
-
-
Save miquelbeltran/9f9018e735e7a7c97051169dc9b2713a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ProfilePresenter { | |
private final ProfileInteractor interactor; | |
private ProfileView view; | |
public ProfilePresenter(ProfileInteractor interactor) { | |
this.interactor = interactor. | |
} | |
public void attachView(ProfileView view) { | |
this.view = view; | |
fetchAndDisplay(); | |
} | |
public void dettachView() { | |
// Not covered by this example: | |
// You should handle the subscription | |
} | |
public void fetchAndDisplay() { | |
// Not covered by this example: | |
// You should handle the subscription | |
// You should also check if view is not null | |
// You should also handle the onError | |
interactor.getUserProfile().subscribe(userProfile -> view.display(userProfile)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment