Commit 2adfbf1e by YKai

feat:vivo渠道增加用户协议不默认勾选

parent 011b89c9
......@@ -8,7 +8,7 @@ ext {
"m-confide" : "0.0.48.77",
"m-consultant" : "0.0.59.36",
"m-fm" : "0.0.30.00",
"m-user" : "0.0.60.31",
"m-user" : "0.0.60.33",
"m-home" : "0.0.22.33",
"m-im" : "0.0.18.23",
"m-dynamic" : "0.0.7.13",
......@@ -92,7 +92,7 @@ ext {
"m-confide" : "0.0.41.6",
"m-consultant" : "0.0.51.16",
"m-fm" : "0.0.23.5",
"m-user" : "0.0.41.10",
"m-user" : "0.0.41.12",
"m-home" : "0.0.6.28",
"m-im" : "0.0.3.14",
"m-dynamic" : "0.0.1.7",
......
......@@ -65,16 +65,19 @@ import kotlinx.android.synthetic.main.user_activity_register_and_login.*
* @date 2018/11/28
*/
@Route(path = "/user/login")
class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginContract.Presenter>(), ILoginContract.View {
class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginContract.Presenter>(),
ILoginContract.View {
private var mAlicomAuthHelper: PhoneNumberAuthHelper? = null
private var mTokenListener: TokenResultListener? = null
private var mAutCheckResult: InitResult? = null
private var userPhoneNumber: String? = null
/**
* 是不是4G网络
*/
private var isCan4GAuth: Boolean = false
/**
* 手机号校验结果
*/
......@@ -141,46 +144,59 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
private fun requestPermission() {
val rxPermissions = RxPermissions(this)
rxPermissions.requestEach(Manifest.permission.READ_PHONE_STATE)
.subscribe { permission ->
when {
permission.granted -> {
// 用户已经同意该权限
/*
* 5.sdk init
*/
mAutCheckResult = mAlicomAuthHelper?.checkAuthEnvEnable()
}
permission.shouldShowRequestPermissionRationale -> {
// 用户拒绝了该权限,没有选中『不再询问』(Never ask again),那么下次再次启动时。还会提示请求权限的对话框
}
else -> {
// 用户拒绝了该权限,而且选中『不再询问』
ToastUtil.toastLong(this, getString(R.string.platform_need_storage_permission_hint))
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri = Uri.fromParts("package", packageName, null)
intent.data = uri
startActivity(intent)
finish()
}
.subscribe { permission ->
when {
permission.granted -> {
// 用户已经同意该权限
/*
* 5.sdk init
*/
mAutCheckResult = mAlicomAuthHelper?.checkAuthEnvEnable()
}
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
}
permission.shouldShowRequestPermissionRationale -> {
// 用户拒绝了该权限,没有选中『不再询问』(Never ask again),那么下次再次启动时。还会提示请求权限的对话框
}
else -> {
// 用户拒绝了该权限,而且选中『不再询问』
ToastUtil.toastLong(
this,
getString(R.string.platform_need_storage_permission_hint)
)
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri = Uri.fromParts("package", packageName, null)
intent.data = uri
startActivity(intent)
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
}
}
}
}
}
/**
* 注册流程成功之后,进行百度埋点
*/
override fun baiduActionBury(uid: String?, positionClick: String) {
ActionCountUtils.baiduCount(uid, UserBIConstants.APP_REGISTER_PAGE, positionClick, "","", 25)
ActionCountUtils.baiduCount(
uid,
UserBIConstants.APP_REGISTER_PAGE,
positionClick,
"",
"",
25
)
}
......@@ -240,12 +256,14 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
/*
* 8.config authorization page ui to adapte app ui theme
*/
mAlicomAuthHelper?.setAuthUIConfig(AuthUIConfig.Builder()
mAlicomAuthHelper?.setAuthUIConfig(
AuthUIConfig.Builder()
.setAppPrivacyOne("自定义协议", "https://www.aliyun.com/product/dypns")
.setLogoImgPath("ic_launcher")
.setPrivacyState(true)
.setCheckboxHidden(true)
.create())
.create()
)
mAlicomAuthHelper?.preLogin(5, object : PreLoginResultListener {
override fun onTokenSuccess(s: String) {
......@@ -271,7 +289,10 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
override fun onClick(widget: View) {
if (!isUmengLoginState) {
H5Activity.start(this@RegisterAndLoginActivity, false)
overridePendingTransition(R.anim.platform_slide_in_from_bottom, R.anim.user_slide_null)
overridePendingTransition(
R.anim.platform_slide_in_from_bottom,
R.anim.user_slide_null
)
}
}
}, 3, 9, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
......@@ -285,7 +306,10 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
override fun onClick(widget: View) {
if (!isUmengLoginState) {
H5Activity.start(this@RegisterAndLoginActivity, true)
overridePendingTransition(R.anim.platform_slide_in_from_bottom, R.anim.user_slide_null)
overridePendingTransition(
R.anim.platform_slide_in_from_bottom,
R.anim.user_slide_null
)
}
}
}, 10, str.length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
......@@ -302,9 +326,9 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
if (isUmengLoginState) {
// tv_skip.visibility = View.VISIBLE
// tv_des.text = "首次绑定即送大礼包"
tv_des.visibility=View.GONE
iv_select_protocol.visibility=View.GONE
tv_des_first.visibility=View.VISIBLE
tv_des.visibility = View.GONE
iv_select_protocol.visibility = View.GONE
tv_des_first.visibility = View.VISIBLE
iv_weixin.visibility = View.GONE
iv_qq.visibility = View.GONE
tv_reg_title.text = "手机号绑定"
......@@ -336,13 +360,27 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
}
//根据来源不同为当前页面埋点
if (isFromGuide) {
ActionCountUtils.count(uid = "", partId = UserBIConstants.PART_ID_LOGIN_MAIN, position = UserBIConstants.POSITION_LOGIN_ONE_PAGE_VISIT,url = "无url",api = "无api",sign1 = "")
}else {
ActionCountUtils.count(uid = "", partId = UserBIConstants.PART_ID_LOGIN_MAIN, position = UserBIConstants.POSITION_LOGIN_TWO_PAGE_VISIT, url = "无url", api = "无api",sign1 = "")
ActionCountUtils.count(
uid = "",
partId = UserBIConstants.PART_ID_LOGIN_MAIN,
position = UserBIConstants.POSITION_LOGIN_ONE_PAGE_VISIT,
url = "无url",
api = "无api",
sign1 = ""
)
} else {
ActionCountUtils.count(
uid = "",
partId = UserBIConstants.PART_ID_LOGIN_MAIN,
position = UserBIConstants.POSITION_LOGIN_TWO_PAGE_VISIT,
url = "无url",
api = "无api",
sign1 = ""
)
}
}
private fun requestFocus(){
private fun requestFocus() {
et_phone_number.post {
et_phone_number.requestFocus()
et_phone_number.isFocusable = true
......@@ -370,23 +408,27 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
RxKeyboardTool.hideSoftInput(this)
onBackPressed()
}
var isAgreeProtocol =false
var isAgreeProtocol = false
//华为渠道不默认勾选隐私协议,必须全局上下文才可以获取到渠道号。其他渠道默认勾选隐私协议
//protocol_android 1是开启华为、vivo渠道默认勾选,2是关闭华为、vivo渠道默认勾选,方便应用市场审核
val huaweiType=PlatformRamImpl.getInstance().getGlobalInfo()?.info?.protocol_android?:2
val channel= WalleChannelReader.getChannel(applicationContext)
if (huaweiType==2&&(channel=="huawei"||channel=="vivo")){
val huaweiType = PlatformRamImpl.getInstance().getGlobalInfo()?.info?.protocol_android ?: 2
val channel = WalleChannelReader.getChannel(applicationContext)
if (huaweiType == 2 && channel == "huawei") {
iv_select_protocol.setImageResource(R.drawable.user_login_protocol_unselected)
}else{
isAgreeProtocol=true
iv_select_protocol.setImageResource(R.drawable.user_login_protocol_selected)
} else {
if (channel == "vivo") {
iv_select_protocol.setImageResource(R.drawable.user_login_protocol_unselected)
} else {
isAgreeProtocol = true
iv_select_protocol.setImageResource(R.drawable.user_login_protocol_selected)
}
}
view_click.setOnClickListener {
if(iv_select_protocol.visibility==View.VISIBLE){
isAgreeProtocol=!isAgreeProtocol
if(isAgreeProtocol){
if (iv_select_protocol.visibility == View.VISIBLE) {
isAgreeProtocol = !isAgreeProtocol
if (isAgreeProtocol) {
iv_select_protocol.setImageResource(R.drawable.user_login_protocol_selected)
}else{
} else {
iv_select_protocol.setImageResource(R.drawable.user_login_protocol_unselected)
}
}
......@@ -412,7 +454,7 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
}
//下一步
iv_next.setOnClickListener {
if(iv_select_protocol.visibility==View.VISIBLE&&!isAgreeProtocol){
if (iv_select_protocol.visibility == View.VISIBLE && !isAgreeProtocol) {
ToastUtil.toastShort("请您先同意壹点灵《用户使用协议》、《隐私保护政策》,才能登录使用")
return@setOnClickListener
}
......@@ -467,7 +509,13 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
* 三方登录成功后绑定手机号
*/
private fun umengLoginBindPhone(accessCode: String?) {
var param = BindPhoneJavaParam(accessCode!!, countryCode!!, userPhoneNumber!!, "", UserHelper.getUserInfo()!!.uid!!)
var param = BindPhoneJavaParam(
accessCode!!,
countryCode!!,
userPhoneNumber!!,
"",
UserHelper.getUserInfo()!!.uid!!
)
mPresenter.bindPhone(param)
}
......@@ -490,9 +538,9 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
isUmengLoginState = true
// tv_skip.visibility = View.VISIBLE
// tv_des.text = "首次绑定即送大礼包"
tv_des.visibility=View.GONE
iv_select_protocol.visibility=View.GONE
tv_des_first.visibility=View.VISIBLE
tv_des.visibility = View.GONE
iv_select_protocol.visibility = View.GONE
tv_des_first.visibility = View.VISIBLE
iv_weixin.visibility = View.GONE
iv_qq.visibility = View.GONE
tv_reg_title.text = "手机号绑定"
......@@ -508,7 +556,8 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
override fun checkPhoneStatusSuccess(bean: ChcekPhoneResponeBean?, phone: String) {
//校验手机号的结果需要在本地保存,后续一键认证登录失败后跳转密码登录需要用到校验结果
if (bean != null) {
chcekPhoneResponeBean = ChcekPhoneResponeBean(bean.hasPwd, bean.isDoctor, bean.isRegistered)
chcekPhoneResponeBean =
ChcekPhoneResponeBean(bean.hasPwd, bean.isDoctor, bean.isRegistered)
}
if (isCan4GAuth) {
mAlicomAuthHelper?.getAuthToken(5000)
......@@ -547,10 +596,22 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
showLoading(false)
}
if (chcekPhoneResponeBean != null && chcekPhoneResponeBean?.hasPwd == 1) {//用户码有设置密码:跳转到密登录
InputPassWordActivity.start(this, userPhoneNumber!!, countryCode!!, InputPassWordActivity.STATUS_INPUT_PWD)
InputPassWordActivity.start(
this,
userPhoneNumber!!,
countryCode!!,
InputPassWordActivity.STATUS_INPUT_PWD
)
} else {//否则跳转验证码页面
if (!TextUtils.isEmpty(userPhoneNumber) && !TextUtils.isEmpty(countryCode)) {
VerificationCodeActivity.start(this, userPhoneNumber!!, countryCode!!, VerificationCodeActivity.STATUS_LOGIN_BY_CODE, isUmengLoginState, false)
VerificationCodeActivity.start(
this,
userPhoneNumber!!,
countryCode!!,
VerificationCodeActivity.STATUS_LOGIN_BY_CODE,
isUmengLoginState,
false
)
}
}
}
......@@ -632,19 +693,19 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
override fun showHasBindedDialog() {
CommonDialog.create(this)
.setMessage("该手机号已被注册,无法绑定,\n您可以使用它直接登录。")
.setRightClick("确定") {
}
.show()
.setMessage("该手机号已被注册,无法绑定,\n您可以使用它直接登录。")
.setRightClick("确定") {
}
.show()
}
override fun showNormalDialog() {
CommonDialog.create(this)
.setMessage("专家账号,请下载壹点灵专家版app喔")
.setRightClick("确定") {
.setMessage("专家账号,请下载壹点灵专家版app喔")
.setRightClick("确定") {
}
.show()
}
.show()
}
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
......
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