Commit a9ff09f1 by 刘鹏

feat: 登录模块日志

parent 68c46651
......@@ -8,7 +8,7 @@ ext {
"m-confide" : "0.0.49.02",
"m-consultant" : "0.0.59.66",
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.18",
"m-user" : "0.0.61.23",
"m-home" : "0.0.22.55",
"m-im" : "0.0.18.45",
"m-dynamic" : "0.0.7.19",
......@@ -91,7 +91,7 @@ ext {
"m-confide" : "0.0.49.02",
"m-consultant" : "0.0.59.66",
"m-fm" : "0.0.30.01",
"m-user" : "0.0.61.18",
"m-user" : "0.0.61.23",
"m-home" : "0.0.22.54",
"m-im" : "0.0.18.45",
"m-dynamic" : "0.0.7.19",
......
......@@ -6,6 +6,8 @@ import com.tencent.bugly.crashreport.CrashReport
import com.ydl.ydlcommon.data.http.RxUtils
import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.BuryPointUtils
import com.ydl.ydlnet.utils.log.AliYunLogConfig
import com.ydl.ydlnet.utils.log.AliYunLogHelper
import com.yidianling.common.tools.LogUtil
import com.yidianling.im.api.bean.IMLoginInfo
import com.yidianling.im.api.bean.IMRequestCallback
......@@ -57,16 +59,22 @@ object LoginUtils {
val info = IMLoginInfo(userInfo?.uid ?: "", userInfo?.hxpwd ?: "")
val callback = object : IMRequestCallback<IMLoginInfo> {
override fun onSuccess(t: IMLoginInfo?) {
LogUtil.e("IM登录成功:"+"info.account:"+info.account+"info.passWord"+info.passWord)
LogUtil.e("IM登录成功:" + "info.account:" + info.account + "info.passWord" + info.passWord)
UserIn.imSetAccount(userInfo?.uid ?: "")
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.LOGIN, "IM登录成功")
}
override fun onFailed(i: Int) {
LogUtil.e("IM登录失败:$i"+"info.account:"+info.account+"info.passWord"+info.passWord)
LogUtil.e("IM登录失败:$i" + "info.account:" + info.account + "info.passWord" + info.passWord)
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.LOGIN, "IM登录失败")
}
override fun onException(throwable: Throwable?) {
LogUtil.e("IM登录onException:${throwable?.message}")
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, "IM登录onException:${throwable?.message}")
}
}
......@@ -79,17 +87,18 @@ object LoginUtils {
fun logout() {
EventBus.getDefault().post(UserLogoutEvent())
UserHttpImpl.getInstance().logout(Logout())
.compose(RxUtils.resultData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
logoutClearLocal()
}, {
logoutClearLocal()
})
.compose(RxUtils.resultData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
logoutClearLocal()
}, {
logoutClearLocal()
})
}
@JvmStatic
fun logoutClearLocal() {
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.LOGIN, "退出登录")
UserIn.imLogout()
UserIn.closePlayer()
UserIn.clearImData()
......@@ -105,7 +114,7 @@ object LoginUtils {
ActivityManager.finishAll()
if (StatusUtils.isFirstLogin && StatusUtils.isFirstStartApp) {
activity.startActivity(Intent(activity, CollectSexAndBirthActivity::class.java))
}else {
} else {
UserIn.mainIntent(activity)
}
} else {//需要判断stack中是否有MainActivity
......
......@@ -15,6 +15,8 @@ import com.ydl.ydlcommon.utils.ActivityManager
import com.ydl.ydlcommon.utils.UserInfoCache
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper
import com.ydl.ydlnet.utils.log.AliYunLogConfig
import com.ydl.ydlnet.utils.log.AliYunLogHelper
import com.yidianling.im.api.bean.IMLoginInfo
import com.yidianling.im.api.bean.IMRequestCallback
import com.yidianling.user.LoginUtils
......@@ -118,13 +120,13 @@ class SmsLoginActivity : BaseActivity() {
})*/
vCodeSub = userHttp.code(CodeParam(code, phoneNum, UserConstants.SIGNIN_ACTION))
.compose(RxUtils.resultData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {}, object : ThrowableConsumer() {
override fun accept(msg: String) {
ToastHelper.show(msg)
}
})
.compose(RxUtils.resultData())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {}, object : ThrowableConsumer() {
override fun accept(msg: String) {
ToastHelper.show(msg)
}
})
}
private var loginSub: Disposable? = null
......@@ -136,37 +138,49 @@ class SmsLoginActivity : BaseActivity() {
return
}
ActionCountUtils.count(UserBIConstants.POSITION_LOGIN_CLICK, UserBIConstants.ACTION_TYPE_CODE_LOGIN)
ActionCountUtils.count(
UserBIConstants.POSITION_LOGIN_CLICK,
UserBIConstants.ACTION_TYPE_CODE_LOGIN
)
Log.e("短信验证码:", code + " - " + phoneNum + " - " + et_code.text.toString());
loginSub = userHttp.login(LoginParam(code, phoneNum, null, 2, et_code.text.toString()))
.compose(RxUtils.resultData())
.doOnNext { LoginUtils.saveData(it) }
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe { showProgressDialog("") }
.doAfterTerminate { dismissProgressDialog() }
.subscribe(Consumer {
LoginUtils.onLogin(it)
//关闭手势解锁页面与指纹解锁页面
finishFinger()
if (it.firstLogin == 1) {
StatusUtils.isFirstLogin = true
baiduActionBury()
}else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.uid!!,UserBIConstants.ACTION_TYPE_CODE_LOGIN)
}
.compose(RxUtils.resultData())
.doOnNext { LoginUtils.saveData(it) }
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe { showProgressDialog("") }
.doAfterTerminate { dismissProgressDialog() }
.subscribe(Consumer {
LoginUtils.onLogin(it)
//关闭手势解锁页面与指纹解锁页面
finishFinger()
if (it.firstLogin == 1) {
StatusUtils.isFirstLogin = true
baiduActionBury()
} else {
ActionCountUtils.countUid(
UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,
it.uid!!,
UserBIConstants.ACTION_TYPE_CODE_LOGIN
)
}
// ActivityManager.finishActivity(LoginActivity::class.java)
// if (ActivityManager.getActivitySize() <= 1) {
// UserIn.mainIntent(this)
// }
// finish()
LoginUtils.loginSuccessOperate(this)
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
dismissProgressDialog()
YdlCommonOut.showToast(msg)
}
})
LoginUtils.loginSuccessOperate(this)
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, "短信验证码 成功")
}, object : ThrowableConsumer() {
override fun accept(msg: String) {
dismissProgressDialog()
YdlCommonOut.showToast(msg)
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, "短信验证码 失败 msg:$msg ")
}
})
}
/**
......@@ -224,9 +238,11 @@ class SmsLoginActivity : BaseActivity() {
try {
if (userInfo != null) {
UserIn.imSetAccount(userInfo.uid.toString())
UserInfoCache.getInstance().saveYDLUser(userInfo.uid.toString(),
userInfo.nick_name,
userInfo.head)
UserInfoCache.getInstance().saveYDLUser(
userInfo.uid.toString(),
userInfo.nick_name,
userInfo.head
)
}
} catch (e: Exception) {
e.printStackTrace()
......@@ -237,21 +253,21 @@ class SmsLoginActivity : BaseActivity() {
private fun initTimer() {
timerSub = Observable.interval(0, 1, TimeUnit.SECONDS)
.subscribeOn(Schedulers.computation())
.take(60)
.map { String.format("重发(%d)", 59 - it) }
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe {
tv_get_code.isEnabled = false
tv_get_code.setTextColor(-0x525253)
}
.subscribe({
tv_get_code.text = it
}, {}, {
tv_get_code.text = "重新发送"
tv_get_code.isEnabled = true
tv_get_code.setTextColor(-0xb62d7f)
})
.subscribeOn(Schedulers.computation())
.take(60)
.map { String.format("重发(%d)", 59 - it) }
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe {
tv_get_code.isEnabled = false
tv_get_code.setTextColor(-0x525253)
}
.subscribe({
tv_get_code.text = it
}, {}, {
tv_get_code.text = "重新发送"
tv_get_code.isEnabled = true
tv_get_code.setTextColor(-0xb62d7f)
})
}
......
......@@ -7,7 +7,6 @@ import android.content.Context
import android.content.pm.ActivityInfo
import android.graphics.Color
import android.text.TextUtils
import android.util.Log
import android.util.TypedValue
import android.view.Gravity
import android.view.View
......@@ -17,7 +16,6 @@ import android.widget.TextView
import com.fm.openinstall.OpenInstall
import com.fm.openinstall.listener.AppInstallAdapter
import com.fm.openinstall.model.AppData
import com.fm.openinstall.model.Error
import com.meituan.android.walle.WalleChannelReader
import com.mobile.auth.gatewayauth.*
import com.mobile.auth.gatewayauth.model.TokenRet
......@@ -29,6 +27,8 @@ import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlnet.utils.log.AliYunLogConfig
import com.ydl.ydlnet.utils.log.AliYunLogHelper
import com.yidianling.common.tools.RxAppTool
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
......@@ -430,6 +430,7 @@ object OneKeyLoginHelp {
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
if (it.code == 200) {
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.LOGIN,"一键登录成功")
ToastUtil.toastShort("登录成功")
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
......@@ -463,10 +464,12 @@ object OneKeyLoginHelp {
LoginUtils.loginSuccessOperate(mActivity)
}
} else {
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.LOGIN,"一键登录失败 msg:${it.msg}")
ToastUtil.toastShort(it.msg)
mPhoneNumberAuthHelper?.hideLoginLoading()
}
}, {
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.LOGIN,"一键登录Error msg:${it.message}")
ToastUtil.toastShort(it.message)
mPhoneNumberAuthHelper?.hideLoginLoading()
})
......@@ -580,23 +583,30 @@ object OneKeyLoginHelp {
* */
@SuppressLint("CheckResult")
fun startLogin(context: Activity, isOpenDialog: Boolean) {
RxPermissions(context)
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe { hasPermission: Boolean? ->
if (hasPermission == true && mIsOpenOneKeyLogin) {
getLoginToken(isOpenDialog)
} else {
// 一键登录页面打开成功
if (mOpenPageIsSuccess) {
RegisterAndLoginActivity.start(context)
try {
RxPermissions(context)
.request(Manifest.permission.READ_PHONE_STATE)
.subscribe { hasPermission: Boolean? ->
if (hasPermission == true && mIsOpenOneKeyLogin) {
getLoginToken(isOpenDialog)
} else {
RegisterAndLoginActivity.start(
context,
isFromOneKey = false,
isFromGuide = true
)
// 一键登录页面打开成功
if (mOpenPageIsSuccess) {
RegisterAndLoginActivity.start(context)
} else {
RegisterAndLoginActivity.start(
context,
isFromOneKey = false,
isFromGuide = true
)
}
}
}
}
} catch (e: Exception) {
e.printStackTrace()
} finally {
RegisterAndLoginActivity.start(context)
}
}
}
......@@ -34,6 +34,8 @@ import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.ydl.ydlnet.utils.log.AliYunLogConfig
import com.ydl.ydlnet.utils.log.AliYunLogHelper
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxAppTool
import com.yidianling.common.tools.RxKeyboardTool
......@@ -590,6 +592,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
runOnUiThread {
showLoading(false)
}
if (chcekPhoneResponeBean != null && chcekPhoneResponeBean?.hasPwd == 1) {//用户码有设置密码:跳转到密登录
InputPassWordActivity.start(
this,
......
......@@ -8,6 +8,8 @@ import com.ydl.ydlcommon.utils.StringUtils
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.log.LogHelper
import com.ydl.ydlnet.utils.log.AliYunLogConfig
import com.ydl.ydlnet.utils.log.AliYunLogHelper
import com.yidianling.common.tools.ToastUtil
import com.yidianling.user.LoginUtils
import com.yidianling.user.StatusUtils
......@@ -28,7 +30,9 @@ import java.math.BigDecimal
* @Company 壹点灵
* @date 2018/12/2
*/
class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, IInputPassWordContract.Model>(), IInputPassWordContract.Presenter {
class InputPassWordPresenterImpl :
BasePresenter<IInputPassWordContract.View, IInputPassWordContract.Model>(),
IInputPassWordContract.Presenter {
override fun createModel(): IInputPassWordContract.Model {
return InputPassWordModelImpl()
......@@ -37,38 +41,51 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
/**
* 重新设置密码
*/
override fun resetPwd(newPassword: String, phone: String, msgCode: String, phoneCountryCode: String) {
override fun resetPwd(
newPassword: String,
phone: String,
msgCode: String,
phoneCountryCode: String
) {
ActionCountUtils.count(UserBIConstants.POSITION_LOGIN_CLICK, UserBIConstants.ACTION_TYPE_RESET_PWD)
ActionCountUtils.count(
UserBIConstants.POSITION_LOGIN_CLICK,
UserBIConstants.ACTION_TYPE_RESET_PWD
)
var param = PhoneResetPwdParam(StringUtils.md5(newPassword), phoneCountryCode, msgCode, phone)
var param =
PhoneResetPwdParam(StringUtils.md5(newPassword), phoneCountryCode, msgCode, phone)
mModel.resetPwd(param)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe { mView.showLoading(true) }
.doAfterTerminate { mView.showLoading(false) }
.subscribe({
if (it?.data == null) {
ToastUtil.toastShort(it.msg)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe { mView.showLoading(true) }
.doAfterTerminate { mView.showLoading(false) }
.subscribe({
if (it?.data == null) {
ToastUtil.toastShort(it.msg)
} else {
if (it.data.userInfo?.user_type == 2) {
mView.showNormalDialog()
} else {
if (it.data.userInfo?.user_type == 2) {
mView.showNormalDialog()
ToastUtil.toastShort("修改密码成功")
saveUserData(it.data)
ActionCountUtils.countUid(
UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,
it.data.uid!!,
UserBIConstants.ACTION_TYPE_RESET_PWD
)
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
// 重设密码登录已经不可能是首次登录,所以不进行百度埋点
//view.baiduActionBury()
} else {
ToastUtil.toastShort("修改密码成功")
saveUserData(it.data)
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.data.uid!!,UserBIConstants.ACTION_TYPE_RESET_PWD)
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
// 重设密码登录已经不可能是首次登录,所以不进行百度埋点
//view.baiduActionBury()
} else {
}
mView.closeActivity()
}
mView.closeActivity()
}
}, {
YdlCommonOut.showToast(it.message!!)
})
}
}, {
YdlCommonOut.showToast(it.message!!)
})
}
......@@ -76,36 +93,54 @@ class InputPassWordPresenterImpl : BasePresenter<IInputPassWordContract.View, II
* 手机号密码登录
*/
@SuppressLint("CheckResult")
override fun userLoginByPassword(inputPassword: String, phone: String, phoneCountryCode: String) {
ActionCountUtils.count( UserBIConstants.POSITION_LOGIN_CLICK,UserBIConstants.ACTION_TYPE_PWD_LOGIN)
override fun userLoginByPassword(
inputPassword: String,
phone: String,
phoneCountryCode: String
) {
ActionCountUtils.count(
UserBIConstants.POSITION_LOGIN_CLICK,
UserBIConstants.ACTION_TYPE_PWD_LOGIN
)
var param = PhoneLoginPwdParam(StringUtils.md5(inputPassword), phoneCountryCode, phone)
mModel.userLoginByPassword(param)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe { mView.showLoading(true) }
.doAfterTerminate { mView.showLoading(false) }
.subscribe({
if (it?.data == null) {
ToastUtil.toastShort(it.msg)
mView.startAnim()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe { mView.showLoading(true) }
.doAfterTerminate { mView.showLoading(false) }
.subscribe({
if (it?.data == null) {
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, "手机号密码 登录失败 msg: ${it.msg}")
ToastUtil.toastShort(it.msg)
mView.startAnim()
} else {
if (it.data.userInfo?.user_type == 2) {
mView.showNormalDialog()
} else {
if (it.data.userInfo?.user_type == 2) {
mView.showNormalDialog()
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
mView.baiduActionBury()
} else {
saveUserData(it.data)
if (it.data.firstLogin == 1) {//第一次登录:是注册
StatusUtils.isFirstLogin = true
mView.baiduActionBury()
} else {
ActionCountUtils.countUid(UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,it.data.uid!!,UserBIConstants.ACTION_TYPE_PWD_LOGIN)
}
mView.closeActivity()
ActionCountUtils.countUid(
UserBIConstants.POSITION_LOGIN_SUCCESS_CLICK,
it.data.uid!!,
UserBIConstants.ACTION_TYPE_PWD_LOGIN
)
}
mView.closeActivity()
}
}, {
YdlCommonOut.showToast(it.message!!)
})
AliYunLogHelper.getInstance().sendLog(AliYunLogConfig.LOGIN, "手机号密码 登录成功")
}
}, {
YdlCommonOut.showToast(it.message!!)
AliYunLogHelper.getInstance()
.sendLog(AliYunLogConfig.LOGIN, "手机号密码 Error msg: ${it.message}")
})
}
/**
......
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