use of com.yydcdut.note.model.rx.exception.RxException in project PhotoNoter by yydcdut.
the class RxUser method saveEvernote.
public Observable<IUser> saveEvernote() {
return Observable.create(new Observable.OnSubscribe<IUser>() {
@Override
public void call(Subscriber<? super IUser> subscriber) {
if (mEvernoteSession.isLoggedIn()) {
try {
User user = mEvernoteSession.getEvernoteClientFactory().getUserStoreClient().getUser();
mEvernoteUser = new EvernoteUser(user.getUsername());
SharedPreferences.Editor editor = mSharedPreferences.edit();
editor.putString(EVERNOTE_NAME, mEvernoteUser.getName());
editor.commit();
subscriber.onNext(mEvernoteUser);
} catch (EDAMUserException e) {
YLog.e(e);
subscriber.onError(e);
} catch (EDAMSystemException e) {
YLog.e(e);
subscriber.onError(e);
} catch (TException e) {
YLog.e(e);
subscriber.onError(e);
}
} else {
subscriber.onError(new RxException("没有登录"));
}
subscriber.onCompleted();
}
}).subscribeOn(Schedulers.io());
}
Aggregations