Created
August 13, 2016 15:06
-
-
Save frogermcs/95a06693ef1710ada28f28df9cd274cf to your computer and use it in GitHub Desktop.
This file contains 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
//UserManager | |
public Observable<User> startSessionForUser(String username) { | |
return githubApiService.getUser(username) | |
.map(User.UserResponseToUser()) | |
.doOnNext(new Action1<User>() { | |
@Override | |
public void call(User user) { | |
userDataStore.createUser(user); | |
startUserSession(); | |
} | |
}) | |
.subscribeOn(Schedulers.io()) | |
.observeOn(AndroidSchedulers.mainThread()); | |
} | |
private boolean startUserSession() { | |
User user = userDataStore.getUser(); | |
if (user != null) { | |
Timber.i("Session started, user: %s", user); | |
userComponent = userComponentBuilder.sessionModule(new UserModule(user)).build(); | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment