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
dc80e621
Commit
dc80e621
authored
Jan 19, 2021
by
YKai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:一键登录逻辑优化
parent
705ea4d5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
13 deletions
+41
-13
config.gradle
config.gradle
+2
-2
LoginUtils.kt
m-user/src/main/java/com/yidianling/user/LoginUtils.kt
+2
-0
OneKeyLoginHelp.kt
m-user/src/main/java/com/yidianling/user/ui/login/OneKeyLoginHelp.kt
+27
-9
RegisterAndLoginActivity.kt
m-user/src/main/java/com/yidianling/user/ui/login/RegisterAndLoginActivity.kt
+10
-2
No files found.
config.gradle
View file @
dc80e621
...
...
@@ -8,7 +8,7 @@ ext {
"m-confide"
:
"0.0.48.91"
,
"m-consultant"
:
"0.0.59.40"
,
"m-fm"
:
"0.0.30.00"
,
"m-user"
:
"0.0.60.7
0
"
,
"m-user"
:
"0.0.60.7
2
"
,
"m-home"
:
"0.0.22.51"
,
"m-im"
:
"0.0.18.30"
,
"m-dynamic"
:
"0.0.7.13"
,
...
...
@@ -91,7 +91,7 @@ ext {
"m-confide"
:
"0.0.48.91"
,
"m-consultant"
:
"0.0.51.16"
,
"m-fm"
:
"0.0.23.5"
,
"m-user"
:
"0.0.60.7
0
"
,
"m-user"
:
"0.0.60.7
1
"
,
"m-home"
:
"0.0.22.51"
,
"m-im"
:
"0.0.3.15"
,
"m-dynamic"
:
"0.0.1.7"
,
...
...
m-user/src/main/java/com/yidianling/user/LoginUtils.kt
View file @
dc80e621
...
...
@@ -101,6 +101,8 @@ object LoginUtils {
@JvmStatic
fun
loginSuccessOperate
(
activity
:
Activity
)
{
// 登录成功后,如果一键登录界面没有关闭,则关闭掉
OneKeyLoginHelp
.
quitLoginPage
()
val
size
=
ActivityManager
.
getActivitySize
()
if
(
size
<=
2
)
{
//当前stack只有两个页面,必然没有MainActivity
ActivityManager
.
finishAll
()
...
...
m-user/src/main/java/com/yidianling/user/ui/login/OneKeyLoginHelp.kt
View file @
dc80e621
...
...
@@ -214,7 +214,24 @@ object OneKeyLoginHelp {
.
setRootViewId
(
AuthRegisterViewConfig
.
RootViewId
.
ROOT_VIEW_ID_BODY
)
.
build
()
)
// 自定义切换号码按钮
val
switchLogin
=
TextView
(
mActivity
)
val
switchLoginLayoutParams
=
RelativeLayout
.
LayoutParams
(
RelativeLayout
.
LayoutParams
.
MATCH_PARENT
,
RelativeLayout
.
LayoutParams
.
WRAP_CONTENT
)
switchLoginLayoutParams
.
setMargins
(
RxImageTool
.
dp2px
(
40f
),
RxImageTool
.
dp2px
(
370f
),
RxImageTool
.
dp2px
(
40f
),
RxImageTool
.
dp2px
(
68f
))
switchLogin
.
text
=
"切换号码"
switchLogin
.
setTextColor
(
Color
.
parseColor
(
"#999999"
))
switchLogin
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_SP
,
15f
)
switchLogin
.
gravity
=
Gravity
.
CENTER
switchLogin
.
layoutParams
=
switchLoginLayoutParams
phoneNumberAuthHelper
.
addAuthRegistViewConfig
(
"switch_login"
,
AuthRegisterViewConfig
.
Builder
()
.
setView
(
switchLogin
)
.
setRootViewId
(
AuthRegisterViewConfig
.
RootViewId
.
ROOT_VIEW_ID_BODY
)
.
setCustomInterface
{
toLoginActivity
()
}
.
build
()
)
//自定义验证码登录按钮
val
otherLogin
=
TextView
(
mActivity
)
val
layoutParams
=
RelativeLayout
.
LayoutParams
(
...
...
@@ -278,10 +295,7 @@ object OneKeyLoginHelp {
.
setLogBtnTextSize
(
17
)
.
setLogBtnHeight
(
78
)
.
setLogBtnOffsetY
(
290
)
.
setSwitchAccText
(
"切换号码"
)
.
setSwitchAccTextSize
(
15
)
.
setSwitchAccTextColor
(
Color
.
parseColor
(
"#999999"
))
.
setSwitchOffsetY
(
370
)
.
setSwitchAccHidden
(
true
)
.
setAppPrivacyOne
(
appPrivacyOneTip
,
appPrivacyOne
)
.
setAppPrivacyTwo
(
"隐私协议"
,
appPrivacyTwo
)
.
setAppPrivacyColor
(
Color
.
parseColor
(
"#bfbfbf"
),
Color
.
parseColor
(
"#991da1f2"
))
...
...
@@ -364,6 +378,7 @@ object OneKeyLoginHelp {
LogUtil
.
e
(
"唤起授权页成功:$s"
)
if
(
mIsFromGuide
){
mActivity
.
finish
()
mIsFromGuide
=
false
}
}
ResultCode
.
CODE_SUCCESS
->
{
// 获取token成功
...
...
@@ -415,18 +430,21 @@ object OneKeyLoginHelp {
// 一键登录
when
(
tokenRet
.
code
)
{
ResultCode
.
CODE_ERROR_USER_CANCEL
->
{
// 用户主动取消一键登录
if
(
mIsFromGuide
){
// 如果是从引导页首次打开
ActivityManager
.
finishOtherActivity
(
mActivity
)
UserIn
.
mainIntent
(
mActivity
,
4
)
}
// 如果是从引导页首次打开
// if (mIsFromGuide){
// ActivityManager.finishOtherActivity(mActivity)
// UserIn.mainIntent(mActivity, 4)
// }
}
else
->
{
// 其它失败原因
mPhoneNumberAuthHelper
?.
hideLoginLoading
()
// 跳转到原生登录界面
mActivity
.
runOnUiThread
{
toLoginActivity
()
}
}
}
}
mPhoneNumberAuthHelper
?.
setAuthListener
(
null
)
}
}
...
...
m-user/src/main/java/com/yidianling/user/ui/login/RegisterAndLoginActivity.kt
View file @
dc80e621
...
...
@@ -633,11 +633,19 @@ class RegisterAndLoginActivity : BaseMvpActivity<ILoginContract.View, ILoginCont
override
fun
onBackPressed
()
{
//当前stack只有一个activity,说明被挤掉线的
if
(
ActivityManager
.
getActivitySize
()
==
1
)
{
// if (ActivityManager.getActivitySize() == 1) {
// ActivityManager.finishOtherActivity(this)
// UserIn.mainIntent(this, 4)
// finish()
// } else {
// super.onBackPressed()
// }
// 如果从引导页面过来,点击返回键直接返回到主页
if
(
isFromGuide
){
ActivityManager
.
finishOtherActivity
(
this
)
UserIn
.
mainIntent
(
this
,
4
)
finish
()
}
else
{
}
else
{
super
.
onBackPressed
()
}
}
...
...
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