|
|
@@ -11,6 +11,7 @@ import kr.co.zumo.app.lifeplus.model.SignUpModel;
|
|
|
import kr.co.zumo.app.lifeplus.supervisor.ScreenID;
|
|
|
import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
import kr.co.zumo.app.lifeplus.view.command.FragmentChangeCommand;
|
|
|
+import kr.co.zumo.app.lifeplus.view.dialog.AlertDialog;
|
|
|
import kr.co.zumo.app.lifeplus.view.dialog.DialogBase;
|
|
|
import kr.co.zumo.app.lifeplus.view.dialog.DialogBuilder;
|
|
|
import kr.co.zumo.app.lifeplus.view.dialog.DialogID;
|
|
|
@@ -35,6 +36,7 @@ public class SignUpAgreePresenter extends Presenter<SignUpModel, ISignUpAgreeVie
|
|
|
protected boolean isLoaded = false;
|
|
|
protected boolean isSaved = false;
|
|
|
protected boolean isViewReady = false;
|
|
|
+ DialogBase alertDialog;
|
|
|
|
|
|
public SignUpAgreePresenter(SignUpModel model, ISignUpAgreeView view) {
|
|
|
super(model, view);
|
|
|
@@ -65,6 +67,11 @@ public class SignUpAgreePresenter extends Presenter<SignUpModel, ISignUpAgreeVie
|
|
|
@Override
|
|
|
protected void destroyInternal() {
|
|
|
model.stopPolicyRequest();
|
|
|
+
|
|
|
+ if (null != alertDialog) {
|
|
|
+ alertDialog.dispose();
|
|
|
+ alertDialog = null;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -86,12 +93,14 @@ public class SignUpAgreePresenter extends Presenter<SignUpModel, ISignUpAgreeVie
|
|
|
}
|
|
|
break;
|
|
|
case Event.ERROR:
|
|
|
- // todo error
|
|
|
if (event.getInteger() == SignUpModel.EVENT_POLICY_REQUEST) {
|
|
|
+ showErrorPopup(event.getString());
|
|
|
}
|
|
|
else if (event.getInteger() == SignUpModel.EVENT_POLICY_CONFIRM) {
|
|
|
+ showErrorPopup(event.getString());
|
|
|
}
|
|
|
else if (event.getInteger() == SignUpModel.EVENT_JOINED) {
|
|
|
+ showErrorPopup(event.getString());
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
@@ -99,6 +108,26 @@ public class SignUpAgreePresenter extends Presenter<SignUpModel, ISignUpAgreeVie
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void showErrorPopup(String errorMessage) {
|
|
|
+
|
|
|
+ alertDialog = DialogBuilder.create(DialogID.ALERT)
|
|
|
+ .listener(new IDialogResultListener() {
|
|
|
+ @Override
|
|
|
+ public void onDialogResult(DialogBase dialog, Event event) {
|
|
|
+ if (event.getEventId() == Event.CONFIRM) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onDialogCanceled(DialogBase dialog) {
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .attribute((IAttribute<AlertDialog>) dialog -> {
|
|
|
+ dialog.setText(errorMessage);
|
|
|
+ })
|
|
|
+ .show();
|
|
|
+ }
|
|
|
+
|
|
|
private void renderAfterReady() {
|
|
|
if (isLoaded && isViewReady) {
|
|
|
view.init(getAgreeItems());
|