浏览代码

[인증][New] 인증 번호 전송 실패 시 오류 메세지 표시

hyodong.min 6 年之前
父节点
当前提交
e7561034c7
共有 1 个文件被更改,包括 17 次插入6 次删除
  1. 17 6
      app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/auth/MobileAuthPresenter.java

+ 17 - 6
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/auth/MobileAuthPresenter.java

@@ -26,6 +26,7 @@ import kr.co.zumo.app.lifeplus.model.module.APIAuthNumberModule;
 import kr.co.zumo.app.lifeplus.model.module.APIError;
 import kr.co.zumo.app.lifeplus.model.module.IAPIModuleReasonListener;
 import kr.co.zumo.app.lifeplus.model.module.IAPIModuleListener;
+import kr.co.zumo.app.lifeplus.util.AppUtil;
 import kr.co.zumo.app.lifeplus.util.DateUtil;
 import kr.co.zumo.app.lifeplus.util.Formatter;
 import kr.co.zumo.app.lifeplus.util.ResourceUtil;
@@ -372,7 +373,7 @@ public class MobileAuthPresenter implements IMobileAuthContract.Presenter {
             if (resultBean.getCode() == LifeplusAPIBean.RETURN_MOBILE_AUTH_ERROR_NEED_FOR_30_DAYS
               || resultBean.getCode() == LifeplusAPIBean.RETURN_MOBILE_AUTH_ERROR_UNDER_14_YEARS
               || resultBean.getCode() == LifeplusAPIBean.RETURN_MOBILE_AUTH_ERROR_ALREADY_MEMBER
-              ) {
+            ) {
               // 성공
               doSomeWhenConfirmSuccess(resultBean);
             }
@@ -588,7 +589,12 @@ public class MobileAuthPresenter implements IMobileAuthContract.Presenter {
 
           @Override
           public void onApiError(String errorMessage, APIError error) {
-            onSendingFail();
+            if (error.getCode() == APIError.ERROR_HTTP) {
+              onSendingFail(errorMessage);
+            }
+            else {
+              onSendingFail(ResourceUtil.getString(R.string.phone_identify_submit_message_fail));
+            }
           }
         })
       );
@@ -609,11 +615,11 @@ public class MobileAuthPresenter implements IMobileAuthContract.Presenter {
     });
   }
 
-  private void onSendingFail() {
+  private void onSendingFail(String errorMessage) {
     verifyRequestNumberButton(true);
     view.setEnabledRequestConfirmTextView(false);
     view.setEnabledRequestConfirmButton(false);
-    showConfirmDialog(R.string.phone_identify_submit_message_fail, new ICustomDialogListener<AlertDialog>() {
+    showConfirmDialog(errorMessage, new ICustomDialogListener<AlertDialog>() {
       @Override
       public void onDialogResult(AlertDialog dialog, Event event) {
         if (event.getEventId() == Event.CONFIRM) {
@@ -687,12 +693,17 @@ public class MobileAuthPresenter implements IMobileAuthContract.Presenter {
 
   private void countRemainTime() {
     disposeRemainRendering();
+    int time = 180;
+    if (AppUtil.isDebug()) {
+      time = 10;
+    }
+    int finalTime = time;
     remainTimeDisposable =
       Observable.interval(0, 1000, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
-        .take(180 + 1)  // 3분
+        .take(finalTime + 1)  // 3분
         .subscribe(
           (Long tick) -> {
-            view.renderRemainTime(Formatter.format((180 - tick) * 1000, "mm:ss"));
+            view.renderRemainTime(Formatter.format((finalTime - tick) * 1000, "mm:ss"));
           }
           , Throwable::printStackTrace,
           () -> {