浏览代码

[설정][New] 1:1 문의 에서 알림 설정 시 반영

hyodong.min 6 年之前
父节点
当前提交
f6088ae67b

+ 26 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/bean/MemberPushAgreeResultBean.java

@@ -0,0 +1,26 @@
+/*
+ * COPYRIGHT (c) 2018 All rights reserved by HANWHA LIFE.
+ */
+package kr.co.zumo.app.lifeplus.bean;
+
+/**
+ * MemberPushAgreeResultBean
+ * <pre>
+ * </pre>
+ *
+ * @author 민효동
+ * @version 1.0
+ * @history 민효동   [2019-03-27]   [최초 작성]
+ * @since 2019-03-27
+ */
+public class MemberPushAgreeResultBean extends JsonBeanBase {
+  private boolean isPushEnabled;
+
+  public MemberPushAgreeResultBean(boolean pushEnabled) {
+    this.isPushEnabled = pushEnabled;
+  }
+
+  public boolean isPushEnabled() {
+    return isPushEnabled;
+  }
+}

+ 1 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/inquiry/InquiryWriteModel.java

@@ -233,10 +233,9 @@ public class InquiryWriteModel extends Model {
         onResult(new Event.Builder(Event.ERROR).index(SettingViewHolder.SWITCH_PUSH).bool(isEnabled).string(errorMessage).build());
       }
     });
-
   }
 
-  protected void setPushEnabledInternal(boolean isEnabled) {
+  private void setPushEnabledInternal(boolean isEnabled) {
     SuperModel.getInstance().getPreferences().setPushContentsAndService(isEnabled);
   }
 

+ 5 - 3
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/inquiry/InquiryWritePresenter.java

@@ -1,6 +1,7 @@
 package kr.co.zumo.app.lifeplus.view.screen.inquiry;
 
 import kr.co.zumo.app.R;
+import kr.co.zumo.app.lifeplus.bean.MemberPushAgreeResultBean;
 import kr.co.zumo.app.lifeplus.model.verify.Verifier;
 import kr.co.zumo.app.lifeplus.util.ResourceUtil;
 import kr.co.zumo.app.lifeplus.view.Event;
@@ -72,7 +73,7 @@ public class InquiryWritePresenter extends Presenter<InquiryWriteModel, IInquiry
         break;
       case Event.CANCEL:
         // 취소
-        onBackPressed();
+        back();
         break;
       default:
         break;
@@ -93,11 +94,12 @@ public class InquiryWritePresenter extends Presenter<InquiryWriteModel, IInquiry
       case Event.RESULT:
         if (index == SettingViewHolder.SWITCH_PUSH) {
           {}// 푸쉬
-
+          // 설정에 변동 사항을 알리기 위해 저장
+          model.setResultPackaging(new MemberPushAgreeResultBean(model.isPushEnabled()));
         }
         else {
           // 등록 완료
-          onBackPressed();
+          back();
         }
         break;
       case Event.ERROR:

+ 2 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/setting/ISettingView.java

@@ -31,9 +31,9 @@ public interface ISettingView extends IView {
 
   void setAccountType(int type);
 
-  void setPushEnabled(boolean isEnabled);
+  void setPushContentsAndService(boolean isEnabled);
 
-  void setPushMarketingEnabled(boolean isEnabled);
+  void setPushEventEnabled(boolean isEnabled);
 
   void setLocationServiceEnabled(boolean isEnabled);
 

+ 2 - 2
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/setting/SettingFragment.java

@@ -128,12 +128,12 @@ public class SettingFragment extends FragmentBase<SettingPresenter> implements I
   }
 
   @Override
-  public void setPushEnabled(boolean isEnabled) {
+  public void setPushContentsAndService(boolean isEnabled) {
     settingHolderBean.setAllowPush(isEnabled);
   }
 
   @Override
-  public void setPushMarketingEnabled(boolean isEnabled) {
+  public void setPushEventEnabled(boolean isEnabled) {
     settingHolderBean.setAllowPushMarketing(isEnabled);
   }
 

+ 12 - 4
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/setting/SettingPresenter.java

@@ -9,6 +9,7 @@ import java.util.Calendar;
 
 import kr.co.zumo.app.R;
 import kr.co.zumo.app.lifeplus.application.App;
+import kr.co.zumo.app.lifeplus.bean.MemberPushAgreeResultBean;
 import kr.co.zumo.app.lifeplus.supervisor.ScreenID;
 import kr.co.zumo.app.lifeplus.tool.IShareListener;
 import kr.co.zumo.app.lifeplus.tool.Share;
@@ -87,6 +88,13 @@ public class SettingPresenter extends Presenter<SettingModel, ISettingView> {
 
   @Override
   protected void startInternal() {
+    MemberPushAgreeResultBean bean = model.getResultPackaging(MemberPushAgreeResultBean.class);
+    if (null != bean) {
+      model.clearResultPackaging();
+      // model(superModel) 에는 반영됐으므로 ui만 반영하면 됨
+      view.setPushContentsAndService(bean.isPushEnabled());
+      view.notifyUpdate();
+    }
   }
 
   @Override
@@ -311,12 +319,12 @@ public class SettingPresenter extends Presenter<SettingModel, ISettingView> {
         // push / 위치 설정
         if (index == SettingViewHolder.SWITCH_PUSH) {
           // 푸쉬
-          view.setPushEnabled(!bool);
+          view.setPushContentsAndService(!bool);
           view.notifyUpdate();
         }
         else if (index == SettingViewHolder.SWITCH_MARKETING) {
           // 마케팅
-          view.setPushMarketingEnabled(!bool);
+          view.setPushEventEnabled(!bool);
           view.notifyUpdate();
         }
         else if (index == SettingViewHolder.SWITCH_LOCATION) {
@@ -350,8 +358,8 @@ public class SettingPresenter extends Presenter<SettingModel, ISettingView> {
 
     //SettingMemberBean memberBean = model.getSettingMemberBean();
 
-    view.setPushEnabled(model.isPushContentsAndService());
-    view.setPushMarketingEnabled(model.isPushEventEnabled());
+    view.setPushContentsAndService(model.isPushContentsAndService());
+    view.setPushEventEnabled(model.isPushEventEnabled());
     view.setLocationServiceEnabled(model.isLocationServiceEnabled());
 
     if (model.isActiveMember()) {