Commit 09ba2bd8 by 刘鹏

feat : 一键登录未通

parent c277bcf1
......@@ -83,7 +83,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
// 初始化一键登录sdk
OneKeyLoginHelp.sdkInit(
this,
OneKeyLoginHelp.YDL_USER_APP,
OneKeyLoginHelp.YDL_MEDICAL_APP,
PhoneNumberAuthHelper.SERVICE_TYPE_LOGIN
)
bindService()
......
......@@ -9,6 +9,7 @@ ext {
"m-consultant" : "0.0.59.91",
"m-fm" : "0.0.30.03",
"m-user" : "0.0.61.90",
"m-user-medical" : "0.0.61.92",
"m-home" : "0.0.22.70",
"m-im" : "0.0.20.76",
"m-dynamic" : "0.0.7.28",
......@@ -93,6 +94,7 @@ ext {
"m-consultant" : "0.0.59.91",
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.90",
"m-user-medical" : "0.0.61.92",
"m-home" : "0.0.22.70",
"m-im" : "0.0.20.76",
"m-dynamic" : "0.0.7.28",
......
......@@ -54,6 +54,7 @@ android {
productFlavors {
ydl {}
xlzx {}
medical {}
}
sourceSets {
......
......@@ -22,7 +22,7 @@ modular {
groupId = "com.ydl"
artifactId = "m-user-module-medical"
// 上报的 壹点灵 业务模块 aar 包的版本号
version = rootProject.ext.ydlPublishVersion[childProject.getName()]
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-medical"]
}
}
......
......@@ -22,6 +22,7 @@ import com.yidianling.user.safePrivate.FingerPrintUtil
import com.yidianling.user.safePrivate.HandUnlockCheckActivity
import com.yidianling.user.ui.collect.CollectSexAndBirthActivity
import com.yidianling.user.ui.login.InputPassWordActivity
import com.yidianling.user.ui.login.OneKeyLoginHelp
import com.yidianling.user.ui.login.RegisterAndLoginActivity
import com.yidianling.user.ui.login.VerificationCodeActivity
import de.greenrobot.event.EventBus
......@@ -103,6 +104,7 @@ object LoginUtils {
@JvmStatic
fun loginSuccessOperate(activity: Activity) {
// 登录成功后,如果一键登录界面没有关闭,则关闭掉
OneKeyLoginHelp.quitLoginPage()
val size = ActivityManager.getActivitySize()
if (size <= 2) {//当前stack只有两个页面,必然没有MainActivity
ActivityManager.finishAll()
......
......@@ -157,7 +157,7 @@ interface UserApi {
/**
* 一键登录和本机号码校验
*/
@POST("login/v2/login_direct")
@POST("api/login/v2/login_direct")
@Headers(YDL_DOMAIN + YDL_DOMAIN_LOGIN_BASE_URL, LOGIN_USER_PORT)
fun autoLogin(@Body body: RequestBody): Observable<BaseResponse<UserResponseBean>>
......
......@@ -56,9 +56,12 @@ object OneKeyLoginHelp {
"j/bknWkezaeinV5fNddqzgY3iFPi9qlghUURCZdwLK6/zkxgwHyaAIxMVPnmQc0dSJ3LDYUvRYsSPZTXfjAdm92R1qmADFCK/NSENPENw5hLo/NCdvuySRYOnbbX5ZidyfeD/N5813mLomStMCPTv8GEYwUOdW1fnd8LBMNyi1K0Y2yWUKzGzYyVuMpWSpu38ULA6YXuATGkV/h3ric6SPqD2yS5SvjLHOye4Im5eeGdUgjRqzGnBM9F//okRlKJnuEHnBQ/HEU1Vt6sUgBhWHszGn1vzdSw"
private const val YDL_EXPERT_APP_KEY =
"i4Y/PVRAz4P/aqajQF7SOd3JUIKEsJbRurH04azLyX6N2upi292OrLHECRmtTVAqY24HFjwUjW1QjRwJA9aFbNzl3zl7L5DEDBZ4+QSU28vq34HccmAjAeUCC7qCHbN7QLVZqhVpuYUCMZ5fp2NdhANJl/741wHccdPk/Un5c4larDNuv1KEo2OZOds2J1WFiBx7giWtzli4NwMq9x+9sb0aXPZZQ9C9Kr8T/0+/ccYdotwFm7XWenNs/G3Jy1HHVqqOCDecKPbyXR+cV0jBUisSjv+SEUTfpcc3iUGH5OjZyQ6OfaLkdjATsr5K9oVP"
private const val YDL_MEDICAL_APP_KEY =
"DyAkrmEoPFYqOh5xV8BDWTnyNaD5mf+M0VaHDHQJf1kk4RRB0KHGt/mcu5DtuRI/BAfit/MYKa3Krjkt4UCAlmtxwZzYHCMYdk4EqnHu4TZxCQpHSOCp1y851CURtOUANGBD+baX04T0L4DH7wIf3175s3fa7NUFaKHnaZ9GW/jo+EP/4EJ0Yo2mLG+3LasVL4CL/a9D0lI+p9tfStb7PT8ndoU5riUauOJLxdf9xoFJlMXPkjfCPplP20a5oAr58vjABtuVNgOp4K85wYZJjHDvP1EPZg3oRljUs1ZzxfvgltmJyeqKBZeKzco1FCCG"
const val YDL_USER_APP = 1
const val YDL_EXPERT_APP = 2
const val YDL_XINLIZIXUN_APP = 3
const val YDL_MEDICAL_APP = 4
var mPhoneNumberAuthHelper: PhoneNumberAuthHelper? = null
private var mAppType: Int = YDL_USER_APP
var mIsFromGuide = true // 是否来自启动页
......@@ -86,6 +89,8 @@ object OneKeyLoginHelp {
it.setAuthSDKInfo(YDL_EXPERT_APP_KEY)
} else if (appType == YDL_XINLIZIXUN_APP) {
it.setAuthSDKInfo(YDL_XINLIZIXUN_APP_KEY)
}else if(appType == YDL_MEDICAL_APP){
it.setAuthSDKInfo(YDL_MEDICAL_APP_KEY)
}
// 控件点击事件
......
......@@ -50,6 +50,10 @@ interface ILoginContract {
fun checkPhoneStatusSuccess(bean: ChcekPhoneResponeBean?, phone: String)
/**
* 服务端阿里认证失败
*/
fun aliAuthFailed()
/**
* sdk
......@@ -69,11 +73,6 @@ interface ILoginContract {
fun checkPhoneStatus(phone: String, countryCode: String, isBind: Boolean,gatewayUrl :String)
/**
* 服务端阿里认证失败
*/
fun aliAuthFailed()
/**
* 服务端校验阿里一键认证
*/
fun checkAliAuth(param: CheckAliAuthParam)
......
......@@ -32,5 +32,17 @@ class LoginModelImpl : ILoginContract.Model {
override fun checkPhoneStatus(phone: String, countryCode: String,gatewayUrl :String): Observable<BaseResponse<ChcekPhoneResponeBean>> {
return LoginApiRequestUtil.checkPhoneStatus(phone, countryCode,gatewayUrl)
}
/**
* 通过一键认证服务登陆
*/
override fun autoLogin(bean: PhoneLoginAutoParam): Observable<BaseResponse<UserResponseBean>> {
return LoginApiRequestUtil.autoLogin(bean)
}
/**
* 服务端校验阿里一键认证
*/
override fun checkAliAuth(param: CheckAliAuthParam): Observable<BaseResponse<PhoneAuthResponseBean>> {
return LoginApiRequestUtil.checkAliAuth(param)
}
}
\ No newline at end of file
......@@ -5,11 +5,17 @@ import android.text.TextUtils
import com.ydl.ydlcommon.mvp.base.BasePresenter
import com.ydl.ydlcommon.router.YdlCommonOut
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
import com.ydl.ydlcommon.utils.log.LogHelper
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.LoginUtils
import com.yidianling.user.StatusUtils
import com.yidianling.user.api.bean.UserResponseBean
import com.yidianling.user.constants.UserBIConstants
import com.yidianling.user.http.request.CheckAliAuthParam
import com.yidianling.user.http.request.PhoneLoginAutoParam
import com.yidianling.user.ui.login.contract.ILoginContract
import com.yidianling.user.ui.login.model.LoginModelImpl
import io.reactivex.android.schedulers.AndroidSchedulers
......@@ -48,6 +54,58 @@ class LoginPresenterImpl(view: ILoginContract.View) :
LoginUtils.onLogin(userResponse)
}
/**
* 通过一键认证服务登陆
*/
@SuppressLint("CheckResult")
override fun autoLogin(bean: PhoneLoginAutoParam) {
mModel.autoLogin(bean)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe { mView.showLoading(true) }
.doAfterTerminate { mView.showLoading(false) }
.subscribe({
if (it.code == 200) {
//绑定手机号
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
}
mView.autoLoginSuccess()
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.LOGIN, "通过一键认证服务登录成功")
} else {
// ToastUtil.toastShort(it.msg)
mView.aliAuthFailed()
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.LOGIN, "通过一键认证服务登陆 失败 msg: ${it.msg}")
}
}, {
//走验证码、密码登录
mView.aliAuthFailed()
AliYunRichLogsHelper.getInstance()
.sendRichLog(AliYunLogConfig.LOGIN, "通过一键认证服务登陆 Error msg: ${it.message}")
})
}
/**
* 服务端校验阿里一键认证
*/
@SuppressLint("CheckResult")
override fun checkAliAuth(param: CheckAliAuthParam) {
mModel.checkAliAuth(param)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if (it?.data == null) {
mView.aliAuthFailed()
}
}, {
mView.aliAuthFailed()
})
}
/**
* 校验手机号:是否是用户版号码、是否有设置密码、是否被绑定
......@@ -94,6 +152,7 @@ class LoginPresenterImpl(view: ILoginContract.View) :
})
}
override fun createModel(): ILoginContract.Model {
return LoginModelImpl()
}
......
package com.yidianling.user.ui.login.util
/**
* @author yuanWai
* @描述:登录注册页面工具类
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2019/1/10
*/
class LoginUtils{
companion object {
}
}
\ No newline at end of file
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