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
fe1d4dad
Commit
fe1d4dad
authored
Feb 03, 2021
by
刘鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.user-api加入loginByOneKeyLogin方法,用于优先调用一键登录
2.user模块OneKeyLoginHelp,加入一键登录全屏OR dialog展示方法
parent
5034c93d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
141 additions
and
97 deletions
+141
-97
MainActivity.kt
app/src/main/java/com/ydl/component/MainActivity.kt
+1
-1
config.gradle
config.gradle
+6
-6
MineFragment.java
m-user/src/main/java/com/yidianling/user/mine/MineFragment.java
+15
-49
UserServiceImp.kt
m-user/src/main/java/com/yidianling/user/modular_service/UserServiceImp.kt
+14
-2
SmsLoginActivity.kt
m-user/src/main/java/com/yidianling/user/ui/SmsLoginActivity.kt
+0
-18
OneKeyLoginHelp.kt
m-user/src/main/java/com/yidianling/user/ui/login/OneKeyLoginHelp.kt
+97
-21
IUserService.kt
m-user/src/main/modular_api/com/yidianling/user/api/service/IUserService.kt
+8
-0
No files found.
app/src/main/java/com/ydl/component/MainActivity.kt
View file @
fe1d4dad
...
...
@@ -97,7 +97,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
// .withBoolean("bind_phone", false)
// .withBoolean("isFromGuide", true)
// .navigation()
OneKeyLoginHelp
.
getLoginToken
(
false
)
OneKeyLoginHelp
.
startLogin
(
this
,
false
)
}
bt_to_consultant
.
setOnClickListener
{
// ARouter.getInstance()
...
...
config.gradle
View file @
fe1d4dad
...
...
@@ -8,8 +8,8 @@ ext {
"m-confide"
:
"0.0.48.91"
,
"m-consultant"
:
"0.0.59.64"
,
"m-fm"
:
"0.0.30.00"
,
"m-user"
:
"0.0.60.
87
"
,
"m-home"
:
"0.0.22.5
1
"
,
"m-user"
:
"0.0.60.
91
"
,
"m-home"
:
"0.0.22.5
2
"
,
"m-im"
:
"0.0.18.33"
,
"m-dynamic"
:
"0.0.7.13"
,
"m-article"
:
"0.0.0.6"
,
...
...
@@ -26,7 +26,7 @@ ext {
"m-fm-api"
:
"0.0.3"
,
"m-muse-api"
:
"0.0.1"
,
"m-tests-api"
:
"0.0.2"
,
"m-user-api"
:
"0.0.10.1
5
"
,
"m-user-api"
:
"0.0.10.1
6
"
,
"m-home-api"
:
"0.0.4.1"
,
"m-im-api"
:
"0.0.12.21"
,
"m-dynamic-api"
:
"0.0.3.7"
,
...
...
@@ -91,8 +91,8 @@ ext {
"m-confide"
:
"0.0.48.91"
,
"m-consultant"
:
"0.0.59.44"
,
"m-fm"
:
"0.0.23.5"
,
"m-user"
:
"0.0.60.
86
"
,
"m-home"
:
"0.0.22.5
1
"
,
"m-user"
:
"0.0.60.
90
"
,
"m-home"
:
"0.0.22.5
2
"
,
"m-im"
:
"0.0.3.15"
,
"m-dynamic"
:
"0.0.1.7"
,
...
...
@@ -107,7 +107,7 @@ ext {
"m-fm-api"
:
"0.0.3"
,
"m-muse-api"
:
"0.0.1"
,
"m-tests-api"
:
"0.0.2"
,
"m-user-api"
:
"0.0.10.1
5
"
,
"m-user-api"
:
"0.0.10.1
6
"
,
"m-home-api"
:
"0.0.4.1"
,
"m-im-api"
:
"0.0.12.21"
,
"m-dynamic-api"
:
"0.0.3.7"
,
...
...
m-user/src/main/java/com/yidianling/user/mine/MineFragment.java
View file @
fe1d4dad
...
...
@@ -356,34 +356,13 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
}
}
/**
* 请求获取设备权限并跳转到登录
*/
@SuppressLint
(
"CheckResult"
)
private
void
startLogin
()
{
new
RxPermissions
(
getActivity
())
.
request
(
Manifest
.
permission
.
READ_PHONE_STATE
)
.
subscribe
(
permission
->
{
if
(
OneKeyLoginHelp
.
INSTANCE
.
getMIsOpenOneKeyLogin
())
{
OneKeyLoginHelp
.
INSTANCE
.
getLoginToken
(
true
);
}
else
{
RegisterAndLoginActivity
.
Companion
.
start
(
getActivity
());
}
});
}
@Override
public
void
onClick
(
View
v
)
{
int
id
=
v
.
getId
();
//切换环境逻辑按钮
if
(
id
==
R
.
id
.
text_userName
||
id
==
R
.
id
.
cv_duration
)
{
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
}
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
);
}
else
if
(
id
==
R
.
id
.
iv_edit_info
)
{
//修改资料
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
))
{
return
;
}
if
(
userInfoData
!=
null
)
{
...
...
@@ -394,8 +373,7 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
if
(
Utils
.
isFastClick
())
{
return
;
}
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
))
{
return
;
}
if
(
userInfoData
!=
null
)
{
...
...
@@ -403,37 +381,32 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
startActivity
(
intentuser
);
}
}
else
if
(
id
==
R
.
id
.
ll_account
)
{
//账户余额
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
))
{
return
;
}
startActivity
(
new
Intent
(
getActivity
(),
AccountHistoryActivity
.
class
));
}
else
if
(
id
==
R
.
id
.
ll_red_packet
)
{
//我的红包
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
))
{
return
;
}
clearCouponStatus
();
ModularServiceManager
.
INSTANCE
.
provide
(
IAppService
.
class
).
myRedPockIntent
(
getActivity
());
}
else
if
(
id
==
R
.
id
.
ll_fans
)
{
//粉丝
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
))
{
return
;
}
H5Params
h5Params
=
new
H5Params
(
HttpConfig
.
Companion
.
getH5_URL
()
+
"mine/fans-list"
,
null
);
NewH5Activity
.
start
(
getActivity
(),
h5Params
);
}
else
if
(
id
==
R
.
id
.
ll_guanzhu
)
{
//我关注的
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
))
{
return
;
}
H5Params
h5Params1
=
new
H5Params
(
HttpConfig
.
Companion
.
getH5_URL
()
+
"mine/follow-per"
,
null
);
NewH5Activity
.
start
(
getActivity
(),
h5Params1
);
}
else
if
(
id
==
R
.
id
.
ll_my_trends
)
{
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
))
{
return
;
}
BuryPointUtils
.
getInstance
().
createMap
()
...
...
@@ -446,22 +419,19 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
}
}
else
if
(
id
==
R
.
id
.
jtv_account_setting
)
{
//账号设置
//点击消息 未登录请先登录
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
))
{
return
;
}
startActivity
(
new
Intent
(
getActivity
(),
AccountSettingActivity
.
class
));
}
else
if
(
id
==
R
.
id
.
jtv_account_privacy
)
{
// 未登录请先登录
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
))
{
return
;
}
UserHelper
.
INSTANCE
.
getUsetSetting
().
setMeSafePrivateIsClick
(
true
);
jtv_account_privacy
.
setLeftRedDotVisibility
(
View
.
GONE
);
startActivity
(
new
Intent
(
getActivity
(),
PrivacyActivity
.
class
));
}
else
if
(
id
==
R
.
id
.
ll_trade_order
)
{
//预约
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
))
{
return
;
}
BuryPointUtils
.
getInstance
().
createMap
()
...
...
@@ -471,14 +441,12 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
h5Params3
.
setShowMenu
(
true
);
NewH5Activity
.
start
(
getActivity
(),
h5Params3
);
}
else
if
(
id
==
R
.
id
.
ll_my_courses
)
{
//我的课程
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
))
{
return
;
}
ModularServiceManager
.
INSTANCE
.
provide
(
ICourseService
.
class
).
startMyCourseActivity
(
getActivity
());
}
else
if
(
id
==
R
.
id
.
ll_call_order
)
{
//倾诉
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
))
{
return
;
}
BuryPointUtils
.
getInstance
().
createMap
()
...
...
@@ -501,8 +469,7 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
NewH5Activity
.
start
(
getActivity
(),
h5Paramzhuan
);
}
}
else
if
(
id
==
R
.
id
.
ll_my_test_log
)
{
//测试记录
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
))
{
return
;
}
BuryPointUtils
.
getInstance
().
createMap
()
...
...
@@ -518,8 +485,7 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
H5Params
params1
=
new
H5Params
(
"https://m.yidianling.com/about"
,
"网站介绍"
);
NewH5Activity
.
start
(
getActivity
(),
params1
);
}
else
if
(
id
==
R
.
id
.
ll_reward
)
{
if
(!
UserHelper
.
INSTANCE
.
isLogin
())
{
startLogin
();
if
(!
OneKeyLoginHelp
.
INSTANCE
.
startLoginByStatus
(
getActivity
(),
true
))
{
return
;
}
H5Params
h5Param
=
new
H5Params
(
HttpConfig
.
Companion
.
getH5_URL
()
+
"course/invite-record"
,
null
);
...
...
m-user/src/main/java/com/yidianling/user/modular_service/UserServiceImp.kt
View file @
fe1d4dad
...
...
@@ -14,7 +14,10 @@ import com.ydl.ydlcommon.data.http.ThrowableConsumer
import
com.ydl.ydlcommon.utils.ActivityManager
import
com.ydl.ydlcommon.utils.ApkUpdateDialog
import
com.yidianling.common.tools.RxAppTool
import
com.yidianling.user.*
import
com.yidianling.user.LoginHelper
import
com.yidianling.user.LoginUtils
import
com.yidianling.user.UserConstants
import
com.yidianling.user.UserHelper
import
com.yidianling.user.api.bean.UserResponseBean
import
com.yidianling.user.api.bean.UserSettingBean
import
com.yidianling.user.api.listener.SecretDataListener
...
...
@@ -32,13 +35,13 @@ import com.yidianling.user.safePrivate.HandUnlockCheckActivity
import
com.yidianling.user.safePrivate.PrivacyActivity
import
com.yidianling.user.ui.InputPhoneActivity
import
com.yidianling.user.ui.LoginActivity
import
com.yidianling.user.ui.login.OneKeyLoginHelp
import
com.yidianling.user.ui.login.RegisterAndLoginActivity
import
com.yidianling.user.ui.login.SecretActivity
import
com.yidianling.user.widget.utils.PrivacyDialogUtils
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.functions.Consumer
import
io.reactivex.schedulers.Schedulers
import
java.lang.Exception
/**
* author : Zhangwenchao
...
...
@@ -310,4 +313,12 @@ public class UserServiceImp : IUserService {
override
fun
startFromGuide
(
context
:
Context
,
isBindPhone
:
Boolean
,
isFromGudile
:
Boolean
)
{
RegisterAndLoginActivity
.
startFromGuide
(
context
,
isBindPhone
,
isFromGudile
)
}
/**
* 调用优先使用一键登录,并返回调用时的登录状态,
* @param isOpenDialog true:一键登录使用弹窗展示 false:一键登录使用全屏模式
* @return true:已登录,不触发登录跳转,false:未登录,优先一键登录
* */
override
fun
loginByOneKeyLogin
(
context
:
Context
,
isOpenDialog
:
Boolean
):
Boolean
{
return
OneKeyLoginHelp
.
startLoginByStatus
(
context
,
isOpenDialog
)
}
}
\ No newline at end of file
m-user/src/main/java/com/yidianling/user/ui/SmsLoginActivity.kt
View file @
fe1d4dad
...
...
@@ -262,21 +262,4 @@ class SmsLoginActivity : BaseActivity() {
}
}
/**
* CPA(CPS)推广渠道统计
* 获取安装携带的参数
* 注:1、不要在 init 之后,紧接着调用 getInstall,防止网络等问题导致 getInstall 超时,从而获取数据失败
*/
private
fun
getOpenInstallKey
()
{
OpenInstall
.
getInstall
(
object
:
AppInstallAdapter
()
{
override
fun
onInstall
(
appData
:
AppData
)
{
// 获取渠道数据 转换值同步IOS "AppData{channel='" + this.channel + '\'' + ", data='" + this.data + '\'' + '}'
openInstallKey
=
appData
.
toString
().
replace
(
"AppData"
,
""
).
replace
(
"channel"
,
"channelCode"
)
LogUtil
.
e
(
"openInstallKey-openInstallKey:"
+
openInstallKey
)
}
})
}
}
\ No newline at end of file
m-user/src/main/java/com/yidianling/user/ui/login/OneKeyLoginHelp.kt
View file @
fe1d4dad
package
com.yidianling.user.ui.login
import
android.Manifest
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.content.Context
import
android.content.pm.ActivityInfo
import
android.graphics.Color
import
android.text.TextUtils
...
...
@@ -15,6 +19,7 @@ import com.fm.openinstall.model.AppData
import
com.meituan.android.walle.WalleChannelReader
import
com.mobile.auth.gatewayauth.*
import
com.mobile.auth.gatewayauth.model.TokenRet
import
com.tbruyelle.rxpermissions2.RxPermissions
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.utils.JPushUtils
...
...
@@ -28,6 +33,7 @@ import com.yidianling.common.tools.RxImageTool
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.user.LoginUtils
import
com.yidianling.user.StatusUtils
import
com.yidianling.user.UserHelper
import
com.yidianling.user.api.bean.UserResponseBean
import
com.yidianling.user.constants.UserBIConstants
import
com.yidianling.user.http.LoginApiRequestUtil
...
...
@@ -79,8 +85,11 @@ object OneKeyLoginHelp {
// 控件点击事件
it
.
setUIClickListener
{
code
,
context
,
json
->
if
(
code
==
"700002"
){
// 表示一键登录按钮点击事件
ActionCountUtils
.
countUid
(
UserBIConstants
.
PART_ID_LOGIN_MAIN
,
UserBIConstants
.
ACTION_TYPE_ONE_KEY_CLICK
)
if
(
code
==
"700002"
)
{
// 表示一键登录按钮点击事件
ActionCountUtils
.
countUid
(
UserBIConstants
.
PART_ID_LOGIN_MAIN
,
UserBIConstants
.
ACTION_TYPE_ONE_KEY_CLICK
)
}
}
}
...
...
@@ -88,7 +97,7 @@ object OneKeyLoginHelp {
val
channel
=
WalleChannelReader
.
getChannel
(
activity
.
applicationContext
)
checkBoxHidden
=
!(
channel
==
"huawei"
||
channel
==
"vivo"
)
LogUtil
.
e
(
"checkBoxHidde:$checkBoxHidden"
)
if
(!
checkBoxHidden
){
if
(!
checkBoxHidden
)
{
mPrivacyBeforeText
=
"同意"
}
getOpenInstallKey
()
...
...
@@ -119,26 +128,27 @@ object OneKeyLoginHelp {
* 打开登录界面
*
*/
fun
toLoginActivity
()
{
if
(
mOpenPageIsSuccess
){
private
fun
toLoginActivity
()
{
if
(
mOpenPageIsSuccess
)
{
RegisterAndLoginActivity
.
start
(
mActivity
,
isFromOneKey
=
true
,
isFromGuide
=
false
)
}
else
{
}
else
{
RegisterAndLoginActivity
.
start
(
mActivity
,
false
,
mIsFromGuide
)
}
}
/**
* 根据是否开启一键登录开关,跳转对应的登录页面
*
*
请使用新的方法 [startLogin]
*/
fun
toLoginActivity
(
isOpenDialog
:
Boolean
){
if
(
mIsOpenOneKeyLogin
){
@Deprecated
(
"mActivity有销毁的可能"
)
fun
toLoginActivity
(
isOpenDialog
:
Boolean
)
{
if
(
mIsOpenOneKeyLogin
)
{
getLoginToken
(
isOpenDialog
)
}
else
{
}
else
{
// 一键登录页面打开成功
if
(
mOpenPageIsSuccess
){
if
(
mOpenPageIsSuccess
)
{
RegisterAndLoginActivity
.
start
(
mActivity
)
}
else
{
}
else
{
RegisterAndLoginActivity
.
start
(
mActivity
,
isFromOneKey
=
false
,
isFromGuide
=
true
)
}
}
...
...
@@ -147,7 +157,7 @@ object OneKeyLoginHelp {
/**
* 退出一键登录界面
*/
fun
quitLoginPage
(){
fun
quitLoginPage
()
{
mPhoneNumberAuthHelper
?.
quitLoginPage
()
}
...
...
@@ -168,6 +178,8 @@ object OneKeyLoginHelp {
* 拉起一键登录界面
*
* @param isOpenDialog 是否是弹窗
*
* 注:不建议直接调用,mActivity有销毁风险,请调用[startLogin]或者[startLoginByStatus]
*/
fun
getLoginToken
(
isOpenDialog
:
Boolean
)
{
mOpenPageIsSuccess
=
false
...
...
@@ -229,8 +241,16 @@ object OneKeyLoginHelp {
)
// 自定义切换号码按钮
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
))
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
)
...
...
@@ -390,12 +410,19 @@ object OneKeyLoginHelp {
ResultCode
.
CODE_START_AUTHPAGE_SUCCESS
->
{
// 唤起一键登录页面成功
LogUtil
.
e
(
"唤起授权页成功:$s"
)
mOpenPageIsSuccess
=
true
if
(
mIsFromGuide
){
if
(
mIsFromGuide
)
{
mActivity
.
finish
()
}
}
ResultCode
.
CODE_SUCCESS
->
{
// 获取token成功
val
param
=
PhoneLoginAutoParam
(
tokenRet
.
token
,
JPushUtils
.
getRegistrationID
(),
2
,
2
,
""
,
RxAppTool
.
getAppVersionName
(
BaseApp
.
Companion
.
getApp
()))
val
param
=
PhoneLoginAutoParam
(
tokenRet
.
token
,
JPushUtils
.
getRegistrationID
(),
2
,
2
,
""
,
RxAppTool
.
getAppVersionName
(
BaseApp
.
Companion
.
getApp
())
)
LoginApiRequestUtil
.
autoLogin
(
param
)
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
...
...
@@ -416,9 +443,13 @@ object OneKeyLoginHelp {
openInstallKey
)
}
else
{
ActionCountUtils
.
countUid
(
UserBIConstants
.
POSITION_LOGIN_SUCCESS_CLICK
,
it
.
data
.
uid
!!
,
UserBIConstants
.
ACTION_TYPE_ONE_KEY_CLICK
)
ActionCountUtils
.
countUid
(
UserBIConstants
.
POSITION_LOGIN_SUCCESS_CLICK
,
it
.
data
.
uid
!!
,
UserBIConstants
.
ACTION_TYPE_ONE_KEY_CLICK
)
}
mPhoneNumberAuthHelper
?.
let
{
helper
->
mPhoneNumberAuthHelper
?.
let
{
helper
->
helper
.
hideLoginLoading
()
helper
.
quitLoginPage
()
helper
.
setAuthListener
(
null
)
...
...
@@ -427,7 +458,7 @@ object OneKeyLoginHelp {
if
(
mIsFromGuide
)
{
LoginUtils
.
loginSuccessOperate
(
mActivity
)
}
}
else
{
}
else
{
ToastUtil
.
toastShort
(
it
.
msg
)
mPhoneNumberAuthHelper
?.
hideLoginLoading
()
}
...
...
@@ -506,6 +537,7 @@ object OneKeyLoginHelp {
LogHelper
.
getInstance
().
writeLogSync
(
"登录成功"
)
LoginUtils
.
onLogin
(
userResponse
)
}
/**
* CPA(CPS)推广渠道统计
* 获取安装携带的参数
...
...
@@ -515,8 +547,52 @@ object OneKeyLoginHelp {
OpenInstall
.
getInstall
(
object
:
AppInstallAdapter
()
{
override
fun
onInstall
(
appData
:
AppData
)
{
// 获取渠道数据 转换值同步IOS "AppData{channel='" + this.channel + '\'' + ", data='" + this.data + '\'' + '}'
openInstallKey
=
appData
.
toString
().
replace
(
"AppData"
,
""
).
replace
(
"channel"
,
"channelCode"
)
openInstallKey
=
appData
.
toString
().
replace
(
"AppData"
,
""
).
replace
(
"channel"
,
"channelCode"
)
}
})
}
/**
* @param isOpenDialog true: 使用弹窗展示一键登录
* false: 使用全页面展示一键登录
* @return true:登录。false:未登录
* */
fun
startLoginByStatus
(
context
:
Context
,
isOpenDialog
:
Boolean
):
Boolean
{
if
(!
UserHelper
.
isLogin
())
{
if
(
this
::
mActivity
.
isInitialized
)
{
//如果mActivity有初始化,代表项目使用了一键登录
startLogin
(
context
as
Activity
,
isOpenDialog
)
}
else
{
//如果mActivity未初始化,使用正常登录
RegisterAndLoginActivity
.
start
(
context
)
}
}
return
UserHelper
.
isLogin
()
}
/**
* @param isOpenDialog true 使用弹窗
* */
@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
)
}
else
{
RegisterAndLoginActivity
.
start
(
context
,
isFromOneKey
=
false
,
isFromGuide
=
true
)
}
}
}
}
}
m-user/src/main/modular_api/com/yidianling/user/api/service/IUserService.kt
View file @
fe1d4dad
...
...
@@ -107,4 +107,11 @@ interface IUserService : IProvider {
fun
getSecretDataApi
(
activity
:
Activity
,
listener
:
SecretDataListener
)
fun
startFromGuide
(
context
:
Context
,
isBindPhone
:
Boolean
,
isFromGudile
:
Boolean
)
/**
* 调用优先使用一键登录,并返回调用时的登录状态,
* @param isOpenDialog true:一键登录使用弹窗展示 false:一键登录使用全屏模式
* @return true:已登录,不触发登录跳转,false:未登录,优先一键登录
* */
fun
loginByOneKeyLogin
(
context
:
Context
,
isOpenDialog
:
Boolean
)
:
Boolean
}
\ No newline at end of file
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