Skip to content

Instantly share code, notes, and snippets.

@Augusent
Created May 17, 2017 17:56
Show Gist options
  • Save Augusent/224b2767ee8cd6a49ae4697747fb26db to your computer and use it in GitHub Desktop.
Save Augusent/224b2767ee8cd6a49ae4697747fb26db to your computer and use it in GitHub Desktop.
Interactor Example
@Singleton
public final class EditProfileInteractor {
private final UsersRepository usersRepository;
@Inject
public EditProfileInteractor(UsersRepository usersRepository) {
this.usersRepository = usersRepository;
}
public Single<EditProfileViewModel> getEditProfileViewModel() {
return usersRepository.getMe()
.map(Profile::create)
.subscribeOn(Schedulers.io())
.map(EditProfileViewModel::new);
}
public Completable updateProfile(Profile profile) {
return usersRepository.updateProfile(profile)
.subscribeOn(Schedulers.io())
.toCompletable();
}
public Single<String> uploadPhoto(String uri) {
return usersRepository.uploadPhoto(new File(uri))
.subscribeOn(Schedulers.io());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment