|
|
@@ -3,10 +3,15 @@
|
|
|
*/
|
|
|
package kr.co.zumo.app.lifeplus.model.module;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
import io.reactivex.Single;
|
|
|
+import kr.co.zumo.app.lifeplus.bean.api.MainContentsBean;
|
|
|
+import kr.co.zumo.app.lifeplus.bean.api.MainContentsCategoryBean;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.MainContentsResultBean;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.RequestBean;
|
|
|
import kr.co.zumo.app.lifeplus.network.api.LifeplusAPIRepository;
|
|
|
+import kr.co.zumo.app.lifeplus.view.screen.category.CategoryID;
|
|
|
|
|
|
/**
|
|
|
* APICodeLoadModule
|
|
|
@@ -21,6 +26,23 @@ import kr.co.zumo.app.lifeplus.network.api.LifeplusAPIRepository;
|
|
|
public class APIMainContentsModule extends LifeplusAPIModule<RequestBean, MainContentsResultBean> {
|
|
|
@Override
|
|
|
protected Single<MainContentsResultBean> getAPI(RequestBean requestBean) {
|
|
|
- return new LifeplusAPIRepository().getMainContents(requestBean);
|
|
|
+ return new LifeplusAPIRepository().getMainContents(requestBean)
|
|
|
+ .map(mainContentsResultBean -> {
|
|
|
+ if (null != mainContentsResultBean) {
|
|
|
+ List<MainContentsBean> list = mainContentsResultBean.getData();
|
|
|
+ if (null != list && list.size() > 0) {
|
|
|
+ for (MainContentsBean mainContentsBean : list) {
|
|
|
+ // this week 는 메인에 10개로 제한
|
|
|
+ if (CategoryID.CATEGORY_5.equals(mainContentsBean.getCategoryNo())) {
|
|
|
+ List<MainContentsCategoryBean> thisWeekBeans = mainContentsBean.getContentsList();
|
|
|
+ if (null != thisWeekBeans && thisWeekBeans.size() > 10) {
|
|
|
+ mainContentsBean.setContentsList(thisWeekBeans.subList(0, 10));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return mainContentsResultBean;
|
|
|
+ });
|
|
|
}
|
|
|
}
|