|
|
@@ -131,23 +131,30 @@ public class MainModel extends Model {
|
|
|
}
|
|
|
|
|
|
public void loadPopupInfo() {
|
|
|
- disposablePromotion = new APIPopupLoadModule().call(new RequestBean(), new APIModuleSimpleListener<PopupInfoResultBean>() {
|
|
|
- @Override
|
|
|
- public void onApiSuccess(PopupInfoResultBean resultBean) {
|
|
|
- popupInfoListBean = resultBean.getData();
|
|
|
- if (null != popupInfoListBean) {
|
|
|
- promotionPopupBeans = popupInfoListBean.getPromotionPopupList();
|
|
|
- SystemPopupModelHelper.getInstance().setSystemPopupBeans(popupInfoListBean.getSystemPopupList());
|
|
|
+ if (SystemPopupModelHelper.getInstance().isAvailableRefresh()) {
|
|
|
+ disposablePromotion = new APIPopupLoadModule().call(new RequestBean(), new APIModuleSimpleListener<PopupInfoResultBean>() {
|
|
|
+ @Override
|
|
|
+ public void onApiSuccess(PopupInfoResultBean resultBean) {
|
|
|
+ popupInfoListBean = resultBean.getData();
|
|
|
+ if (null != popupInfoListBean) {
|
|
|
+ promotionPopupBeans = popupInfoListBean.getPromotionPopupList();
|
|
|
+ SystemPopupModelHelper.getInstance().setSystemPopupBeans(popupInfoListBean.getSystemPopupList());
|
|
|
+ }
|
|
|
+
|
|
|
+ onResult(new Event.Builder(Event.SUCCESS).integer(Event.LOADED_POPUP_INFO).build());
|
|
|
}
|
|
|
|
|
|
- onResult(new Event.Builder(Event.SUCCESS).integer(Event.LOADED_POPUP_INFO).build());
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onApiError(String errorMessage, APIError error) {
|
|
|
- onResult(new Event.Builder(Event.ERROR).integer(Event.LOADED_POPUP_INFO).string(errorMessage).build());
|
|
|
- }
|
|
|
- });
|
|
|
+ @Override
|
|
|
+ public void onApiError(String errorMessage, APIError error) {
|
|
|
+ onResult(new Event.Builder(Event.ERROR).integer(Event.LOADED_POPUP_INFO).string(errorMessage).build());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ SystemPopupModelHelper.getInstance().setAvailableRefresh();
|
|
|
+ promotionPopupBeans = SystemPopupModelHelper.getInstance().getPromotionPopupBeans();
|
|
|
+ onResult(new Event.Builder(Event.SUCCESS).integer(Event.LOADED_POPUP_INFO).build());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private List<PromotionPopupBean> promotionPopupBeans;
|