Created
October 31, 2016 14:22
-
-
Save agustinsivoplas/d41b844fc363f0086d04aeda91b9ccb5 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
@BindView(R.id.button) | |
AppCompatButton button; | |
CompositeSubscription compositeSubscription; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_splash_reachout); | |
ButterKnife.bind(this); | |
compositeSubscription = new CompositeSubscription(); | |
/*Subscription testSubscription = RxView.clicks(button) | |
.subscribe(aVoid -> { | |
makeApiCall(); | |
});*/ | |
AuthenticationAPI authApi = ReachoutServiceCreator.createService(AuthenticationAPI.class, null); | |
RxView.clicks(button) | |
.flatMap(aVoid -> authApi.verifyEmail("[email protected]")) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.subscribe(verifyEmailResponse -> Log.i("TEST", "onNext: " + verifyEmailResponse.success), | |
throwable -> Log.e("TEST", "onError: " + throwable.getMessage(), throwable), | |
() -> Log.i("TEST", "completed")); | |
// compositeSubscription.add(testSubscription); | |
} | |
private void makeApiCall() { | |
AuthenticationAPI authApi = ReachoutServiceCreator.createService(AuthenticationAPI.class, null); | |
authApi.verifyEmail("[email protected]").observeOn(AndroidSchedulers.mainThread()) | |
.subscribe(verifyEmailResponse -> Log.i("TEST", "onNext: " + verifyEmailResponse.success), | |
throwable -> Log.e("TEST", "onError: " + throwable.getMessage(), throwable), | |
() -> Log.i("TEST", "completed")) | |
; | |
} | |
@Override | |
protected void onDestroy() { | |
compositeSubscription.unsubscribe(); | |
super.onDestroy(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment