Created
May 17, 2017 17:56
-
-
Save Augusent/224b2767ee8cd6a49ae4697747fb26db to your computer and use it in GitHub Desktop.
Interactor Example
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
@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