use of com.mnnyang.gzuclassschedule.data.beanv2.UserWrapper in project GzuClassSchedule by mnnyang.
the class HomePresenter method loadUserInfo.
/**
* 加载用户信息
*/
@Override
public void loadUserInfo() {
if (TextUtils.isEmpty(Cache.instance().getEmail())) {
if (mView == null) {
// 检查到view已经被销毁
return;
}
mView.noSignInPage();
return;
}
new MyHttpUtils().userInfo(new HttpCallback<UserWrapper>() {
@Override
public void onSuccess(UserWrapper userWrapper) {
if (mView == null) {
// view被销毁
return;
}
if (userWrapper != null) {
if (userWrapper.getCode() == 1) {
Cache.instance().setUser(userWrapper.getData());
mView.signInPage(userWrapper.getData());
} else if (userWrapper.getCode() == 3) {
Cache.instance().setEmail("");
mView.noSignInPage();
LogUtil.e(this, userWrapper.toString());
}
}
}
@Override
public void onFail(String errMsg) {
if (mView == null) {
// view被销毁
return;
}
LogUtil.e(this, errMsg);
}
});
}
Aggregations