|
|
@@ -14,8 +14,10 @@ import io.reactivex.disposables.Disposable;
|
|
|
import io.reactivex.schedulers.Schedulers;
|
|
|
import kr.co.zumo.app.lifeplus.ILifeCycle;
|
|
|
import kr.co.zumo.app.lifeplus.application.App;
|
|
|
+import kr.co.zumo.app.lifeplus.bean.api.BookmarkListResultBean;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.BucketListRequestBean;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.BucketListResultBean;
|
|
|
+import kr.co.zumo.app.lifeplus.bean.api.PageRequestBean;
|
|
|
import kr.co.zumo.app.lifeplus.helper.DeliveryHelper;
|
|
|
import kr.co.zumo.app.lifeplus.helper.DeliveryResultHelper;
|
|
|
import kr.co.zumo.app.lifeplus.helper.Helper;
|
|
|
@@ -30,6 +32,7 @@ import kr.co.zumo.app.lifeplus.util.StringUtil;
|
|
|
import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
import kr.co.zumo.app.lifeplus.view.IEventListener;
|
|
|
import kr.co.zumo.app.lifeplus.view.IWaiterCallable;
|
|
|
+import kr.co.zumo.app.lifeplus.view.screen.my.bookmark.BookmarkManager;
|
|
|
import kr.co.zumo.app.lifeplus.view.screen.my.bucketlist.BucketListManager;
|
|
|
|
|
|
/**
|
|
|
@@ -52,6 +55,7 @@ public abstract class Model extends ViewModel implements ILifeCycle, IHelperProv
|
|
|
private INetworkReceiverListener networkListener;
|
|
|
protected IWaiterCallable waiterCaller;
|
|
|
private Disposable disposableBucket;
|
|
|
+ private Disposable disposableBookMarkList;
|
|
|
private int screenId;
|
|
|
private int prevScreenId;
|
|
|
|
|
|
@@ -325,6 +329,26 @@ public abstract class Model extends ViewModel implements ILifeCycle, IHelperProv
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 북마크 수를 파악
|
|
|
+ *
|
|
|
+ * @param listener
|
|
|
+ */
|
|
|
+ public void loadMyBookMarkCount(IEventListener listener) {
|
|
|
+ disposableBookMarkList = BookmarkManager.getInstance().loadMyBookmark(new PageRequestBean(), new APIModuleListener<BookmarkListResultBean>(waiterCaller) {
|
|
|
+ @Override
|
|
|
+ public void onApiSuccess(BookmarkListResultBean resultBean) {
|
|
|
+
|
|
|
+ listener.onEvent(new Event.Builder(Event.RESULT).integer(BookmarkManager.getInstance().getCountOfBookmark()).build());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onApiError(String errorMessage, APIError error) {
|
|
|
+ listener.onEvent(new Event.Builder(Event.RESULT).integer(0).build());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 현 Screen ID 저장
|
|
|
*
|
|
|
@@ -398,6 +422,10 @@ public abstract class Model extends ViewModel implements ILifeCycle, IHelperProv
|
|
|
disposableBucket.dispose();
|
|
|
disposableBucket = null;
|
|
|
}
|
|
|
+ if (null != disposableBookMarkList) {
|
|
|
+ disposableBookMarkList.dispose();
|
|
|
+ disposableBookMarkList = null;
|
|
|
+ }
|
|
|
|
|
|
stopInternal();
|
|
|
}
|