예제 #1
0
  @Override
  public synchronized Observable<AccessToken> registerForAccessTokenUpdates(String code) {
    Timber.d("registerForAccessTokenUpdates");
    if (loadAccessTokenSubscription == null || loadAccessTokenSubscription.isUnsubscribed()) {
      Timber.d("no loading in progress, starting new one");
      loadAccessTokenSubscription =
          loadAccessTokenObservable(code)
              .subscribeOn(Schedulers.io())
              .observeOn(AndroidSchedulers.mainThread())
              .subscribe(
                  new DefaultSubscriber<AccessToken>() {

                    @Override
                    public void onError(Throwable throwable) {
                      Timber.e("accessTokenSubject.onError");
                      accessTokenSubject.onError(throwable);
                    }

                    @Override
                    public void onNext(AccessToken data) {
                      Timber.d("accessTokenSubject.onNext: " + data);
                      // Caching accessToken data
                      accessToken = data;
                      accessTokenSubject.onNext(accessToken);
                    }
                  });
    }
    return accessTokenSubject.asObservable();
  }
예제 #2
0
 public Observable<RouteChange> observeScreenChange() {
   return screenChangeSubject.asObservable();
 }
예제 #3
0
 @Override
 public final Observable<FragmentEvent> lifecycle() {
   return lifecycleSubject.asObservable();
 }
 @Override
 @NonNull
 @CheckResult
 public final Observable<FragmentEvent> lifecycle() {
   return lifecycleSubject.asObservable();
 }
예제 #5
0
 public Observable<LifecycleEvent> lifecycle() {
   return lifecycleSubject.asObservable();
 }
예제 #6
0
 public Observable<FragmentEvent> lifecycle() {
   return lifecycleSubject.asObservable();
 }
예제 #7
0
 @NonNull
 public Observable<GitHubRepository> getRepository() {
   return repository.asObservable();
 }
 public Observable<String> getObservable() {
   if (mSubject == null) {
     mSubject = BehaviorSubject.create(get());
   }
   return mSubject.asObservable();
 }