Forráskód Böngészése

[회원][New] 계정 잠금 시작 화면
- 인증 화면, 완료 화면 필요함

hyodong.min 6 éve
szülő
commit
118734736a

+ 3 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/supervisor/ScreenID.java

@@ -108,6 +108,8 @@ public class ScreenID {
   public static final int PIN_RESET_AUTH_FROM_MULTI_DEVICE = 87;
   public static final int PIN_RESET_INPUT_FROM_MULTI_DEVICE = 88;
   public static final int MY_EVENT_FROM_LIST = 89;
+  public static final int PIN_RESET_AUTH_FROM_MEMBER_BLOCK = 90;
+  public static final int PIN_RESET_INPUT_FROM_MEMBER_BLOCK = 91;
 
   @Retention(RetentionPolicy.SOURCE)
   @IntDef({MAIN, SETTING, FAQ, NETWORK_ERROR, PIN, PIN_RESET, SIGN_UP_START_FROM_ZUMO, ON_BOARDING, PERMISSION_INFO,
@@ -120,7 +122,7 @@ public class ScreenID {
     PIN_RESET_INPUT_FROM_SETTING, /*PIN_RESET_AUTH_FROM_ALREADY_MEMBER,*/ PIN_RESET_INPUT_FROM_ALREADY_MEMBER, CONTENTS, EVENT_LIST, PHONE_NUMBER_RESET, BUCKET_MY_EDIT, BUCKET_DETAIL,
     NETWORK_ERROR_STARTING, OVER_VIEW, ACTIVITY, SERIES, SIGN_UP_START_FROM_ZUMO_ON_BOARDING, WEB_FROM_CONTENTS, BUCKET_ACTIVITY, MAP, MY_EVENT, WINNER_ANNOUNCEMENT,
     EVENT_DETAIL, SEARCH, EVENT_PARTICIPATION, SYSTEM_CHECK, UTILITY_ACTIVITY, SEARCH_RESULT, MY_COIN_DETAIL_GUEST, PIN_RESET_AUTH_FROM_MULTI_DEVICE, PIN_RESET_INPUT_FROM_MULTI_DEVICE,
-    MY_EVENT_FROM_LIST
+    MY_EVENT_FROM_LIST, PIN_RESET_AUTH_FROM_MEMBER_BLOCK, PIN_RESET_AUTH_FROM_MEMBER_BLOCK
   })
   public @interface ID {}
 

+ 13 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/member/IBlockMemberView.java

@@ -16,4 +16,17 @@ import kr.co.zumo.app.lifeplus.view.IView;
  * @since 2019. 1. 31.
  */
 public interface IBlockMemberView extends IView {
+  void setIcon(int iconId);
+
+  void setTitle(int stringId);
+
+  void setDescription(int stringId);
+
+  void setDuration(String str);
+
+  void setDurationVisible(boolean isVisible);
+
+  void setNoticeVisible(boolean isVisible);
+
+  void setButtonText(int stringId);
 }

+ 56 - 6
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/member/MemberBlockFragment.java

@@ -9,6 +9,9 @@ import android.support.annotation.Nullable;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageView;
+import android.widget.TextView;
 
 import kr.co.zumo.app.R;
 import kr.co.zumo.app.lifeplus.helper.ActionBarHelper;
@@ -26,7 +29,15 @@ import kr.co.zumo.app.lifeplus.view.screen.FragmentBase;
  * @history 민효동   [2018. 10. 15.]   [최초 작성]
  * @since 2018. 10. 15.
  */
-public class MemberBlockFragment extends FragmentBase<MemberBlockPresenter> {
+public class MemberBlockFragment extends FragmentBase<MemberBlockPresenter> implements IBlockMemberView {
+  private ImageView icon;
+  private TextView textTitle;
+  private TextView textDescription;
+  private TextView textDuration;
+  private View layoutDuration;
+  private View layoutNotice;
+  private Button buttonConfirm;
+
   @Nullable
   @Override
   protected View onAfterCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
@@ -36,12 +47,16 @@ public class MemberBlockFragment extends FragmentBase<MemberBlockPresenter> {
   @Override
   protected void onAfterActivityCreated(Bundle savedInstanceState) {
 
-    findViewById(R.id.button_block_confirm).setOnClickListener(v -> {
-      presenter.onEvent(new Event.Builder(Event.CONFIRM).build());
-    });
+    icon = findViewById(R.id.image_icon);
+    textTitle = findViewById(R.id.text_title);
+    textDescription = findViewById(R.id.text_description);
+    textDuration = findViewById(R.id.text_duration);
+    layoutDuration = findViewById(R.id.layout_duration);
+    layoutNotice = findViewById(R.id.layout_notice);
+    buttonConfirm = findViewById(R.id.button_confirm);
 
-    findViewById(R.id.button_block_member_close).setOnClickListener(v -> {
-      presenter.onEvent(new Event.Builder(Event.EXIT).build());
+    buttonConfirm.setOnClickListener(v -> {
+      presenter.onEvent(new Event.Builder(Event.CONFIRM).build());
     });
 
     findViewById(R.id.text_view_rest_email_information).setOnClickListener(v -> {
@@ -75,4 +90,39 @@ public class MemberBlockFragment extends FragmentBase<MemberBlockPresenter> {
   protected boolean isSkipScreenWhenBack() {
     return true;
   }
+
+  @Override
+  public void setIcon(int iconId) {
+    icon.setImageResource(iconId);
+  }
+
+  @Override
+  public void setTitle(int stringId) {
+    textTitle.setText(stringId);
+  }
+
+  @Override
+  public void setDescription(int stringId) {
+    textDescription.setText(stringId);
+  }
+
+  @Override
+  public void setDurationVisible(boolean isVisible) {
+    layoutDuration.setVisibility(isVisible ? View.VISIBLE : View.GONE);
+  }
+
+  @Override
+  public void setDuration(String str) {
+    textDuration.setText(str);
+  }
+
+  @Override
+  public void setNoticeVisible(boolean isVisible) {
+    layoutNotice.setVisibility(isVisible ? View.VISIBLE : View.GONE);
+  }
+
+  @Override
+  public void setButtonText(int stringId) {
+    buttonConfirm.setText(stringId);
+  }
 }

+ 66 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/member/MemberBlockModel.java

@@ -3,8 +3,11 @@
  */
 package kr.co.zumo.app.lifeplus.view.screen.member;
 
+import kr.co.zumo.app.R;
 import kr.co.zumo.app.lifeplus.bean.api.LoginBean;
 import kr.co.zumo.app.lifeplus.model.Model;
+import kr.co.zumo.app.lifeplus.util.Formatter;
+import kr.co.zumo.app.lifeplus.util.StringUtil;
 
 /**
  * MemberBlockModel
@@ -62,4 +65,67 @@ public class MemberBlockModel extends Model {
   public LoginBean getLoginBean() {
     return loginBean;
   }
+
+  /**
+   * 잠금 해제를 할 수 있는지 확인
+   *
+   * @return
+   */
+  public boolean canUnlock() {
+    // 기간이 있고
+    String lockTo = loginBean.getLockTo();
+    if (isUnlimited()) {
+      // 기간이 없는 경우 영구 잠금
+      return false;
+    }
+    // 기간이 지났음
+    long toMillis = Formatter.dateStringToMillis(LoginBean.DATE_FORMAT, lockTo);
+    long todayMillis = System.currentTimeMillis();
+    return toMillis < todayMillis;
+  }
+
+  public boolean isUnlimited() {
+    return StringUtil.isEmpty(loginBean.getLockTo());
+  }
+
+  public int getIcon() {
+    return canUnlock() ? R.drawable.icon_stop_account : R.drawable.icon_cancel_impossible;
+  }
+
+  public int getTitle() {
+    return canUnlock() ? R.string.block_member_message_unlock : R.string.block_member_message;
+  }
+
+  public int getDescription() {
+    return canUnlock() ? R.string.block_member_message_detail_unlock : R.string.block_member_message_detail;
+  }
+
+  public String getDuration() {
+    if (isUnlimited()) {
+      return "";
+    }
+    StringBuilder duration = new StringBuilder();
+
+    String lockFrom = loginBean.getLockFrom();
+    String lockTo = loginBean.getLockTo();
+
+    if (StringUtil.isFull(lockFrom)) {
+      duration.append(Formatter.format(lockFrom, LoginBean.DATE_FORMAT, "yyyy.MM.dd"));
+    }
+
+    if (StringUtil.isFull(lockTo)) {
+      duration.append("~").append(Formatter.format(lockTo, LoginBean.DATE_FORMAT, "yyyy.MM.dd"));
+    }
+
+    return duration.toString();
+
+  }
+
+  public boolean isNoticeVisible() {
+    return canUnlock() == false;
+  }
+
+  public int getButtonText() {
+    return canUnlock() ? R.string.block_member_unlock : R.string.confirm;
+  }
 }

+ 33 - 7
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/member/MemberBlockPresenter.java

@@ -3,11 +3,13 @@
  */
 package kr.co.zumo.app.lifeplus.view.screen.member;
 
+import android.util.Log;
+
 import kr.co.zumo.app.R;
+import kr.co.zumo.app.lifeplus.bean.api.LoginBean;
 import kr.co.zumo.app.lifeplus.supervisor.ScreenID;
 import kr.co.zumo.app.lifeplus.util.ResourceUtil;
 import kr.co.zumo.app.lifeplus.view.Event;
-import kr.co.zumo.app.lifeplus.view.IView;
 import kr.co.zumo.app.lifeplus.view.command.EmailSendingCommand;
 import kr.co.zumo.app.lifeplus.view.presenter.Presenter;
 
@@ -21,9 +23,16 @@ import kr.co.zumo.app.lifeplus.view.presenter.Presenter;
  * @history 민효동   [2018. 10. 5.]   [최초 작성]
  * @since 2018. 10. 5.
  */
-public class MemberBlockPresenter extends Presenter<MemberBlockModel, IView> {
-  public MemberBlockPresenter(MemberBlockModel model, IView view) {
+public class MemberBlockPresenter extends Presenter<MemberBlockModel, IBlockMemberView> {
+  public MemberBlockPresenter(MemberBlockModel model, IBlockMemberView view) {
     super(model, view);
+
+    LoginBean loginBean = model.getDeliveryPackaging(LoginBean.class);
+    if (null != loginBean) {
+      Log.i("APP# MemberBlockPresenter | MemberBlockPresenter", "|" + ": " + loginBean.toJson());
+      model.setLoginBean(loginBean);
+      model.clearDeliveryPackaging();
+    }
   }
 
   @Override
@@ -35,6 +44,7 @@ public class MemberBlockPresenter extends Presenter<MemberBlockModel, IView> {
   @Override
   protected void createViewInternal() {
   }
+
   @Override
   protected void destroyInternal() {
 
@@ -72,10 +82,20 @@ public class MemberBlockPresenter extends Presenter<MemberBlockModel, IView> {
   @Override
   protected void onEventInternal(Event event) {
     switch (event.getEventId()) {
-      case Event.EXIT:
-        /* falls through */
       case Event.CONFIRM:
-        go(ScreenID.MAIN);
+        /*
+        todo 처리 달리함
+        기간 내 -> 해제 불가 to main
+        기간 없음 -> 해제 불가 to main
+        기간 후 -> 인증 후 해제 to auth
+         */
+        if (model.canUnlock()) {
+          go(ScreenID.PIN_RESET_AUTH_FROM_MEMBER_BLOCK);
+        }
+        else {
+          go(ScreenID.MAIN);
+        }
+
         break;
       case Event.EMAIL_CLICK:
         onCommand(new EmailSendingCommand(ResourceUtil.getString(R.string.lifeplus_email)));
@@ -92,7 +112,13 @@ public class MemberBlockPresenter extends Presenter<MemberBlockModel, IView> {
 
   @Override
   public void onScreenReady() {
-
+    view.setIcon(model.getIcon());
+    view.setTitle(model.getTitle());
+    view.setDescription(model.getDescription());
+    view.setDurationVisible(model.canUnlock() == false);
+    view.setDuration(ResourceUtil.getString(R.string.block_member_date, model.getDuration()));
+    view.setNoticeVisible(model.isNoticeVisible());
+    view.setButtonText(model.getButtonText());
   }
 
 }

+ 28 - 29
app/src/main/res/layout/fragment_member_block.xml

@@ -2,10 +2,11 @@
 <ScrollView
   xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
+  xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
-  android:fillViewport="true"
-  android:background="@color/CFFFFFF">
+  android:background="@color/CFFFFFF"
+  android:fillViewport="true">
 
   <LinearLayout
     android:layout_width="match_parent"
@@ -15,7 +16,7 @@
 
     <RelativeLayout
       android:layout_width="match_parent"
-      android:layout_height="53dp">
+      android:layout_height="52dp">
 
       <TextView
         android:layout_width="wrap_content"
@@ -28,16 +29,6 @@
         android:textColor="@color/C000000"
         android:textSize="16sp"/>
 
-      <ImageView
-        android:id="@+id/button_block_member_close"
-        android:layout_width="45dp"
-        android:layout_height="45dp"
-        android:layout_alignParentEnd="true"
-        android:layout_centerVertical="true"
-        android:layout_marginEnd="16dp"
-        android:padding="10dp"
-        android:scaleType="center"
-        app:srcCompat="@drawable/icon_header_close"/>
     </RelativeLayout>
 
     <LinearLayout
@@ -48,6 +39,7 @@
       >
 
       <ImageView
+        android:id="@+id/image_icon"
         android:layout_width="57dp"
         android:layout_height="57dp"
         android:layout_gravity="center"
@@ -62,66 +54,72 @@
       android:orientation="vertical">
 
       <TextView
+        android:id="@+id/text_title"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center"
         android:gravity="center_horizontal"
         android:lineSpacingExtra="7sp"
-        android:text="@string/block_member_message"
         android:textColor="@color/C000000"
         android:textSize="17sp"
+        tools:text="@string/block_member_message"
         />
     </LinearLayout>
 
     <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
-      android:layout_marginBottom="52dp"
       android:layout_marginTop="10dp"
+      android:layout_marginBottom="52dp"
       android:orientation="vertical">
 
       <TextView
+        android:id="@+id/text_description"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center"
         android:gravity="center_horizontal"
         android:lineSpacingExtra="5.5sp"
-        android:text="@string/block_member_message_detail"
         android:textColor="@color/C999999"
         android:textSize="14sp"
+        tools:text="@string/block_member_message_detail"
         />
     </LinearLayout>
 
     <LinearLayout
+      android:id="@+id/layout_duration"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_marginLeft="24dp"
       android:layout_marginRight="24dp"
+      android:layout_marginBottom="10dp"
       android:background="@color/CF8F8F8"
       android:orientation="vertical"
-      android:paddingBottom="22dp"
       android:paddingLeft="25dp"
+      android:paddingTop="22dp"
       android:paddingRight="25dp"
-      android:paddingTop="22dp">
+      android:paddingBottom="22dp">
 
       <TextView
+        android:id="@+id/text_duration"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_gravity="center"
         android:gravity="center_horizontal"
         android:lineSpacingExtra="5sp"
-        android:text="@string/block_member_date"
         android:textColor="@color/C000000"
         android:textSize="14sp"
+        tools:text="@string/block_member_date"
         />
 
     </LinearLayout>
 
     <LinearLayout
+      android:id="@+id/layout_notice"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
-      android:layout_marginBottom="26dp"
-      android:layout_marginTop="17dp"
+      android:layout_marginTop="7dp"
+      android:layout_marginBottom="13dp"
       android:gravity="center"
       android:orientation="vertical">
 
@@ -155,21 +153,22 @@
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_marginLeft="24dp"
+      android:layout_marginTop="13dp"
       android:layout_marginRight="24dp"
       android:background="@drawable/rectangle_border_ce5e5e5_corner_2"
       android:gravity="center"
       android:orientation="horizontal"
-      android:paddingBottom="17dp"
       android:paddingLeft="45dp"
+      android:paddingTop="17dp"
       android:paddingRight="45dp"
-      android:paddingTop="17dp">
+      android:paddingBottom="17dp">
 
       <ImageView
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginRight="8dp"
-        android:paddingBottom="10dp"
         android:paddingTop="10dp"
+        android:paddingBottom="10dp"
         app:srcCompat="@drawable/icon_email"
         />
 
@@ -179,9 +178,9 @@
         android:layout_height="wrap_content"
         android:gravity="center_horizontal"
         android:lineSpacingExtra="3sp"
-        android:paddingBottom="10dp"
-        android:paddingRight="10dp"
         android:paddingTop="10dp"
+        android:paddingRight="10dp"
+        android:paddingBottom="10dp"
         android:text="@string/rest_member_email_information"
         android:textColor="@color/C999999"
         android:textSize="12sp"
@@ -198,12 +197,12 @@
     <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="42dp"
-      android:layout_marginBottom="24dp"
       android:layout_marginLeft="24dp"
-      android:layout_marginRight="24dp">
+      android:layout_marginRight="24dp"
+      android:layout_marginBottom="24dp">
 
       <Button
-        android:id="@+id/button_block_confirm"
+        android:id="@+id/button_confirm"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@drawable/rectangle_black_radius_2"

+ 4 - 1
app/src/main/res/values/strings.xml

@@ -74,8 +74,11 @@
 
   <string name="block_member_title">계정잠금 안내</string>
   <string name="block_member_message">회원님의 계정은\n잠금해제가 불가합니다.</string>
+  <string name="block_member_message_unlock">회원님의 계정이 일시적으로\n사용중지 되었습니다.</string>
   <string name="block_member_message_detail">회원님의 계정은 아래의 기간동안\n일시적으로 서비스이용이 제한됩니다.</string>
-  <string name="block_member_date">기간 2018.08.03 ~ 2019.02.03</string>
+  <string name="block_member_message_detail_unlock">회원님의 계정이 일시적으로 접속 차단되었습니다.\n본인인증 완료 후 정상적으로 서비스를\n이용하실 수 있습니다.</string>
+  <string name="block_member_date">기간 %s</string>
+  <string name="block_member_unlock">본인인증</string>
 
 
   <string name="sign_up_hello_text">Lifeplus만의\n다양한 혜택을 이용해 보세요.</string>