Commit 027b183d by YKai

feat:一键登录代码优化,登录界面号码验证

parent 6ff932cd
...@@ -12,6 +12,7 @@ import android.provider.Settings ...@@ -12,6 +12,7 @@ import android.provider.Settings
import android.util.Log import android.util.Log
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.launcher.ARouter import com.alibaba.android.arouter.launcher.ARouter
import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper
import com.tbruyelle.rxpermissions2.RxPermissions import com.tbruyelle.rxpermissions2.RxPermissions
import com.umeng.analytics.MobclickAgent import com.umeng.analytics.MobclickAgent
import com.ydl.component.music.FragmentContainerActivity import com.ydl.component.music.FragmentContainerActivity
...@@ -74,7 +75,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -74,7 +75,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
YdlCommonRouterManager.initYdlCommonRoute(PlatformTempCommonRouteImpl()) YdlCommonRouterManager.initYdlCommonRoute(PlatformTempCommonRouteImpl())
// 初始化一键登录sdk // 初始化一键登录sdk
OneKeyLoginHelp.sdkInit(this, OneKeyLoginHelp.YDL_USER_APP, OneKeyLoginHelp.ONE_KEY_LOGIN) OneKeyLoginHelp.sdkInit(this, OneKeyLoginHelp.YDL_USER_APP, PhoneNumberAuthHelper.SERVICE_TYPE_LOGIN)
bindService() bindService()
reLoadData() reLoadData()
...@@ -92,9 +93,6 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -92,9 +93,6 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
// .withBoolean("bind_phone", false) // .withBoolean("bind_phone", false)
// .withBoolean("isFromGuide", true) // .withBoolean("isFromGuide", true)
// .navigation() // .navigation()
if (!OneKeyLoginHelp.mIsGetTokenSuccess) {
OneKeyLoginHelp.setAuthListener()
}
OneKeyLoginHelp.getLoginToken(false) OneKeyLoginHelp.getLoginToken(false)
} }
bt_to_consultant.setOnClickListener { bt_to_consultant.setOnClickListener {
......
...@@ -23,6 +23,9 @@ object UserHelper { ...@@ -23,6 +23,9 @@ object UserHelper {
private val user_setting_name_sp = "ydl_user_setting" private val user_setting_name_sp = "ydl_user_setting"
private val user_setting_key_sp = "ydl_user_setting_key" private val user_setting_key_sp = "ydl_user_setting_key"
// 存储用户的手机号
public const val USER_PHONE = "user_phone"
//用户信息//缓存 //用户信息//缓存
private var userTemp: UserResponseBean? = null private var userTemp: UserResponseBean? = null
...@@ -35,6 +38,8 @@ object UserHelper { ...@@ -35,6 +38,8 @@ object UserHelper {
userTemp = userInfo userTemp = userInfo
var str = gson.toJson(userTemp) var str = gson.toJson(userTemp)
SharedPreferencesEditor.putFileString(user_info_name_sp, user_info_key_sp, str) SharedPreferencesEditor.putFileString(user_info_name_sp, user_info_key_sp, str)
// 存储登录所使用的手机号
SharedPreferencesEditor.putString(USER_PHONE,userInfo?.userInfo?.phone)
UserInfoCache.getInstance().saveYDLUser("\"" + userInfo?.uid + "\"", UserInfoCache.getInstance().saveYDLUser("\"" + userInfo?.uid + "\"",
userInfo?.userInfo?.nick_name, userInfo?.userInfo?.head) userInfo?.userInfo?.nick_name, userInfo?.userInfo?.head)
......
...@@ -360,9 +360,6 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR ...@@ -360,9 +360,6 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
*/ */
private void startLogin(){ private void startLogin(){
if (OneKeyLoginHelp.INSTANCE.getMIsOpenOneKeyLogin()) { if (OneKeyLoginHelp.INSTANCE.getMIsOpenOneKeyLogin()) {
if (!OneKeyLoginHelp.INSTANCE.getMIsGetTokenSuccess()) {
OneKeyLoginHelp.INSTANCE.setAuthListener();
}
OneKeyLoginHelp.INSTANCE.getLoginToken(true); OneKeyLoginHelp.INSTANCE.getLoginToken(true);
}else { }else {
RegisterAndLoginActivity.Companion.start(getActivity()); RegisterAndLoginActivity.Companion.start(getActivity());
......
...@@ -30,14 +30,12 @@ object OneKeyLoginHelp { ...@@ -30,14 +30,12 @@ object OneKeyLoginHelp {
"i4Y/PVRAz4P/aqajQF7SOd3JUIKEsJbRurH04azLyX6N2upi292OrLHECRmtTVAqY24HFjwUjW1QjRwJA9aFbNzl3zl7L5DEDBZ4+QSU28vq34HccmAjAeUCC7qCHbN7QLVZqhVpuYUCMZ5fp2NdhANJl/741wHccdPk/Un5c4larDNuv1KEo2OZOds2J1WFiBx7giWtzli4NwMq9x+9sb0aXPZZQ9C9Kr8T/0+/ccYdotwFm7XWenNs/G3Jy1HHVqqOCDecKPbyXR+cV0jBUisSjv+SEUTfpcc3iUGH5OjZyQ6OfaLkdjATsr5K9oVP" "i4Y/PVRAz4P/aqajQF7SOd3JUIKEsJbRurH04azLyX6N2upi292OrLHECRmtTVAqY24HFjwUjW1QjRwJA9aFbNzl3zl7L5DEDBZ4+QSU28vq34HccmAjAeUCC7qCHbN7QLVZqhVpuYUCMZ5fp2NdhANJl/741wHccdPk/Un5c4larDNuv1KEo2OZOds2J1WFiBx7giWtzli4NwMq9x+9sb0aXPZZQ9C9Kr8T/0+/ccYdotwFm7XWenNs/G3Jy1HHVqqOCDecKPbyXR+cV0jBUisSjv+SEUTfpcc3iUGH5OjZyQ6OfaLkdjATsr5K9oVP"
const val YDL_USER_APP = 1 const val YDL_USER_APP = 1
const val YDL_EXPERT_APP = 2 const val YDL_EXPERT_APP = 2
const val PHONE_CHECK = 1 // 本机号码验证
const val ONE_KEY_LOGIN = 2 // 一键登录
var mPhoneNumberAuthHelper: PhoneNumberAuthHelper? = null var mPhoneNumberAuthHelper: PhoneNumberAuthHelper? = null
private var mAppType: Int = YDL_USER_APP private var mAppType: Int = YDL_USER_APP
var mIsGetTokenSuccess = true // 获取token是否成功,默认是成功 var mIsGetTokenSuccess = true // 获取token是否成功,默认是成功
var mIsOpenOneKeyLogin = false // 是否开启一键登录 var mIsOpenOneKeyLogin = false // 是否开启一键登录
var mIsFromGuide = true var mIsFromGuide = true
var mAuthType = ONE_KEY_LOGIN // 1:本机号码校验 2: ⼀键登录 var mAuthType = PhoneNumberAuthHelper.SERVICE_TYPE_LOGIN // 1:本机号码校验 2: ⼀键登录
private lateinit var mActivity: BaseActivity private lateinit var mActivity: BaseActivity
...@@ -55,17 +53,27 @@ object OneKeyLoginHelp { ...@@ -55,17 +53,27 @@ object OneKeyLoginHelp {
} else if (appType == YDL_EXPERT_APP) { } else if (appType == YDL_EXPERT_APP) {
it.setAuthSDKInfo(YDL_EXPERT_APP_KEY) it.setAuthSDKInfo(YDL_EXPERT_APP_KEY)
} }
// 检查认证环境
// it.checkEnvAvailable(authType) // type 1:本机号码校验 2: ⼀键登录
} }
} }
/**
* 检查认证环境
*
*/
fun checkEnvAvailable(authType: Int) {
mAuthType = authType
if (!mIsGetTokenSuccess) {
setAuthListener()
}
mPhoneNumberAuthHelper?.checkEnvAvailable(authType) // type 1:本机号码校验 2: ⼀键登录
}
/** /**
* 设置token监听 * 设置token监听
* *
*/ */
fun setAuthListener() { private fun setAuthListener() {
mPhoneNumberAuthHelper?.setAuthListener(mTokenListener) mPhoneNumberAuthHelper?.setAuthListener(mTokenListener)
} }
...@@ -86,7 +94,10 @@ object OneKeyLoginHelp { ...@@ -86,7 +94,10 @@ object OneKeyLoginHelp {
* *
*/ */
fun getVerifyToken() { fun getVerifyToken() {
mAuthType = PHONE_CHECK mAuthType = PhoneNumberAuthHelper.SERVICE_TYPE_AUTH
if (!mIsGetTokenSuccess) {
setAuthListener()
}
mPhoneNumberAuthHelper?.getVerifyToken(5000) // 5000表示超时时间 单位ms mPhoneNumberAuthHelper?.getVerifyToken(5000) // 5000表示超时时间 单位ms
} }
...@@ -97,8 +108,11 @@ object OneKeyLoginHelp { ...@@ -97,8 +108,11 @@ object OneKeyLoginHelp {
*/ */
fun getLoginToken(isOpenDialog: Boolean) { fun getLoginToken(isOpenDialog: Boolean) {
mIsFromGuide = isOpenDialog mIsFromGuide = isOpenDialog
mAuthType = ONE_KEY_LOGIN mAuthType = PhoneNumberAuthHelper.SERVICE_TYPE_LOGIN
mPhoneNumberAuthHelper?.let { mPhoneNumberAuthHelper?.let {
if (!mIsGetTokenSuccess) {
setAuthListener()
}
// 打开页面 // 打开页面
if (isOpenDialog) { if (isOpenDialog) {
openDialog(it) openDialog(it)
...@@ -281,28 +295,31 @@ object OneKeyLoginHelp { ...@@ -281,28 +295,31 @@ object OneKeyLoginHelp {
// 一键登录token监听器 // 一键登录token监听器
private var mTokenListener: TokenResultListener = object : TokenResultListener { private var mTokenListener: TokenResultListener = object : TokenResultListener {
override fun onTokenSuccess(s: String) { override fun onTokenSuccess(s: String) {
val tokenRet = TokenRet.fromJson(s) if (mAuthType == PhoneNumberAuthHelper.SERVICE_TYPE_AUTH) { // 本机号码校验
when (tokenRet.code) { verifyTokenResultListener.onTokenSuccess(s)
ResultCode.CODE_START_AUTHPAGE_SUCCESS -> { // 唤起一键登录页面成功 } else {
LogUtil.e("唤起授权页成功:$s") val tokenRet = TokenRet.fromJson(s)
} when (tokenRet.code) {
ResultCode.CODE_SUCCESS -> { // 点击登录后获取token成功 ResultCode.CODE_START_AUTHPAGE_SUCCESS -> { // 唤起一键登录页面成功
val token = tokenRet.token LogUtil.e("唤起授权页成功:$s")
if (mAuthType == PHONE_CHECK) { // 本机号码校验 }
verifyTokenResultListener.onTokenSuccess(token) ResultCode.CODE_SUCCESS -> { // 获取token成功
}else{ val token = tokenRet.token
// 登录 mPhoneNumberAuthHelper?.setAuthListener(null)
mIsGetTokenSuccess = false
} }
mPhoneNumberAuthHelper?.setAuthListener(null)
} }
} }
} }
override fun onTokenFailed(s: String) { override fun onTokenFailed(s: String) {
LogUtil.e(s) LogUtil.e(s)
mIsGetTokenSuccess = false mIsGetTokenSuccess = false
val tokenRet = TokenRet.fromJson(s) val tokenRet = TokenRet.fromJson(s)
if (mAuthType == PHONE_CHECK) { // 本机号码校验 if (mAuthType == PhoneNumberAuthHelper.SERVICE_TYPE_AUTH) { // 本机号码校验
verifyTokenResultListener.onTokenFailed(tokenRet) verifyTokenResultListener.onTokenFailed(tokenRet)
} else { } else {
// 一键登录 // 一键登录
...@@ -324,7 +341,7 @@ object OneKeyLoginHelp { ...@@ -324,7 +341,7 @@ object OneKeyLoginHelp {
private lateinit var verifyTokenResultListener: VerifyTokenResultListener private lateinit var verifyTokenResultListener: VerifyTokenResultListener
interface VerifyTokenResultListener { interface VerifyTokenResultListener {
fun onTokenSuccess(result: String?) fun onTokenSuccess(result: String)
fun onTokenFailed(result: TokenRet) fun onTokenFailed(result: TokenRet)
} }
......
...@@ -12,25 +12,21 @@ import android.text.* ...@@ -12,25 +12,21 @@ import android.text.*
import android.text.method.LinkMovementMethod import android.text.method.LinkMovementMethod
import android.text.style.AbsoluteSizeSpan import android.text.style.AbsoluteSizeSpan
import android.text.style.ClickableSpan import android.text.style.ClickableSpan
import android.util.Log
import android.view.View import android.view.View
import android.view.animation.AnimationUtils import android.view.animation.AnimationUtils
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.meituan.android.walle.WalleChannelReader import com.meituan.android.walle.WalleChannelReader
import com.mobile.auth.gatewayauth.AuthUIConfig
import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper
import com.mobile.auth.gatewayauth.PreLoginResultListener import com.mobile.auth.gatewayauth.ResultCode
import com.mobile.auth.gatewayauth.TokenResultListener import com.mobile.auth.gatewayauth.model.TokenRet
import com.mobile.auth.gatewayauth.model.InitResult
import com.mobile.auth.gatewayauth.model.VendorConfig
import com.tbruyelle.rxpermissions2.RxPermissions import com.tbruyelle.rxpermissions2.RxPermissions
import com.umeng.socialize.UMShareAPI import com.umeng.socialize.UMShareAPI
import com.umeng.socialize.UMShareConfig import com.umeng.socialize.UMShareConfig
import com.umeng.socialize.bean.SHARE_MEDIA import com.umeng.socialize.bean.SHARE_MEDIA
import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.BaseMvpActivity import com.ydl.ydlcommon.base.BaseMvpActivity
import com.ydl.ydlcommon.data.PlatformRamImpl import com.ydl.ydlcommon.data.PlatformRamImpl
import com.ydl.ydlcommon.utils.ActivityManager import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.StatusBarUtils import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
...@@ -38,7 +34,10 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog ...@@ -38,7 +34,10 @@ import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.common.tools.LogUtil import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxKeyboardTool import com.yidianling.common.tools.RxKeyboardTool
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.* import com.yidianling.user.LoginUtils
import com.yidianling.user.R
import com.yidianling.user.StatusUtils
import com.yidianling.user.UserHelper
import com.yidianling.user.api.bean.UserResponseBean import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.bean.AliAuthBean import com.yidianling.user.bean.AliAuthBean
import com.yidianling.user.constants.UserBIConstants import com.yidianling.user.constants.UserBIConstants
...@@ -65,20 +64,11 @@ import kotlinx.android.synthetic.main.user_activity_register_and_login.* ...@@ -65,20 +64,11 @@ import kotlinx.android.synthetic.main.user_activity_register_and_login.*
class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginContract.Presenter>(), class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginContract.Presenter>(),
ILoginContract.View { ILoginContract.View {
private var mAlicomAuthHelper: PhoneNumberAuthHelper? = null
private var mTokenListener: TokenResultListener? = null
private var mAutCheckResult: InitResult? = null
private var userPhoneNumber: String? = null private var userPhoneNumber: String? = null
// 是否支持号码认证
private var isCanAuth: Boolean = false
/** private var chcekPhoneResponeBean: ChcekPhoneResponeBean? = null // 手机号校验结果
* 是不是4G网络
*/
private var isCan4GAuth: Boolean = false
/**
* 手机号校验结果
*/
private var chcekPhoneResponeBean: ChcekPhoneResponeBean? = null
private var isUmengLoginState: Boolean = false //true 通过第三方登录后绑定手机号码 private var isUmengLoginState: Boolean = false //true 通过第三方登录后绑定手机号码
private var countryCode: String? = "0086"//国家或地区手机区号 private var countryCode: String? = "0086"//国家或地区手机区号
private var handler: Handler? = null private var handler: Handler? = null
...@@ -144,21 +134,13 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -144,21 +134,13 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
.subscribe { permission -> .subscribe { permission ->
when { when {
permission.granted -> { permission.granted -> {
// 用户已经同意该权限
/*
* 5.sdk init
*/
mAutCheckResult = mAlicomAuthHelper?.checkAuthEnvEnable()
} }
permission.shouldShowRequestPermissionRationale -> { permission.shouldShowRequestPermissionRationale -> {
// 用户拒绝了该权限,没有选中『不再询问』(Never ask again),那么下次再次启动时。还会提示请求权限的对话框 // 用户拒绝了该权限,没有选中『不再询问』(Never ask again),那么下次再次启动时。还会提示请求权限的对话框
} }
else -> { else -> {
// 用户拒绝了该权限,而且选中『不再询问』 // 用户拒绝了该权限,而且选中『不再询问』
ToastUtil.toastLong( ToastUtil.toastLong(this, "App正常工作需要使用设备信息权限,请开启")
this,
getString(R.string.platform_need_storage_permission_hint)
)
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS) val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri = Uri.fromParts("package", packageName, null) val uri = Uri.fromParts("package", packageName, null)
intent.data = uri intent.data = uri
...@@ -166,19 +148,6 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -166,19 +148,6 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
finish() finish()
} }
} }
if (mAutCheckResult != null) {
isCan4GAuth = mAutCheckResult?.isCan4GAuth!!
if (!TextUtils.isEmpty(mAutCheckResult!!.simPhoneNumber) && TextUtils.isEmpty(
userPhoneNumber
)
) {
runOnUiThread {
et_phone_number.setPhoneText(mAutCheckResult!!.simPhoneNumber)
et_phone_number.setSelection(et_phone_number.text.length)
iv_del.visibility = View.VISIBLE
}
}
}
} }
} }
...@@ -198,78 +167,44 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -198,78 +167,44 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
private fun initAuthHelper() { private fun initAuthHelper() {
/* requestPermission()
* 1.init get token callback Listener
*/ OneKeyLoginHelp.checkEnvAvailable(PhoneNumberAuthHelper.SERVICE_TYPE_AUTH)
mTokenListener = object : TokenResultListener { OneKeyLoginHelp.setVerifyTokenResultListener(object :OneKeyLoginHelp.VerifyTokenResultListener{
override fun onTokenSuccess(ret: String) { override fun onTokenSuccess(result: String) {
this@RegisterAndLoginActivity.runOnUiThread { val tokenRet = TokenRet.fromJson(result)
try { when (tokenRet.code) {
ResultCode.CODE_ERROR_ENV_CHECK_SUCCESS->{ // 终端环境支持认证
isCanAuth =true
val phone = SharedPreferencesEditor.getString(UserHelper.USER_PHONE)
phone?.let {
et_phone_number.setPhoneText(phone)
et_phone_number.setSelection(phone.length)
iv_del.visibility = View.VISIBLE
}
}
ResultCode.CODE_SUCCESS -> { // 获取token成功
val aliAuthBean = AliAuthBean() val aliAuthBean = AliAuthBean()
aliAuthBean.accessCode = ret aliAuthBean.accessCode = result
//
if (isUmengLoginState) { if (isUmengLoginState) {
//绑定手机号码 //绑定手机号码
umengLoginBindPhone(aliAuthBean.accessCode) umengLoginBindPhone(aliAuthBean.accessCode)
} else { } else {
autoLogin(aliAuthBean) autoLogin(aliAuthBean)
} }
} catch (e: Exception) { OneKeyLoginHelp.mPhoneNumberAuthHelper?.setAuthListener(null)
e.printStackTrace() OneKeyLoginHelp.mIsGetTokenSuccess = false
aliAuthFailed()
} }
/*
* setText just show the result for get token。
* use ret to verfiy number。
*/
mAlicomAuthHelper?.quitAuthActivity()
} }
} }
override fun onTokenFailed(ret: String) { override fun onTokenFailed(result: TokenRet) {
this@RegisterAndLoginActivity.runOnUiThread { if (isCanAuth) {
//验证失败跳转到验证码/密码界面 //验证失败跳转到验证码/密码界面
aliAuthFailed() aliAuthFailed()
/*
* setText just show the result for get token
* do something when getToken failed, such as use sms verify code.
*/
mAlicomAuthHelper?.quitAuthActivity()
} }
} }
}
/*
* 2.init AlicomAuthHelper with tokenListener
*/
mAlicomAuthHelper = PhoneNumberAuthHelper.getInstance(this, mTokenListener)
/*
* 3.set debugMode when app is in debug mode, sdk will print log in debug mode
*/
mAlicomAuthHelper?.setDebugMode(BaseApp.instance.getGlobalConfig().appDebug)
requestPermission()
/*
* 8.config authorization page ui to adapte app ui theme
*/
mAlicomAuthHelper?.setAuthUIConfig(
AuthUIConfig.Builder()
.setAppPrivacyOne("自定义协议", "https://www.aliyun.com/product/dypns")
.setLogoImgPath("ic_launcher")
.setPrivacyState(true)
.setCheckboxHidden(true)
.create()
)
mAlicomAuthHelper?.preLogin(5, object : PreLoginResultListener {
override fun onTokenSuccess(s: String) {
Log.e("mTokenListener", "preLogin Success:$s")
}
override fun onTokenFailed(s: String, s1: String) {
Log.e("mTokenListener", "preLogin Failed:$s")
}
}) })
} }
...@@ -554,30 +489,15 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -554,30 +489,15 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
override fun checkPhoneStatusSuccess(bean: ChcekPhoneResponeBean?, phone: String) { override fun checkPhoneStatusSuccess(bean: ChcekPhoneResponeBean?, phone: String) {
//校验手机号的结果需要在本地保存,后续一键认证登录失败后跳转密码登录需要用到校验结果 //校验手机号的结果需要在本地保存,后续一键认证登录失败后跳转密码登录需要用到校验结果
if (bean != null) { if (bean != null) {
chcekPhoneResponeBean = chcekPhoneResponeBean = ChcekPhoneResponeBean(bean.hasPwd, bean.isDoctor, bean.isRegistered)
ChcekPhoneResponeBean(bean.hasPwd, bean.isDoctor, bean.isRegistered)
} }
if (isCan4GAuth) { if (isCanAuth) {
mAlicomAuthHelper?.getAuthToken(5000) OneKeyLoginHelp.getVerifyToken()
// val authBean = CheckAliAuthParam(phone, mAlicomAuthHelper!!.version)
// mPresenter.checkAliAuth(authBean)
} else { } else {
aliAuthFailed() aliAuthFailed()
} }
} }
/**
* 服务端校验阿里一键认证成功,设置sdk token
*
* 成功的回调 :
* @see getAuthToken
*
* 失败的回调 :
* @see aliAuthFailed
*/
override fun getAuthToken(configDTOs: List<VendorConfig>) {
// mAlicomAuthHelper!!.getAuthToken(5000)
}
/** /**
* 服务端校验阿里一键认证认证失败 * 服务端校验阿里一键认证认证失败
...@@ -742,9 +662,5 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont ...@@ -742,9 +662,5 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
if (handler != null) { if (handler != null) {
handler = null handler = null
} }
if (mAlicomAuthHelper != null) {
mAlicomAuthHelper!!.onDestroy()
}
mAlicomAuthHelper = null
} }
} }
...@@ -62,11 +62,6 @@ interface ILoginContract { ...@@ -62,11 +62,6 @@ interface ILoginContract {
fun checkPhoneStatusSuccess(bean: ChcekPhoneResponeBean?, phone: String) fun checkPhoneStatusSuccess(bean: ChcekPhoneResponeBean?, phone: String)
/** /**
* 设置阿里一键认证sdk token
*/
fun getAuthToken(configDTOs: List<VendorConfig>)
/**
* 服务端阿里认证失败 * 服务端阿里认证失败
*/ */
fun aliAuthFailed() fun aliAuthFailed()
......
...@@ -59,7 +59,7 @@ import kotlinx.android.synthetic.main.user_activity_register_and_login.* ...@@ -59,7 +59,7 @@ import kotlinx.android.synthetic.main.user_activity_register_and_login.*
* @Company 壹点灵 * @Company 壹点灵
* @date 2018/11/28 * @date 2018/11/28
*/ */
@Route(path = "/user/login") //@Route(path = "/user/login")
class testLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginContract.Presenter>(), class testLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginContract.Presenter>(),
ILoginContract.View { ILoginContract.View {
...@@ -434,19 +434,6 @@ class testLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginContract.Pr ...@@ -434,19 +434,6 @@ class testLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginContract.Pr
} }
/** /**
* 服务端校验阿里一键认证成功,设置sdk token
*
* 成功的回调 :
* @see getAuthToken
*
* 失败的回调 :
* @see aliAuthFailed
*/
override fun getAuthToken(configDTOs: List<VendorConfig>) {
// mAlicomAuthHelper!!.getAuthToken(5000)
}
/**
* 服务端校验阿里一键认证认证失败 * 服务端校验阿里一键认证认证失败
* *
* 成功的回调 : * 成功的回调 :
......
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