Commit 74f90cf9 by 刘鹏

fix: 登录注册页面,切换国家/区号后,手机号判定条件未更新问题修复

parent 63f87c2c
......@@ -14,7 +14,7 @@
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:name="com.ydl.ydlcommon.base.BaseApp"
android:name=".base.ComponentTestApp"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
......
package com.ydl.component.base;
import android.app.ActivityManager;
import android.content.Context;
import android.os.Build;
import android.os.Process;
import android.support.multidex.MultiDex;
import android.webkit.WebView;
import com.meituan.android.walle.WalleChannelReader;
import com.umeng.analytics.MobclickAgent;
import com.umeng.commonsdk.UMConfigure;
import com.umeng.socialize.PlatformConfig;
import com.umeng.socialize.UMShareAPI;
import com.ydl.component.route.PlatformTempCommonRouteImpl;
import com.ydl.confide.BuildConfig;
import com.ydl.ydl_image.manager.YDLImageCacheManager;
import com.ydl.ydlcommon.base.BaseApp;
import com.ydl.ydlcommon.router.YdlCommonRouterManager;
import com.ydl.ydlcommon.utils.AppProgressUtils;
import com.ydl.ydlcommon.utils.Utils;
import com.yidianling.common.tools.LogUtil;
import com.yidianling.course.lifeCallback.CoursePlayLifecycle;
/**
* @Author: 刘鹏
* @Description: 配置一些初始化数据,方便在组件中测试功能
* @CreateDate: 3/10/21 1:35 PM
* -------------------------------
* @UpdateUser:
* @UpdateDate: 3/10/21 1:35 PM
* @UpdateRemark:
* @Version:
*/
public class ComponentTestApp extends BaseApp {
private static ComponentTestApp mComponentTestAppContext;
@Override
public void onCreate() {
super.onCreate();
mComponentTestAppContext = this;
LogUtil.debug = BuildConfig.DEBUG;
com.ydl.ydlcommon.utils.LogUtil.debug = BuildConfig.DEBUG;
webviewSetPath(this);
if (!BuildConfig.DEBUG && Build.VERSION.SDK_INT == Build.VERSION_CODES.P) {//release包去除,debug包不去除,用于检测是否还有反射api的方法
//去掉在Android P上的提醒弹窗 Detected problems with API
Utils.closeAndroidPDialog();
}
//模块注册
moduleRegister();
//判断是否为主进程
//初始化umeng
initUmeng();
registerActivityLifecycleCallbacks(new CoursePlayLifecycle());
}
private void initUmeng() {
String channel = WalleChannelReader.getChannel(this);
if (channel == null || channel == "null") {
channel = "test";
}
//umeng
String umAppkey = "56970affe0f55a9cda001e24";
channel = "android_" + channel;
initUM(umAppkey, channel);
PlatformConfig.setWeixin("wx57a9d930270498c7", "17c031f02500ded3457a80e69d8e5e45");
PlatformConfig.setWXFileProvider("com.cxzapp.yidianling.fileprovider");
PlatformConfig.setQQZone("1105070461", "6BvkUnk6wXJekcgR");
PlatformConfig.setQQFileProvider("com.cxzapp.yidianling.fileprovider");
// 选用AUTO页面采集模式
MobclickAgent.setPageCollectionMode(MobclickAgent.PageMode.AUTO);
MobclickAgent.setCatchUncaughtExceptions(!BuildConfig.DEBUG);
//开启友盟集成测试
UMConfigure.setLogEnabled(BuildConfig.DEBUG);
}
public static ComponentTestApp getAppContext() {
return mComponentTestAppContext;
}
private void moduleRegister() {
YdlCommonRouterManager.INSTANCE.initYdlCommonRoute(new PlatformTempCommonRouteImpl());//
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
@Override
public void onTrimMemory(int level) {
super.onTrimMemory(level);
if (AppProgressUtils.isMainProcess(this)) {
YDLImageCacheManager.onTrimMemory(this, level);
}
}
@Override
public void onLowMemory() {
super.onLowMemory();
if (AppProgressUtils.isMainProcess(this)) {
YDLImageCacheManager.onLowMemory(this);
}
}
private void initUM(String umAppKey, String channel) {
/**
* 初始化common库
* 参数1:上下文,不能为空
* 参数2:友盟 app key
* 参数3:友盟 channel
* 参数4:设备类型,UMConfigure.DEVICE_TYPE_PHONE为手机、UMConfigure.DEVICE_TYPE_BOX为盒子,默认为手机
* 参数5:Push推送业务的secret
*/
UMConfigure.init(getApplicationContext(), umAppKey, channel, UMConfigure.DEVICE_TYPE_PHONE, null);
UMShareAPI.init(getApplicationContext(), umAppKey);
}
public void webviewSetPath(Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
String processName = getProcessName(context);
if (!"com.cxzapp.yidianling".equals(processName)) {//判断不等于默认进程名称
WebView.setDataDirectorySuffix(processName);
}
}
}
public String getProcessName(Context context) {
if (context == null) return null;
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses()) {
if (processInfo.pid == Process.myPid()) {
return processInfo.processName;
}
}
return null;
}
}
......@@ -20,8 +20,8 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST;
// public static String appEnv = YDLConstants.ENV_TEST;
public static String appEnv = YDLConstants.ENV_PROD;
public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_PROD;
@Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
......
......@@ -8,7 +8,7 @@ ext {
"m-confide" : "0.0.48.92",
"m-consultant" : "0.0.59.65",
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.09",
"m-user" : "0.0.61.11",
"m-home" : "0.0.22.53",
"m-im" : "0.0.18.35",
"m-dynamic" : "0.0.7.19",
......@@ -91,7 +91,7 @@ ext {
"m-confide" : "0.0.48.92",
"m-consultant" : "0.0.59.65",
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.09",
"m-user" : "0.0.61.11",
"m-home" : "0.0.22.54",
"m-im" : "0.0.18.34",
"m-dynamic" : "0.0.7.19",
......
......@@ -40,7 +40,6 @@ import com.yidianling.common.tools.RxKeyboardTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.LoginUtils
import com.yidianling.user.R
import com.yidianling.user.StatusUtils
import com.yidianling.user.UserHelper
import com.yidianling.user.UserHelper.isLogin
import com.yidianling.user.api.bean.UserResponseBean
......@@ -55,7 +54,6 @@ import com.yidianling.user.safePrivate.HandUnlockCheckActivity
import com.yidianling.user.ui.CountryListActivity
import com.yidianling.user.ui.login.contract.ILoginContract
import com.yidianling.user.ui.login.presenter.LoginPresenterImpl
import kotlinx.android.synthetic.main.user_activity_register_and_login_bottom.*
import kotlinx.android.synthetic.main.user_activity_register_and_login_new.*
......@@ -273,10 +271,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
if (isBindPhone) {
skip_bind.visibility = View.VISIBLE
// tv_des.text = "首次绑定即送大礼包"
// tv_des.visibility = View.GONE//"同意"
iv_select_protocol.visibility = View.GONE
// tv_des_first.visibility = View.VISIBLE//注释首次绑定就送100大红包
login_wechat.visibility = View.GONE
login_qq.visibility = View.GONE
tv_login_title.text = "手机号绑定"
......@@ -308,8 +303,6 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
if (isFromGuide) {
img_reg_back.visibility = View.INVISIBLE
img_reg_back.isEnabled = false
// skip_bind.visibility = View.VISIBLE
// tv_skip.text = "随便逛逛"
}
//根据来源不同为当前页面埋点
if (isFromGuide) {
......@@ -441,39 +434,40 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
iv_del.visibility = View.VISIBLE
iv_del.isEnabled = true
}
/*if (it.toString().length == 13 || (!splitCode?.equals("+86")!! && et_phone_number.text.toString().length > 0)) {
ll_next.isEnabled = true
ll_next.background = ContextCompat.getDrawable(this, R.drawable.bg_one_click_login)
} else {
ll_next.isEnabled = false
ll_next.background =
ContextCompat.getDrawable(this, R.drawable.login_password_unable_bg_24dp)
}*/
if (country_code.text.equals("+86")!! && it.toString().length == 13) {
updateLoginButtonStatus()
}
//删除按钮
iv_del.setOnClickListener {
et_phone_number.setText("")
}
}
/**
* 根据手机号码区域、和输入框内容,更新下一步登录按钮状态
* */
private fun updateLoginButtonStatus() {
if (country_code.text.equals("+86")) {
//国内号段
if (et_phone_number.text.toString().length == 13) {
//13位才能点击登录(手机号中间有两个空格)
ll_next.isEnabled = true
ll_next.background = ContextCompat.getDrawable(this, R.drawable.bg_one_click_login)
} else {
if (country_code.text.equals("+86")!!) {
ll_next.isEnabled = false
ll_next.background =
ContextCompat.getDrawable(this, R.drawable.login_password_unable_bg_24dp)
return@setListener
}
if (!country_code.text?.equals("+86")!! && it.toString().length > 0) {
} else {
//国外号段
if (et_phone_number.text.toString().isNotEmpty()) {
//有值就可点击登录
ll_next.isEnabled = true
ll_next.background =
ContextCompat.getDrawable(this, R.drawable.bg_one_click_login)
ll_next.background = ContextCompat.getDrawable(this, R.drawable.bg_one_click_login)
} else {
ll_next.isEnabled = false
ll_next.background =
ContextCompat.getDrawable(this, R.drawable.login_password_unable_bg_24dp)
}
}
}
//删除按钮
iv_del.setOnClickListener {
et_phone_number.setText("")
}
}
......@@ -539,20 +533,6 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
*/
override fun thirdLoginSuccess(userInfo: UserResponseBean.UserInfo) {
if (userInfo.bind_phone != 1) {
// countryCode = userInfo.country_code
// isBindPhone = true
// skip_bind.visibility = View.VISIBLE
//// tv_des.text = "首次绑定即送大礼包"
//// tv_des.visibility = View.GONE
// iv_select_protocol.visibility = View.GONE
//// tv_des_first.visibility = View.VISIBLE
// bind_phone_hint.visibility = View.VISIBLE
// login_wechat.visibility = View.GONE
// login_qq.visibility = View.GONE
// tv_login_title.text = "绑定手机号"
// tv_protocol.visibility = View.GONE
// other_login_style.visibility = View.GONE
// country_code.text = "+86"
BindPhoneActivity.startActivity(this)
finish()
} else {
......@@ -561,9 +541,9 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
LoginUtils.loginSuccessOperate(this)
}
isFromOneKeyLogin -> {
if (OneKeyLoginHelp.mIsFromGuide){
if (OneKeyLoginHelp.mIsFromGuide) {
LoginUtils.loginSuccessOperate(this)
}else{
} else {
OneKeyLoginHelp.quitLoginPage()
finish()
}
......@@ -677,9 +657,9 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
LoginUtils.loginSuccessOperate(this)
}
isFromOneKeyLogin -> {
if (OneKeyLoginHelp.mIsFromGuide){
if (OneKeyLoginHelp.mIsFromGuide) {
LoginUtils.loginSuccessOperate(this)
}else{
} else {
OneKeyLoginHelp.quitLoginPage()
finish()
}
......@@ -712,18 +692,18 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
// 如果已经登录
if (isLogin()) {
OneKeyLoginHelp.quitLoginPage()
if (OneKeyLoginHelp.mIsFromGuide){
if (OneKeyLoginHelp.mIsFromGuide) {
ActivityManager.finishOtherActivity(this)
UserIn.mainIntent(this, 4)
finish()
}else{
} else {
super.onBackPressed()
}
} else {
OneKeyLoginHelp.checkEnvAvailable(PhoneNumberAuthHelper.SERVICE_TYPE_LOGIN)
super.onBackPressed()
}
}else{
} else {
super.onBackPressed()
}
}
......@@ -762,6 +742,8 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
setCountryIcon(countryCode)
country_code.text = "+" + countryCode?.replace("00", "")
updateLoginButtonStatus()
}
}
......@@ -771,19 +753,6 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
private fun setCountryIcon(code: String?) {
country_code.text = "+" + countryCode?.replace("00", "")
val splitCode = countryCode?.replace("00", "")
/* when (code) {
"0086" -> iv_country_icon.setImageResource(R.drawable.user_ic_china)
"001" -> iv_country_icon.setImageResource(R.drawable.user_country_usa)
"00886" -> iv_country_icon.setImageResource(R.drawable.user_ic_china)
"0081" -> iv_country_icon.setImageResource(R.drawable.user_country_japan)
"00852" -> iv_country_icon.setImageResource(R.drawable.user_country_hk)
"0061" -> iv_country_icon.setImageResource(R.drawable.user_country_australia)
"0064" -> iv_country_icon.setImageResource(R.drawable.user_country_nz)
"0082" -> iv_country_icon.setImageResource(R.drawable.user_country_sk)
"0060" -> iv_country_icon.setImageResource(R.drawable.user_country_malaysia)
"0044" -> iv_country_icon.setImageResource(R.drawable.user_country_uk)
else -> iv_country_icon.visibility = View.VISIBLE
}*/
}
override fun onDestroy() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment