|
@@ -58,31 +58,8 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
|
|
|
binding.clFaceBook.setOnClickListener(object : NoDoubleClickListener() {
|
|
|
override fun onClick() {
|
|
|
if (SwagoShareUtils.isInstall(this@LoginActivity,FACEBOOK)){
|
|
|
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE){
|
|
|
- PermissionX.init(this@LoginActivity)
|
|
|
- .permissions(
|
|
|
- Manifest.permission.READ_MEDIA_IMAGES,
|
|
|
- Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED
|
|
|
- )
|
|
|
- .request { allGranted, grantedList, deniedList ->
|
|
|
- if (allGranted) {
|
|
|
- FBLogin.login(this@LoginActivity)
|
|
|
- } else {
|
|
|
- FBLogin.login(this@LoginActivity)
|
|
|
- }
|
|
|
- }
|
|
|
- }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
|
|
|
- PermissionX.init(this@LoginActivity)
|
|
|
- .permissions(
|
|
|
- Manifest.permission.READ_MEDIA_IMAGES
|
|
|
- )
|
|
|
- .request { allGranted, grantedList, deniedList ->
|
|
|
- if (allGranted) {
|
|
|
- FBLogin.login(this@LoginActivity)
|
|
|
- } else {
|
|
|
- FBLogin.login(this@LoginActivity)
|
|
|
- }
|
|
|
- }
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
|
|
|
+ FBLogin.login(this@LoginActivity)
|
|
|
}else{
|
|
|
PermissionX.init(this@LoginActivity)
|
|
|
.permissions(
|
|
@@ -105,31 +82,8 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
|
|
|
binding.clGoogle.setOnClickListener(object : NoDoubleClickListener() {
|
|
|
override fun onClick() {
|
|
|
if (SwagoShareUtils.isInstall(this@LoginActivity,GOOGLE)) {
|
|
|
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE){
|
|
|
- PermissionX.init(this@LoginActivity)
|
|
|
- .permissions(
|
|
|
- Manifest.permission.READ_MEDIA_IMAGES,
|
|
|
- Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED
|
|
|
- )
|
|
|
- .request { allGranted, grantedList, deniedList ->
|
|
|
- if (allGranted) {
|
|
|
- GoogleLogin.login(this@LoginActivity)
|
|
|
- } else {
|
|
|
- GoogleLogin.login(this@LoginActivity)
|
|
|
- }
|
|
|
- }
|
|
|
- }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
|
|
|
- PermissionX.init(this@LoginActivity)
|
|
|
- .permissions(
|
|
|
- Manifest.permission.READ_MEDIA_IMAGES
|
|
|
- )
|
|
|
- .request { allGranted, grantedList, deniedList ->
|
|
|
- if (allGranted) {
|
|
|
- GoogleLogin.login(this@LoginActivity)
|
|
|
- } else {
|
|
|
- GoogleLogin.login(this@LoginActivity)
|
|
|
- }
|
|
|
- }
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
|
|
|
+ GoogleLogin.login(this@LoginActivity)
|
|
|
}else{
|
|
|
PermissionX.init(this@LoginActivity)
|
|
|
.permissions(
|
|
@@ -189,43 +143,11 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
|
|
|
|
|
|
binding.ivAccountLogin.setOnClickListener(object:NoDoubleClickListener(){
|
|
|
override fun onClick() {
|
|
|
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE){
|
|
|
- PermissionX.init(this@LoginActivity)
|
|
|
- .permissions(
|
|
|
- Manifest.permission.READ_MEDIA_IMAGES,
|
|
|
- Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED
|
|
|
- )
|
|
|
- .request { allGranted, grantedList, deniedList ->
|
|
|
- if (allGranted) {
|
|
|
- SwagoLoading.showLoadingDialog(this@LoginActivity)
|
|
|
- val account = binding.etAccount.text.toString()
|
|
|
- val secret = binding.etSecret.text.toString()
|
|
|
- loginVm.loginByAccount(account, secret)
|
|
|
- } else {
|
|
|
- SwagoLoading.showLoadingDialog(this@LoginActivity)
|
|
|
- val account = binding.etAccount.text.toString()
|
|
|
- val secret = binding.etSecret.text.toString()
|
|
|
- loginVm.loginByAccount(account, secret)
|
|
|
- }
|
|
|
- }
|
|
|
- }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
|
|
|
- PermissionX.init(this@LoginActivity)
|
|
|
- .permissions(
|
|
|
- Manifest.permission.READ_MEDIA_IMAGES
|
|
|
- )
|
|
|
- .request { allGranted, grantedList, deniedList ->
|
|
|
- if (allGranted) {
|
|
|
- SwagoLoading.showLoadingDialog(this@LoginActivity)
|
|
|
- val account = binding.etAccount.text.toString()
|
|
|
- val secret = binding.etSecret.text.toString()
|
|
|
- loginVm.loginByAccount(account, secret)
|
|
|
- } else {
|
|
|
- SwagoLoading.showLoadingDialog(this@LoginActivity)
|
|
|
- val account = binding.etAccount.text.toString()
|
|
|
- val secret = binding.etSecret.text.toString()
|
|
|
- loginVm.loginByAccount(account, secret)
|
|
|
- }
|
|
|
- }
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
|
|
|
+ SwagoLoading.showLoadingDialog(this@LoginActivity)
|
|
|
+ val account = binding.etAccount.text.toString()
|
|
|
+ val secret = binding.etSecret.text.toString()
|
|
|
+ loginVm.loginByAccount(account, secret)
|
|
|
}else{
|
|
|
PermissionX.init(this@LoginActivity)
|
|
|
.permissions(
|