|
|
@@ -7,14 +7,14 @@ import android.content.Context;
|
|
|
import android.content.Intent;
|
|
|
import android.util.Log;
|
|
|
|
|
|
-import io.reactivex.android.schedulers.AndroidSchedulers;
|
|
|
import io.reactivex.disposables.Disposable;
|
|
|
-import io.reactivex.schedulers.Schedulers;
|
|
|
+import kr.co.zumo.app.lifeplus.bean.api.LoginResultBean;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.UserNoBean;
|
|
|
import kr.co.zumo.app.lifeplus.model.LifeplusPreferences;
|
|
|
import kr.co.zumo.app.lifeplus.model.SuperModel;
|
|
|
+import kr.co.zumo.app.lifeplus.model.module.APIMemberSelectModule;
|
|
|
+import kr.co.zumo.app.lifeplus.model.module.IAPIModuleListener;
|
|
|
import kr.co.zumo.app.lifeplus.model.module.LoginModuleParser;
|
|
|
-import kr.co.zumo.app.lifeplus.network.api.LifeplusAPIRepository;
|
|
|
import kr.co.zumo.app.lifeplus.util.StringUtil;
|
|
|
import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
import kr.co.zumo.app.lifeplus.view.dialog.ConfirmDialog;
|
|
|
@@ -51,20 +51,12 @@ public class ActivityStarter {
|
|
|
Log.i("APP# SplashActivity | onCreate", "| Network Connected ==============================================================> " + isConnected);
|
|
|
LifeplusPreferences preferences = SuperModel.getInstance().getPreferences();
|
|
|
|
|
|
+ String userId = SuperModel.getInstance().getUserId();
|
|
|
Intent intent = null;
|
|
|
if (isConnected == false) {
|
|
|
intent = new Intent(context, NetworkErrorActivity.class);
|
|
|
}
|
|
|
- else if (preferences.isPermissionInfoDone() == false) {
|
|
|
- intent = new Intent(context, PermissionInfoActivity.class);
|
|
|
- }
|
|
|
- else if (preferences.isTutorialDone() == false) {
|
|
|
- intent = new Intent(context, OnBoardingActivity.class);
|
|
|
- }
|
|
|
- else if (StringUtil.isEmpty(SuperModel.getInstance().getUserId())) {
|
|
|
- intent = new Intent(context, MainActivity.class);
|
|
|
- }
|
|
|
- else {
|
|
|
+ else if (StringUtil.isFull(userId)) {
|
|
|
/**
|
|
|
* 로그인
|
|
|
* 로그인 완료되면
|
|
|
@@ -76,24 +68,35 @@ public class ActivityStarter {
|
|
|
*
|
|
|
*/
|
|
|
|
|
|
- disposable = new LifeplusAPIRepository().selectMember(new UserNoBean(SuperModel.getInstance().getUserId()))
|
|
|
- .subscribeOn(Schedulers.io())
|
|
|
- .observeOn(AndroidSchedulers.mainThread())
|
|
|
- .subscribe(loginResultBean -> {
|
|
|
- Log.i("APP# ActivityStarter | launch", "| loginResultBean: " + loginResultBean.toPrettyJson());
|
|
|
- if (new LoginModuleParser().parse(loginResultBean)) {
|
|
|
+ disposable = new APIMemberSelectModule().call(new UserNoBean(userId), new IAPIModuleListener<LoginResultBean>() {
|
|
|
+ @Override
|
|
|
+ public void onApiResult(LoginResultBean resultBean) {
|
|
|
+ // 정상 처리 됐음
|
|
|
+ if (new LoginModuleParser().parse(resultBean)) {
|
|
|
// 정상 처리 됐음
|
|
|
onLogin();
|
|
|
}
|
|
|
else {
|
|
|
// 서버와 통신 완료 후 에러 리턴
|
|
|
- showErrorPopup("login error - " + loginResultBean.getReturnMessage());
|
|
|
+ showErrorPopup("login error - " + resultBean.getReturnMessage());
|
|
|
}
|
|
|
- }, e -> {
|
|
|
- // 서버와 통신이 되지 않은 에러
|
|
|
- showErrorPopup("login error - " + e.getLocalizedMessage());
|
|
|
- });
|
|
|
+ }
|
|
|
|
|
|
+ @Override
|
|
|
+ public void onApiError(String errorMessage) {
|
|
|
+ showErrorPopup("login error - " + errorMessage);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else if (preferences.isPermissionInfoDone() == false) {
|
|
|
+ intent = new Intent(context, PermissionInfoActivity.class);
|
|
|
+ }
|
|
|
+ else if (preferences.isTutorialDone() == false) {
|
|
|
+ intent = new Intent(context, OnBoardingActivity.class);
|
|
|
+ }
|
|
|
+ else if (StringUtil.isEmpty(userId)) {
|
|
|
+ // 비회원;
|
|
|
+ intent = new Intent(context, MainActivity.class);
|
|
|
}
|
|
|
|
|
|
if (null != intent) {
|