|
|
@@ -5,6 +5,8 @@ package kr.co.zumo.app.lifeplus.view.screen.setting.code;
|
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
+
|
|
|
import kr.co.zumo.app.R;
|
|
|
import kr.co.zumo.app.lifeplus.model.verify.Verifier;
|
|
|
import kr.co.zumo.app.lifeplus.supervisor.ScreenID;
|
|
|
@@ -105,7 +107,6 @@ public class SettingCodePresenter extends Presenter<SettingCodeModel, ISettingCo
|
|
|
Log.i("APP# ContentsBasePresenter | onResult", "|" + " current coin: " + e.getInteger());
|
|
|
showCoin();
|
|
|
});
|
|
|
- onBackPressed();
|
|
|
}
|
|
|
else if (resultIndex == Event.CODE_INVALID_SPECIAL_CODE) {
|
|
|
onInvalidCode(Event.CODE_INVALID_SPECIAL_CODE);
|
|
|
@@ -125,6 +126,10 @@ public class SettingCodePresenter extends Presenter<SettingCodeModel, ISettingCo
|
|
|
|
|
|
private void showCoin() {
|
|
|
boolean[] codeResult = model.getCodeResult();
|
|
|
+ int currentCoin = Integer.parseInt(model.getCoin());
|
|
|
+ int givenCoin = model.getGivenCoin();
|
|
|
+
|
|
|
+ Log.i("APP# SettingCodePresenter | showCoin", "|" + Arrays.toString(codeResult));
|
|
|
|
|
|
// 스페셜 코드우선 표시
|
|
|
if (codeResult[SettingCodeModel.CODE_SPECIAL_RESULT_INDEX]) {
|
|
|
@@ -132,23 +137,28 @@ public class SettingCodePresenter extends Presenter<SettingCodeModel, ISettingCo
|
|
|
new CoinPopupDriver(getFragmentManager(), evt -> {
|
|
|
// 완료 뒤 추천 코드 있으면 표시
|
|
|
if (codeResult[SettingCodeModel.CODE_RECOMMEND_RESULT_INDEX]) {
|
|
|
- new CoinPopupDriver(getFragmentManager(), evt2 -> {
|
|
|
- // nothing
|
|
|
- }).show(Integer.parseInt(model.getCoin()), model.getGivenCoin(), R.string.coin_recommend_code_completed);
|
|
|
+ showRecommendCoin(currentCoin, givenCoin);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ onBackPressed();
|
|
|
}
|
|
|
}).show(Integer.parseInt(model.getCoin()), model.getGivenCoin(), R.string.coin_special_code_completed);
|
|
|
|
|
|
}
|
|
|
else if (codeResult[SettingCodeModel.CODE_RECOMMEND_RESULT_INDEX]) {
|
|
|
// 추천 코드 있으면 표시
|
|
|
- new CoinPopupDriver(getFragmentManager(), evt -> {
|
|
|
- // nothing
|
|
|
- }).show(Integer.parseInt(model.getCoin()), model.getGivenCoin(), R.string.coin_recommend_code_completed);
|
|
|
+ showRecommendCoin(currentCoin, givenCoin);
|
|
|
}
|
|
|
|
|
|
model.mergeCoin();
|
|
|
}
|
|
|
|
|
|
+ private void showRecommendCoin(int currentCoin, int givenCoin) {
|
|
|
+ new CoinPopupDriver(getFragmentManager(), evt2 -> {
|
|
|
+ onBackPressed();
|
|
|
+ }).show(currentCoin, givenCoin, R.string.coin_recommend_code_completed);
|
|
|
+ }
|
|
|
+
|
|
|
private void onInvalidCode(int resultIndex) {
|
|
|
if (resultIndex == Event.CODE_INVALID_SPECIAL_CODE) {
|
|
|
view.setValidationSpecialCode(ResourceUtil.getString(R.string.special_code_error));
|
|
|
@@ -231,7 +241,7 @@ public class SettingCodePresenter extends Presenter<SettingCodeModel, ISettingCo
|
|
|
boolean hasSpecialCode = verifySpecialCode(false);
|
|
|
boolean hasRecommendCode = verifyRecommendCode(false);
|
|
|
// 스페셜 코드 검증은 '등록' 버튼을 누를 때만 한다.
|
|
|
- if (hasSpecialCode || hasRecommendCode) {
|
|
|
+ if (hasSpecialCode || hasRecommendCode || model.isRegistered() == false) {
|
|
|
view.setRegisteringButtonEnabled(true);
|
|
|
}
|
|
|
else {
|