|
|
@@ -0,0 +1,93 @@
|
|
|
+/*
|
|
|
+ * COPYRIGHT (c) 2018 All rights reserved by HANWHA LIFE.
|
|
|
+ */
|
|
|
+package kr.co.zumo.app.lifeplus.model.setting.common;
|
|
|
+
|
|
|
+import io.reactivex.disposables.Disposable;
|
|
|
+import kr.co.zumo.app.lifeplus.bean.api.CoinBean;
|
|
|
+import kr.co.zumo.app.lifeplus.bean.api.CoinResultBean;
|
|
|
+import kr.co.zumo.app.lifeplus.bean.api.RequestBean;
|
|
|
+import kr.co.zumo.app.lifeplus.model.Model;
|
|
|
+import kr.co.zumo.app.lifeplus.model.module.APICoInLoadModule;
|
|
|
+import kr.co.zumo.app.lifeplus.model.module.IAPIModuleListener;
|
|
|
+import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
+
|
|
|
+/**
|
|
|
+ * SettingMemberQuitInfoModel
|
|
|
+ * <pre>
|
|
|
+ * </pre>
|
|
|
+ *
|
|
|
+ * @author 민효동
|
|
|
+ * @version 1.0
|
|
|
+ * @history 민효동 [2018. 10. 31.] [최초 작성]
|
|
|
+ * @since 2018. 10. 31.
|
|
|
+ */
|
|
|
+public class SettingMemberQuitInfoModel extends Model {
|
|
|
+
|
|
|
+ private Disposable disposable;
|
|
|
+ private CoinBean coinBean;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void destroyInternal() {
|
|
|
+ disposeCoin();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void startInternal() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void stopInternal() {
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void resumeInternal() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void pauseInternal() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void disposeCoin() {
|
|
|
+ if (null != disposable) {
|
|
|
+ disposable.dispose();
|
|
|
+ disposable = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public CoinBean getCoinBean() {
|
|
|
+ return coinBean;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void loadCoins() {
|
|
|
+ disposable = new APICoInLoadModule().call(new RequestBean(), new IAPIModuleListener<CoinResultBean>() {
|
|
|
+ @Override
|
|
|
+ public void onApiSuccess(CoinResultBean resultBean) {
|
|
|
+ coinBean = resultBean.getData();
|
|
|
+
|
|
|
+ presenter.onResult(new Event.Builder(Event.RESULT).build());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onApiReason(CoinResultBean resultBean) {
|
|
|
+ presenter.onResult(new Event.Builder(Event.ERROR).string(resultBean.getReturnMessage()).build());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onApiError(String errorMessage) {
|
|
|
+ presenter.onResult(new Event.Builder(Event.ERROR).string(errorMessage).build());
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 로드 중지
|
|
|
+ */
|
|
|
+ public void stopLoading() {
|
|
|
+ disposeCoin();
|
|
|
+ }
|
|
|
+}
|