|
@@ -58,7 +58,25 @@ 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.TIRAMISU){
|
|
|
+ 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)
|
|
|
+ Toast.makeText(
|
|
|
+ this@LoginActivity,
|
|
|
+ getString(R.string.these_permissions_denied)+ "$deniedList",
|
|
|
+ Toast.LENGTH_LONG
|
|
|
+ ).show()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
|
|
|
PermissionX.init(this@LoginActivity)
|
|
|
.permissions(
|
|
|
Manifest.permission.READ_MEDIA_IMAGES
|
|
@@ -102,7 +120,25 @@ 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.TIRAMISU){
|
|
|
+ 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)
|
|
|
+ Toast.makeText(
|
|
|
+ this@LoginActivity,
|
|
|
+ getString(R.string.these_permissions_denied)+"$deniedList",
|
|
|
+ Toast.LENGTH_LONG
|
|
|
+ ).show()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
|
|
|
PermissionX.init(this@LoginActivity)
|
|
|
.permissions(
|
|
|
Manifest.permission.READ_MEDIA_IMAGES
|
|
@@ -183,7 +219,31 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
|
|
|
|
|
|
binding.ivAccountLogin.setOnClickListener(object:NoDoubleClickListener(){
|
|
|
override fun onClick() {
|
|
|
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
|
|
|
+ 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)
|
|
|
+ Toast.makeText(
|
|
|
+ this@LoginActivity,
|
|
|
+ getString(R.string.these_permissions_denied)+" $deniedList",
|
|
|
+ Toast.LENGTH_LONG
|
|
|
+ ).show()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
|
|
|
PermissionX.init(this@LoginActivity)
|
|
|
.permissions(
|
|
|
Manifest.permission.READ_MEDIA_IMAGES
|