登录发生IOException相关异常错误提示修改

This commit is contained in:
huangjian
2022-04-19 15:22:08 +08:00
parent f09a8dccb0
commit c4c97f2d0e
4 changed files with 23 additions and 13 deletions

View File

@@ -37,6 +37,7 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
@@ -52,12 +53,12 @@ import io.reactivex.functions.Action;
*/
public class BindCodeActivity extends BaseLoginAct {
private static final String TYPE_SMS = "1";
private CodeEditText codeEt;
private TextView tvGetCode, tvDesc, tvSecond;
private String mPhone;
private boolean isSuperAdmin = false;
private CodeDownDescTimer timer;
private static final String TYPE_SMS = "1";
public static void start(Context context, String phone) {
Intent intent = new Intent(context, BindCodeActivity.class);
@@ -207,6 +208,8 @@ public class BindCodeActivity extends BaseLoginAct {
isSuperAdmin = false;
ShowPhoneCodeException showPhoneCodeException = (ShowPhoneCodeException) e;
toast(e.getMessage());
} else if (e instanceof IOException) {
toast("网络异常,请检查您的网络再试~");
} else {
isSuperAdmin = false;
toast(e.getMessage());

View File

@@ -38,6 +38,7 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
@@ -53,14 +54,12 @@ import io.reactivex.disposables.Disposable;
public class LoginCodeActivity extends BaseLoginAct {
private static final String TAG = "LoginVertificationActivity";
private static final String TYPE_SMS = "1";
private CodeEditText codeEt;
private TextView tvGetCode, tvDesc, tvSecond;
private String mPhone;
private boolean isSuperAdmin = false;
private CodeDownDescTimer timer;
private static final String TYPE_SMS = "1";
public static void start(Context context, String phone) {
Intent intent = new Intent(context, LoginCodeActivity.class);
@@ -153,7 +152,7 @@ public class LoginCodeActivity extends BaseLoginAct {
*/
@SuppressLint("CheckResult")
private void getSmsCode() {
if (TextUtils.isEmpty(mPhone) ||mPhone.length() != 11) {
if (TextUtils.isEmpty(mPhone) || mPhone.length() != 11) {
return;
}
AuthModel.get()
@@ -259,6 +258,8 @@ public class LoginCodeActivity extends BaseLoginAct {
isSuperAdmin = false;
ShowPhoneCodeException showPhoneCodeException = (ShowPhoneCodeException) e;
toast(e.getMessage());
} else if (e instanceof IOException) {
toast("网络异常,请检查您的网络再试~");
} else {
isSuperAdmin = false;
toast(e.getMessage());

View File

@@ -17,6 +17,7 @@ import androidx.core.content.ContextCompat;
import com.yizhuan.erban.R;
import com.yizhuan.erban.base.BaseLoginAct;
import com.yizhuan.erban.common.widget.dialog.DialogManager;
import com.yizhuan.erban.quick_pass.QuickPassLoginAct;
import com.yizhuan.erban.ui.setting.ResetPasswordActivity;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.auth.event.LoginEvent;
@@ -31,6 +32,7 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
@@ -45,12 +47,6 @@ public class LoginPasswordActivity extends BaseLoginAct {
private View btnNext;
private EditText edtPhone;
private EditText edtPassword;
public static void start(Context context) {
Intent intent = new Intent(context, LoginPasswordActivity.class);
context.startActivity(intent);
}
private final TextWatcher textWatcher = new TextWatcherWrapper() {
@Override
public void afterTextChanged(Editable s) {
@@ -58,6 +54,11 @@ public class LoginPasswordActivity extends BaseLoginAct {
}
};
public static void start(Context context) {
Intent intent = new Intent(context, LoginPasswordActivity.class);
context.startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -82,7 +83,7 @@ public class LoginPasswordActivity extends BaseLoginAct {
btnNext.setOnClickListener(v -> login());
findViewById(R.id.iv_back).setOnClickListener(v -> finish());
findViewById(R.id.tv_code_login).setOnClickListener(v -> finish());
findViewById(R.id.tv_forget_password).setOnClickListener(v -> ResetPasswordActivity.start(context,ResetPasswordActivity.FROM_NOT_LOGIN));
findViewById(R.id.tv_forget_password).setOnClickListener(v -> ResetPasswordActivity.start(context, ResetPasswordActivity.FROM_NOT_LOGIN));
}
@Override
@@ -157,6 +158,8 @@ public class LoginPasswordActivity extends BaseLoginAct {
0, end, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
getDialogManager().showOkWithTitleDialog("该账号已注销",
spannableString, "我知道了", true, null);
} else if (e instanceof IOException) {
toast("网络异常,请检查您的网络再试~");
} else {
toast(e.getMessage());
}

View File

@@ -35,6 +35,7 @@ import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
@@ -259,10 +260,12 @@ public class QuickPassLoginAct extends BaseLoginAct implements View.OnClickListe
0, end, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
getDialogManager().showOkWithTitleDialog("该账号已注销",
spannableString, "我知道了", true, null);
} else if (e instanceof IOException) {
toast("网络异常,请检查您的网络再试~");
LoginPhoneActivity.startForResult(QuickPassLoginAct.this, quickPassRequestCode);
} else {
toast(e.getMessage());
LoginPhoneActivity.startForResult(QuickPassLoginAct.this, quickPassRequestCode);
}
}