|
|
@@ -3,34 +3,13 @@
|
|
|
*/
|
|
|
package kr.co.zumo.app.lifeplus.activity;
|
|
|
|
|
|
-import android.arch.lifecycle.ViewModelProviders;
|
|
|
import android.content.Intent;
|
|
|
-import android.net.Uri;
|
|
|
-import android.support.v4.app.FragmentActivity;
|
|
|
import android.util.Log;
|
|
|
|
|
|
-import kr.co.zumo.app.lifeplus.bean.ContentsDeliveryBean;
|
|
|
-import kr.co.zumo.app.lifeplus.bean.EventDeliveryBean;
|
|
|
import kr.co.zumo.app.lifeplus.bean.PushBean;
|
|
|
-import kr.co.zumo.app.lifeplus.bean.UtilityActivityBean;
|
|
|
-import kr.co.zumo.app.lifeplus.bean.api.LifeplusContentsBean;
|
|
|
-import kr.co.zumo.app.lifeplus.config.NetworkConfig;
|
|
|
-import kr.co.zumo.app.lifeplus.helper.DeliveryHelper;
|
|
|
-import kr.co.zumo.app.lifeplus.helper.Helper;
|
|
|
-import kr.co.zumo.app.lifeplus.helper.ScreenChangerHelper;
|
|
|
-import kr.co.zumo.app.lifeplus.model.BlankModel;
|
|
|
-import kr.co.zumo.app.lifeplus.model.Model;
|
|
|
import kr.co.zumo.app.lifeplus.model.SuperModel;
|
|
|
import kr.co.zumo.app.lifeplus.supervisor.ActivityDeliveryHelper;
|
|
|
-import kr.co.zumo.app.lifeplus.supervisor.PushMessageManager;
|
|
|
-import kr.co.zumo.app.lifeplus.supervisor.ScreenID;
|
|
|
-import kr.co.zumo.app.lifeplus.supervisor.screen.Screen;
|
|
|
-import kr.co.zumo.app.lifeplus.util.StringUtil;
|
|
|
-import kr.co.zumo.app.lifeplus.view.IView;
|
|
|
-import kr.co.zumo.app.lifeplus.view.command.ScreenCommand;
|
|
|
-import kr.co.zumo.app.lifeplus.view.presenter.BlankPresenter;
|
|
|
-import kr.co.zumo.app.lifeplus.view.presenter.CommandInvoker;
|
|
|
-import kr.co.zumo.app.lifeplus.view.presenter.Presenter;
|
|
|
+import kr.co.zumo.app.lifeplus.supervisor.PushMessageLink;
|
|
|
|
|
|
/**
|
|
|
* ActivitySetup
|
|
|
@@ -68,110 +47,14 @@ public abstract class ActivityBaseSetup extends ActivityBase {
|
|
|
*/
|
|
|
PushBean pushBean = ActivityDeliveryHelper.getInstance().getPackaging(PushBean.class);
|
|
|
|
|
|
- if (null != pushBean) {
|
|
|
- Log.d("APP# ActivityBaseSetup | doOnLink", "|" + "pushBean: " + pushBean.toJson());
|
|
|
- ActivityDeliveryHelper.getInstance().clearPackaging();
|
|
|
- DeliveryHelper deliveryHelper = getHelper(DeliveryHelper.class);
|
|
|
-
|
|
|
- int id = ScreenID.NONE;
|
|
|
- String code = pushBean.getScreenCode();
|
|
|
-
|
|
|
- if (StringUtil.isFull(code)) {
|
|
|
- UtilityActivityBean utilityActivityBean;
|
|
|
- switch (code) {
|
|
|
- case PushMessageManager.CODE_QNA:
|
|
|
- // 나의 문의 내역 - 프래그먼트 뿐이므로 유틸리티 액티비티를 이용
|
|
|
- utilityActivityBean = new UtilityActivityBean();
|
|
|
- utilityActivityBean.setScreenId(ScreenID.MY_FAQ);
|
|
|
- deliveryHelper.setPackaging(utilityActivityBean);
|
|
|
- id = ScreenID.UTILITY_ACTIVITY;
|
|
|
- break;
|
|
|
- case PushMessageManager.CODE_EXTINCTION:
|
|
|
- // my extinct coin - 프래그먼트 뿐이므로 유틸리티 액티비티를 이용
|
|
|
- utilityActivityBean = new UtilityActivityBean();
|
|
|
- utilityActivityBean.setScreenId(ScreenID.MY_COIN_EXTINCT);
|
|
|
- deliveryHelper.setPackaging(utilityActivityBean);
|
|
|
- id = ScreenID.UTILITY_ACTIVITY;
|
|
|
- break;
|
|
|
- case PushMessageManager.CODE_EVENT_WINNER:
|
|
|
- // event winner
|
|
|
- deliveryHelper.setPackaging(pushBean.getItemNo());
|
|
|
- id = ScreenID.EVENT_WINNER;
|
|
|
- break;
|
|
|
- case PushMessageManager.CODE_EVENT_DETAIL:
|
|
|
- // event detail
|
|
|
- // 이벤트 타입없이 전달하면 타입 구분 후 진행된다.
|
|
|
- deliveryHelper.setPackaging(new EventDeliveryBean(pushBean.getItemNo(), ""));
|
|
|
-
|
|
|
- id = ScreenID.EVENT_DETAIL;
|
|
|
-
|
|
|
- break;
|
|
|
- case PushMessageManager.CODE_CONTENTS:
|
|
|
- // 컨텐츠
|
|
|
- // 데이터 준비
|
|
|
- LifeplusContentsBean lifeplusContentsBean = new LifeplusContentsBean();
|
|
|
- lifeplusContentsBean.setItemNo(pushBean.getItemNo());
|
|
|
- ContentsDeliveryBean contentsDeliveryBean = new ContentsDeliveryBean.Builder(lifeplusContentsBean).pageIndex(0).build();
|
|
|
- deliveryHelper.setPackaging(contentsDeliveryBean);
|
|
|
-
|
|
|
- id = ScreenID.CONTENTS;
|
|
|
- break;
|
|
|
- case PushMessageManager.CODE_MY_COUPON:
|
|
|
- // 마이 쿠폰
|
|
|
- Uri.Builder uri = Uri.parse(NetworkConfig.getCoopUrl() + ":" + NetworkConfig.getCoopPort()).buildUpon();
|
|
|
- uri.appendPath(NetworkConfig.getCoopMyPage());
|
|
|
- deliveryHelper.setPackaging(uri.toString());
|
|
|
-
|
|
|
- id = ScreenID.COUPON_MALL;
|
|
|
- break;
|
|
|
- default:
|
|
|
- id = ScreenID.MAIN;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (id != ScreenID.NONE) {
|
|
|
- goTo(id);
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- Log.e("APP# ActivityBaseSetup | doOnLink", "|" + " has no link via push...................");
|
|
|
- }
|
|
|
-
|
|
|
+ PushMessageLink.link(this, pushBean);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Log.e("APP# ActivityBaseSetup | doOnLink", "|" + " has no link via push...................");
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- private void goTo(int id) {
|
|
|
- //fixme 화면 이동하는데 필요 설정을 더 간단히 할 수 있을 것 같다.
|
|
|
-
|
|
|
- // dummy for change screen
|
|
|
- ScreenChangerHelper helper = getHelper(ScreenChangerHelper.class);
|
|
|
- helper.setAppCompatActivity(this);
|
|
|
-
|
|
|
- Presenter presenter = new BlankPresenter(getModel(BlankModel.class), new IView() {
|
|
|
- @Override
|
|
|
- public FragmentActivity getActivity() {
|
|
|
- return ActivityBaseSetup.this;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public <H extends Helper> H getHelper(Class<H> helperClass) {
|
|
|
- return ActivityBaseSetup.this.getHelper(helperClass);
|
|
|
- }
|
|
|
- });
|
|
|
|
|
|
- new CommandInvoker().invoke(presenter, new ScreenCommand(id, ScreenID.DIRECTION_NEXT, Screen.METHOD_SKIP));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 모델을 반환한다.
|
|
|
- *
|
|
|
- * @param modelClass MainModel.class
|
|
|
- * @return new MainModel() or exist object
|
|
|
- */
|
|
|
- public <T extends Model> T getModel(Class<T> modelClass) {
|
|
|
- return ViewModelProviders.of(this).get(modelClass);
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
|