Commit 72735bd1 by YKai

feat:代码优化

parent 6bbf1bf3
package com.yidianling.user.mine; package com.yidianling.user.mine;
import android.Manifest;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
...@@ -12,6 +13,7 @@ import android.widget.Button; ...@@ -12,6 +13,7 @@ import android.widget.Button;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.tbruyelle.rxpermissions2.RxPermissions;
import com.ydl.course.api.ICourseService; import com.ydl.course.api.ICourseService;
import com.ydl.webview.H5Params; import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity; import com.ydl.webview.NewH5Activity;
...@@ -354,16 +356,21 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR ...@@ -354,16 +356,21 @@ public class MineFragment extends BaseFragment implements SwipeRefreshLayout.OnR
} }
} }
/** /**
* 跳转到登录 * 请求获取设备权限并跳转到登录
*
*/ */
private void startLogin(){ @SuppressLint("CheckResult")
if (OneKeyLoginHelp.INSTANCE.getMIsOpenOneKeyLogin()) { private void startLogin() {
OneKeyLoginHelp.INSTANCE.getLoginToken(true); new RxPermissions(getActivity())
}else { .request(Manifest.permission.READ_PHONE_STATE)
RegisterAndLoginActivity.Companion.start(getActivity()); .subscribe(permission -> {
} if (OneKeyLoginHelp.INSTANCE.getMIsOpenOneKeyLogin()) {
OneKeyLoginHelp.INSTANCE.getLoginToken(true);
} else {
RegisterAndLoginActivity.Companion.start(getActivity());
}
});
} }
......
...@@ -84,7 +84,7 @@ object OneKeyLoginHelp { ...@@ -84,7 +84,7 @@ object OneKeyLoginHelp {
} }
} }
// 获取渠道 // 获取渠道
val channel = WalleChannelReader.getChannel(activity) val channel = WalleChannelReader.getChannel(activity.applicationContext)
checkBoxHidden = !(channel == "huawei" || channel == "vivo") checkBoxHidden = !(channel == "huawei" || channel == "vivo")
LogUtil.e("checkBoxHidde:$checkBoxHidden") LogUtil.e("checkBoxHidde:$checkBoxHidden")
if (!checkBoxHidden){ if (!checkBoxHidden){
......
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