Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
2adfbf1e
Commit
2adfbf1e
authored
Oct 17, 2020
by
YKai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:vivo渠道增加用户协议不默认勾选
parent
011b89c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
132 additions
and
71 deletions
+132
-71
config.gradle
config.gradle
+2
-2
RegisterAndLoginActivity.kt
m-user/src/main/java/com/yidianling/user/ui/login/RegisterAndLoginActivity.kt
+130
-69
No files found.
config.gradle
View file @
2adfbf1e
...
...
@@ -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.3
1
"
,
"m-user"
:
"0.0.60.3
3
"
,
"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.1
0
"
,
"m-user"
:
"0.0.41.1
2
"
,
"m-home"
:
"0.0.6.28"
,
"m-im"
:
"0.0.3.14"
,
"m-dynamic"
:
"0.0.1.7"
,
...
...
m-user/src/main/java/com/yidianling/user/ui/login/RegisterAndLoginActivity.kt
View file @
2adfbf1e
...
...
@@ -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
?)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment