|
|
@@ -11,9 +11,12 @@ import java.util.ArrayList;
|
|
|
import kr.co.hanwha.hifive.BuildConfig;
|
|
|
import kr.co.hanwha.hifive.R;
|
|
|
import kr.co.hanwha.hifive.data.model.LoginData;
|
|
|
+import kr.co.hanwha.hifive.data.model.MaximData;
|
|
|
import kr.co.hanwha.hifive.data.model.NoticeData;
|
|
|
import kr.co.hanwha.hifive.data.model.NotificationData;
|
|
|
import kr.co.hanwha.hifive.data.model.UpdateData;
|
|
|
+import kr.co.hanwha.hifive.data.model.UpdateInfo;
|
|
|
+import kr.co.hanwha.hifive.data.source.MaximDataRepository;
|
|
|
import kr.co.hanwha.hifive.data.source.MemberDataRepository;
|
|
|
import kr.co.hanwha.hifive.dialog.HFDefaultDialog;
|
|
|
import kr.co.hanwha.hifive.dialog.HFPickerDialog;
|
|
|
@@ -78,48 +81,9 @@ public class IntroPresenter implements IntroContract.Presenter {
|
|
|
MemberDataRepository.setUpdateData(response);
|
|
|
|
|
|
if (HFCommonUtil.checkUpdate(getContext(), response) == false) {
|
|
|
- NoticeData notice = checkNotice(response);
|
|
|
- HFInfoUtil.setNoticeData(getContext(), notice);
|
|
|
-
|
|
|
- if (response != null && response.isSimpleLoginYn()) {
|
|
|
- mView.showSimpleLogin();
|
|
|
- } else {
|
|
|
- mView.showAccountLogin();
|
|
|
- }
|
|
|
+ showLoginView(response);
|
|
|
} else {
|
|
|
- String title = getContext().getString(R.string.app_name);
|
|
|
- String message = getContext().getString(R.string.alert_update_message);
|
|
|
- if (TextUtils.isEmpty(response.getUpdateInfo().getUpdate_notice()) == false)
|
|
|
- message = response.getUpdateInfo().getUpdate_notice();
|
|
|
- if (response.getUpdateInfo().isForced()) {//필수 업데이트
|
|
|
- mView.showAlert(title, message, new HFDefaultDialog.OnDialogCallback() {
|
|
|
- @Override
|
|
|
- public void onNegative() {
|
|
|
- getActivity().finish();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onPositive() {
|
|
|
- doUpdate(response);
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- mView.showAlert(title, message, new HFDefaultDialog.OnDialogCallback() {
|
|
|
- @Override
|
|
|
- public void onNegative() {
|
|
|
- if (response != null && response.isSimpleLoginYn()) {
|
|
|
- mView.showSimpleLogin();
|
|
|
- } else {
|
|
|
- mView.showAccountLogin();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void onPositive() {
|
|
|
- doUpdate(response);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ showUpdateAlert(response);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -145,6 +109,55 @@ public class IntroPresenter implements IntroContract.Presenter {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void showLoginView(@NonNull UpdateData response) {
|
|
|
+ NoticeData notice = checkNotice(response);
|
|
|
+ HFInfoUtil.setNoticeData(getContext(), notice);
|
|
|
+
|
|
|
+ if (response != null && response.isSimpleLoginYn()) {
|
|
|
+ mView.showSimpleLogin();
|
|
|
+ } else {
|
|
|
+ mView.showAccountLogin();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void showUpdateAlert(@NonNull final UpdateData response) {
|
|
|
+ String title = getContext().getString(R.string.app_name);
|
|
|
+ String message = getContext().getString(R.string.alert_update_message);
|
|
|
+ if (TextUtils.isEmpty(response.getUpdateInfo().getUpdate_notice()) == false)
|
|
|
+ message = response.getUpdateInfo().getUpdate_notice();
|
|
|
+ if (response.getUpdateInfo().isForced()) {//필수 업데이트
|
|
|
+ mView.showAlert(title, message, new HFDefaultDialog.OnDialogCallback() {
|
|
|
+ @Override
|
|
|
+ public void onNegative() {
|
|
|
+ getActivity().finish();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onPositive() {
|
|
|
+ doUpdate(response);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ mView.showAlert(title, message, new HFDefaultDialog.OnDialogCallback() {
|
|
|
+ @Override
|
|
|
+ public void onNegative() {
|
|
|
+ if (response != null && response.isSimpleLoginYn()) {
|
|
|
+ mView.showSimpleLogin();
|
|
|
+ } else {
|
|
|
+ mView.showAccountLogin();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onPositive() {
|
|
|
+ doUpdate(response);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public NoticeData checkNotice(@NonNull UpdateData updateData) {
|
|
|
NoticeData data = null;
|
|
|
@@ -185,11 +198,7 @@ public class IntroPresenter implements IntroContract.Presenter {
|
|
|
MemberDataRepository.getInstance().doSimpleLogin(getContext(), login_id, authcode, new HanwhaNetworkCallback() {
|
|
|
@Override
|
|
|
public void onSuccess(Object response) {
|
|
|
-
|
|
|
- HFActivityUtil.startRootActivity(getActivity(), false);//Root
|
|
|
-
|
|
|
- HFActivityUtil.startMainActivity(getActivity());
|
|
|
- getActivity().finish();
|
|
|
+ getMaximList(false);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -218,19 +227,11 @@ public class IntroPresenter implements IntroContract.Presenter {
|
|
|
HFInfoUtil.setMemberLoginId(getContext(), member_id);
|
|
|
HFInfoUtil.setLastMemberLoginId(getContext(), member_id);
|
|
|
|
|
|
- HFActivityUtil.startRootActivity(getActivity(), false);//Root
|
|
|
-
|
|
|
- if (response != null && response.isSimpleLoginYn() == false) {
|
|
|
- HFActivityUtil.startSetEasyLoginActivity(getActivity());
|
|
|
- } else {
|
|
|
- HFActivityUtil.startMainActivity(getActivity());
|
|
|
- }
|
|
|
- getActivity().finish();
|
|
|
+ getMaximList(response != null && response.isSimpleLoginYn() == false);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onFailure(HanwhaNetworkError error) {
|
|
|
-// mView.showAlert(error);
|
|
|
mView.showAlertAccountMessage(error.getMessage());
|
|
|
mView.showLoadingDialog(false);
|
|
|
}
|
|
|
@@ -247,6 +248,43 @@ public class IntroPresenter implements IntroContract.Presenter {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void getMaximList(@NonNull final boolean needSetSimpleLogin) {
|
|
|
+ MaximDataRepository.getInstance().requestMaximList(getContext(), new HanwhaNetworkCallback() {
|
|
|
+ @Override
|
|
|
+ public void onSuccess(Object response) {
|
|
|
+ startMain(needSetSimpleLogin);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onFailure(HanwhaNetworkError error) {
|
|
|
+ startMain(needSetSimpleLogin);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onPreExecute() {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onPostExecute() {
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void startMain(@NonNull final boolean needSetSimpleLogin) {
|
|
|
+ HFActivityUtil.startRootActivity(getActivity(), false);//Root
|
|
|
+
|
|
|
+ if (needSetSimpleLogin) {
|
|
|
+ HFActivityUtil.startSetEasyLoginActivity(getActivity());
|
|
|
+ } else {
|
|
|
+ HFActivityUtil.startMainActivity(getActivity());
|
|
|
+ }
|
|
|
+ getActivity().finish();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void doSignUp() {
|
|
|
HFActivityUtil.startSignupActivity(getActivity());
|