Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//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