Browse Source

[로그인][New] 잠긴 회원 처리: 메인 화면

hyodong.min 7 years ago
parent
commit
ca82f4c904

+ 2 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/activity/ActivityStarter.java

@@ -97,10 +97,12 @@ public class ActivityStarter {
             else {
               if (loginBean.getBlockStatus().equals(LoginBean.LOCK_STATUS_BLOCK)) {
                 // 블럭 계정
+                SuperModel.getInstance().setBlockMember(SuperModel.MEMBER_STATUS_BLOCK);
                 gotoScreen(BlockMemberActivity.class);
               }
               else if (loginBean.getMemberStatus().equals(LoginBean.USER_STATUS_REST)) {
                 // 휴면 계정
+                SuperModel.getInstance().setBlockMember(SuperModel.MEMBER_STATUS_REST);
                 gotoScreen(RestMemberActivity.class);
               }
             }

+ 13 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/activity/MainActivity.java

@@ -6,6 +6,7 @@ package kr.co.zumo.app.lifeplus.activity;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.View;
+import android.widget.TextView;
 
 import kr.co.zumo.app.R;
 import kr.co.zumo.app.lifeplus.manager.ActionBarManager;
@@ -85,6 +86,18 @@ public class MainActivity extends ActivityBase<MainPresenter> implements IMainVi
     });
 
     render();
+
+    TextView textView = findViewById(R.id.text_member_status);
+    String memberStatus = null;
+    if (SuperModel.getInstance().getMemberStatus() == SuperModel.MEMBER_STATUS_BLOCK) {
+      memberStatus = "Blocked";
+    }
+    else if (SuperModel.getInstance().getMemberStatus() == SuperModel.MEMBER_STATUS_REST) {
+      memberStatus = "Inactive";
+    }
+    if (null != memberStatus) {
+      textView.setText("Member status: " + memberStatus);
+    }
   }
 
   private void clearData() {

+ 30 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/model/SuperModel.java

@@ -18,6 +18,11 @@ import kr.co.zumo.app.lifeplus.util.StringUtil;
  * @since 2018. 9. 5.
  */
 public final class SuperModel {
+
+  public static final int MEMBER_STATUS_NORMAL = 0;
+  public static final int MEMBER_STATUS_BLOCK = 999;
+  public static final int MEMBER_STATUS_REST = 200;
+
   private static final SuperModel ourInstance = new SuperModel();
 
   public static SuperModel getInstance() {
@@ -27,6 +32,7 @@ public final class SuperModel {
   private String deviceUuid;
   private String UserId;
   private String token;
+  private int memberStatus = MEMBER_STATUS_NORMAL;
   private LifeplusPreferences preferences;
 
   private SuperModel() {
@@ -114,6 +120,30 @@ public final class SuperModel {
     preferences.setToken(token);
   }
 
+  /**
+   * 회원 상태 표시
+   * - 잠긴 회원|휴면 회원 등
+   *
+   * @param memberStatus
+   */
+  public void setBlockMember(int memberStatus) {
+    this.memberStatus = memberStatus;
+  }
+
+  public int getMemberStatus() {
+    return memberStatus;
+  }
+
+  /**
+   * 활성 상태의 회원인지 판단.
+   * - 잠긴, 휴면 등으로 활성 상태가 아닌 경우 비회원으로 진행
+   *
+   * @return
+   */
+  public boolean isActiveMember() {
+    return StringUtil.isFull(getUserId()) && getMemberStatus() == MEMBER_STATUS_NORMAL;
+  }
+
   /**
    * 핀 저장
    *

+ 2 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/presenter/signup/SignUpAgreePresenter.java

@@ -140,10 +140,12 @@ public class SignUpAgreePresenter extends Presenter<SignUpModel, ISignUpAgreeVie
           else {
             if (loginBean.getBlockStatus().equals(LoginBean.LOCK_STATUS_BLOCK)) {
               // 블럭 계정
+              SuperModel.getInstance().setBlockMember(SuperModel.MEMBER_STATUS_BLOCK);
               onCommand(new ActivityChangeCommand(ScreenID.ACTIVITY_MEMBER_BLOCK, ScreenID.DIRECTION_NEXT));
             }
             else if (loginBean.getMemberStatus().equals(LoginBean.USER_STATUS_REST)) {
               // 휴면 계정
+              SuperModel.getInstance().setBlockMember(SuperModel.MEMBER_STATUS_REST);
               onCommand(new ActivityChangeCommand(ScreenID.ACTIVITY_MEMBER_REST, ScreenID.DIRECTION_NEXT));
             }
           }

+ 25 - 0
app/src/main/res/layout/activity_main.xml

@@ -15,6 +15,30 @@
     android:gravity="bottom"
     android:orientation="vertical">
 
+    <LinearLayout
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content"
+      android:gravity="bottom"
+      android:orientation="horizontal"
+      android:paddingStart="20dp"
+      android:paddingTop="10dp"
+      android:paddingEnd="20dp"
+      android:paddingBottom="10dp"
+      >
+
+      <TextView
+        android:id="@+id/text_member_status"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        tools:text="Member status: inactive"/>
+
+      <Space
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"/>
+
+    </LinearLayout>
+
     <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
@@ -71,6 +95,7 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="Reset Pin"/>
+
       <Space
         android:layout_width="0dp"
         android:layout_height="wrap_content"