Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected Flowable<IProfile> isUserAuthorized() {
- return Flowable.create(new FlowableOnSubscribe<IProfile>() {
- @Override
- public void subscribe(FlowableEmitter<IProfile> e) throws Exception {
- if (mAuth.getCurrentUser() == null) {
- e.onError(new UnauthorizedError());
- } else {
- FirebaseUser user = mAuth.getCurrentUser();
- if (user.isEmailVerified()) {
- Profile profile = new Profile(
- BaseApi.this,
- user.getUid(),
- user.getEmail(),
- user.getDisplayName());
- e.onNext(profile);
- } else {
- e.onError(new EmailIsNotVerifiedError(user.getEmail()));
- }
- }
- e.onComplete();
- }
- }, BackpressureStrategy.MISSING);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement