| | |
| | | import com.dayu.pipirrapp.net.subscribers.SubscriberListener; |
| | | import com.dayu.pipirrapp.observer.LoginObserver; |
| | | import com.dayu.pipirrapp.utils.CommonData; |
| | | import com.dayu.pipirrapp.utils.CommonKeyName; |
| | | import com.dayu.pipirrapp.utils.SharedPreferencesHelper; |
| | | import com.dayu.pipirrapp.utils.ToastUtil; |
| | | import com.tencent.bugly.crashreport.CrashReport; |
| | |
| | | clickNumber = 0; |
| | | } |
| | | }); |
| | | if (SharedPreferencesHelper.getInstance(LoginActivity.this).get(CommonData.isShowCode, false)) { |
| | | if (SharedPreferencesHelper.getInstance(LoginActivity.this).get(CommonKeyName.isShowCode, false)) { |
| | | isShowCode = true; |
| | | binding.codeLL.setVisibility(View.VISIBLE); |
| | | getCode(); |
| | |
| | | public void onNext(BaseResponse<LoginResult> t) { |
| | | try { |
| | | if (t.isSuccess()) { |
| | | SharedPreferencesHelper.getInstance(LoginActivity.this).put(CommonData.Token, t.getContent().getToken()); |
| | | SharedPreferencesHelper.getInstance(LoginActivity.this).put(CommonKeyName.Token, t.getContent().getToken()); |
| | | MyApplication.myApplication.token = t.getContent().getToken(); |
| | | LoginBean loginBean = DaoSingleton.getInstance(LoginActivity.this).loginDao().findFirst(); |
| | | if (loginBean == null) { |
| | |
| | | loginBean.setName(t.getContent().getName()); |
| | | loginBean.setPhone(t.getContent().getPhone()); |
| | | DaoSingleton.getInstance(LoginActivity.this).loginDao().insert(loginBean); |
| | | SharedPreferencesHelper.getInstance(LoginActivity.this).put(CommonData.isShowCode, false); |
| | | SharedPreferencesHelper.getInstance(LoginActivity.this).put(CommonKeyName.isShowCode, false); |
| | | startMainActivity(); |
| | | } else { |
| | | ToastUtil.showToast(LoginActivity.this, t.getMsg()); |
| | | loginError++; |
| | | if (loginError >= 3) { |
| | | isShowCode = true; |
| | | SharedPreferencesHelper.getInstance(LoginActivity.this).put(CommonData.isShowCode, true); |
| | | SharedPreferencesHelper.getInstance(LoginActivity.this).put(CommonKeyName.isShowCode, true); |
| | | binding.codeLL.setVisibility(View.VISIBLE); |
| | | } |
| | | } |