Commit fe1d4dad by 刘鹏

1.user-api加入loginByOneKeyLogin方法,用于优先调用一键登录

2.user模块OneKeyLoginHelp,加入一键登录全屏OR dialog展示方法
parent 5034c93d
......@@ -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()
......
......@@ -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.51",
"m-user" : "0.0.60.91",
"m-home" : "0.0.22.52",
"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.15",
"m-user-api" : "0.0.10.16",
"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.51",
"m-user" : "0.0.60.90",
"m-home" : "0.0.22.52",
"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.15",
"m-user-api" : "0.0.10.16",
"m-home-api" : "0.0.4.1",
"m-im-api" : "0.0.12.21",
"m-dynamic-api" : "0.0.3.7",
......
......@@ -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);
......
......@@ -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
......@@ -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
......@@ -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
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