|
|
@@ -5,16 +5,9 @@ package kr.co.zumo.app.lifeplus.view.presenter;
|
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
|
-import java.io.EOFException;
|
|
|
-import java.net.SocketTimeoutException;
|
|
|
-
|
|
|
-import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
import io.reactivex.disposables.Disposable;
|
|
|
import kr.co.zumo.app.lifeplus.model.PinModel;
|
|
|
-import kr.co.zumo.app.lifeplus.model.SuperModel;
|
|
|
import kr.co.zumo.app.lifeplus.supervisor.ScreenID;
|
|
|
-import kr.co.zumo.app.lifeplus.util.AppUtil;
|
|
|
-import kr.co.zumo.app.lifeplus.util.StringUtil;
|
|
|
import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
import kr.co.zumo.app.lifeplus.view.IPinView;
|
|
|
import kr.co.zumo.app.lifeplus.view.command.ActivityChangeCommand;
|
|
|
@@ -79,36 +72,51 @@ public class PinPresenter extends Presenter<PinModel, IPinView> {
|
|
|
public void verifyPin(String pin) {
|
|
|
|
|
|
view.setDisabledPinDialog();
|
|
|
- disposable = model.verifyPin(SuperModel.getInstance().getUuid(), pin)
|
|
|
- .observeOn(AndroidSchedulers.mainThread())
|
|
|
- .subscribe(bean -> {
|
|
|
-
|
|
|
- Log.i("APP# PinPresenter | verifyPin", "|" + bean.toPrettyJson());
|
|
|
-
|
|
|
- // todo 검증 학인 로직 필요
|
|
|
- if (StringUtil.isFull(bean.getReturnMessage())) {
|
|
|
- // 검증 완료
|
|
|
- view.dismissPinDialog();
|
|
|
- onCommand(new ActivityChangeCommand(ScreenID.ACTIVITY_MAIN, ScreenID.DIRECTION_NEXT));
|
|
|
- }
|
|
|
- else {
|
|
|
- // 검증 실패, 재입력
|
|
|
- countTrying(model, view);
|
|
|
- }
|
|
|
- }, e -> {
|
|
|
- Log.e("APP# PinPresenter | verifyPin", "|" + e.getLocalizedMessage());
|
|
|
-
|
|
|
- if (e instanceof EOFException) {
|
|
|
- Log.e("APP# PinPresenter | verifyPin", "| EOFException-- " + e.getLocalizedMessage());
|
|
|
- }
|
|
|
- else if (e instanceof SocketTimeoutException) {
|
|
|
- Log.e("APP# PinPresenter | verifyPin", "| SocketTimeoutException-- " + e.getLocalizedMessage());
|
|
|
- }
|
|
|
-
|
|
|
- // fixme 에러 종류에 따라서 처리 필요
|
|
|
- // 통신 오류, 파싱 오류 등
|
|
|
- countTrying(model, view);
|
|
|
- });
|
|
|
+ boolean result = model.verifyPin(pin);
|
|
|
+
|
|
|
+ if (result) {
|
|
|
+ // 검증 완료
|
|
|
+ view.dismissPinDialog();
|
|
|
+ onCommand(new ActivityChangeCommand(ScreenID.ACTIVITY_MAIN, ScreenID.DIRECTION_NEXT));
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // 검증 실패, 재입력
|
|
|
+ countTrying(model, view);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// disposable = model.verifyPin(SuperModel.getInstance().getUuid(), pin)
|
|
|
+// .observeOn(AndroidSchedulers.mainThread())
|
|
|
+// .subscribe(bean -> {
|
|
|
+//
|
|
|
+// Log.i("APP# PinPresenter | verifyPin", "|" + bean.toPrettyJson());
|
|
|
+//
|
|
|
+// // todo 검증 학인 로직 필요
|
|
|
+// if (StringUtil.isFull(bean.getReturnMessage())) {
|
|
|
+// // 검증 완료
|
|
|
+// view.dismissPinDialog();
|
|
|
+// onCommand(new ActivityChangeCommand(ScreenID.ACTIVITY_MAIN, ScreenID.DIRECTION_NEXT));
|
|
|
+// }
|
|
|
+// else {
|
|
|
+// // 검증 실패, 재입력
|
|
|
+// countTrying(model, view);
|
|
|
+// }
|
|
|
+// }, e -> {
|
|
|
+// Log.e("APP# PinPresenter | verifyPin", "|" + e.getLocalizedMessage());
|
|
|
+//
|
|
|
+// if (e instanceof EOFException) {
|
|
|
+// Log.e("APP# PinPresenter | verifyPin", "| EOFException-- " + e.getLocalizedMessage());
|
|
|
+// }
|
|
|
+// else if (e instanceof SocketTimeoutException) {
|
|
|
+// Log.e("APP# PinPresenter | verifyPin", "| SocketTimeoutException-- " + e.getLocalizedMessage());
|
|
|
+// }
|
|
|
+//
|
|
|
+// // fixme 에러 종류에 따라서 처리 필요
|
|
|
+// // 통신 오류, 파싱 오류 등
|
|
|
+// countTrying(model, view);
|
|
|
+// });
|
|
|
}
|
|
|
|
|
|
private void countTrying(PinModel model, IPinView view) {
|
|
|
@@ -116,10 +124,6 @@ public class PinPresenter extends Presenter<PinModel, IPinView> {
|
|
|
final int count = model.getCount();
|
|
|
int maxCount = model.getMaxTrying();
|
|
|
|
|
|
- if (AppUtil.isDebug()) {
|
|
|
- maxCount = 2;
|
|
|
- }
|
|
|
-
|
|
|
Log.i("APP# PinPresenter | count", "| current: " + model.getCount() + ", Max: " + maxCount);
|
|
|
|
|
|
if (count < maxCount) {
|