Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. protected Flowable<IProfile> isUserAuthorized() {
  2.         return Flowable.create(new FlowableOnSubscribe<IProfile>() {
  3.             @Override
  4.             public void subscribe(FlowableEmitter<IProfile> e) throws Exception {
  5.                 if (mAuth.getCurrentUser() == null) {
  6.                     e.onError(new UnauthorizedError());
  7.                 } else {
  8.                     FirebaseUser user = mAuth.getCurrentUser();
  9.                     if (user.isEmailVerified()) {
  10.                         Profile profile = new Profile(
  11.                                 BaseApi.this,
  12.                                 user.getUid(),
  13.                                 user.getEmail(),
  14.                                 user.getDisplayName());
  15.                         e.onNext(profile);
  16.                     } else {
  17.                         e.onError(new EmailIsNotVerifiedError(user.getEmail()));
  18.                     }
  19.                 }
  20.                 e.onComplete();
  21.             }
  22.         }, BackpressureStrategy.MISSING);
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement