Sfoglia il codice sorgente

feat: READ_MEDIA_IMAGES

tongmengxiao 2 mesi fa
parent
commit
a809756964

+ 8 - 39
app/src/main/java/com/swago/app/SplashActivity.kt

@@ -39,45 +39,14 @@ class SplashActivity : AppCompatActivity() {
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
         setContentView(R.layout.activity_splash)
-        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE){
-            PermissionX.init(this@SplashActivity)
-                .permissions(
-                    Manifest.permission.READ_MEDIA_IMAGES,
-                    Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED
-                )
-                .request { allGranted, grantedList, deniedList ->
-                    if (allGranted) {
-                        splashVm.getApiDomain()
-                        splashVm.jumpToLoginLiveData.observe(this){
-                            if (!it){
-                                ARouter.getInstance().build(ARouteConstant.Login.login).navigation()
-                                finish()
-                            }
-                        }
-                    } else {
-                        ARouter.getInstance().build(ARouteConstant.Login.login).navigation()
-                        finish()
-                    }
-                }
-        }else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
-            PermissionX.init(this@SplashActivity)
-                .permissions(
-                    Manifest.permission.READ_MEDIA_IMAGES,
-                )
-                .request { allGranted, grantedList, deniedList ->
-                    if (allGranted) {
-                        splashVm.getApiDomain()
-                        splashVm.jumpToLoginLiveData.observe(this){
-                            if (!it){
-                                ARouter.getInstance().build(ARouteConstant.Login.login).navigation()
-                                finish()
-                            }
-                        }
-                    } else {
-                        ARouter.getInstance().build(ARouteConstant.Login.login).navigation()
-                        finish()
-                    }
-                }
+       if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
+           splashVm.getApiDomain()
+           splashVm.jumpToLoginLiveData.observe(this){
+               if (!it){
+                   ARouter.getInstance().build(ARouteConstant.Login.login).navigation()
+                   finish()
+               }
+           }
         }else {
             PermissionX.init(this@SplashActivity)
                 .permissions(

+ 8 - 11
baseswago/src/main/java/com/swago/baseswago/dialog/TodayTrafficDialog.kt

@@ -1,30 +1,22 @@
 package com.swago.baseswago.dialog
 
-import android.content.Intent
 import android.graphics.Color
 import android.os.Bundle
 import android.view.Gravity
-import android.view.View
-import android.view.View.OnClickListener
 import android.webkit.JavascriptInterface
 import android.webkit.WebViewClient
-import com.alibaba.android.arouter.launcher.ARouter
-import com.swago.baseswago.constant.ARouteConstant
-import com.swago.baseswago.databinding.DialogCloseAccountBinding
-import com.swago.baseswago.databinding.DialogInviteBindingBinding
 import com.swago.baseswago.databinding.DialogTodayTrafficBinding
-import com.swago.baseswago.dialog.BaseXDFragment
-import com.swago.baseswago.util.SpUtil
-import com.swago.baseswago.util.UserInfo
 
 class TodayTrafficDialog : BaseXDFragment<DialogTodayTrafficBinding>() {
+    private var showDialog:Boolean = true
     private val jsLoad by lazy {
         JSLoad()
     }
     init {
         setGravity(Gravity.CENTER)
-        setDimAmount(0.5f)
+        setDimAmount(0f)
         setCanCancel(false)
+        setHeightMatchParent()
     }
 
     companion object {
@@ -62,4 +54,9 @@ class TodayTrafficDialog : BaseXDFragment<DialogTodayTrafficBinding>() {
             dismissAllowingStateLoss()
         }
     }
+
+    override fun dismiss() {
+        super.dismiss()
+        showDialog = true
+    }
 }

+ 2 - 0
home/src/main/java/com/swago/home/HomeActivity.kt

@@ -162,6 +162,8 @@ class HomeActivity : BaseXActivity<ActivityHomeBinding>(), IPayCallback {
             weakActivity.get() ?: return@addOnCompleteListener
             if (it.isSuccessful){
                 homeVm.pushDeviceToken(it.result)
+                LogUtil.d("FirebaseMessaging","isSuccessful:" + it
+                    .result)
             }
         }
 

BIN
home/src/main/res/mipmap-xxhdpi/ic_traffic.png


+ 9 - 87
login/src/main/java/com/swago/login/LoginActivity.kt

@@ -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(

+ 1 - 1
room/src/main/java/com/swago/room/base/BaseComFragment.kt

@@ -58,7 +58,7 @@ import com.swago.room.databinding.FragmentBaseComBinding
 import com.swago.room.dialog.AudienceListDialog
 import com.swago.room.dialog.FanClubAnchorDialog
 import com.swago.room.dialog.FanClubForUserDialog
-import com.swago.room.dialog.GetRewardsDialog
+import com.swago.room.reward.GetRewardsDialog
 import com.swago.room.dialog.JoinFanClubDialog
 import com.swago.room.dialog.LevelUpDialog
 import com.swago.room.dialog.MessageListDialog

+ 1 - 1
room/src/main/java/com/swago/room/dialog/GetRewardsDialog.kt → room/src/main/java/com/swago/room/reward/GetRewardsDialog.kt

@@ -1,4 +1,4 @@
-package com.swago.room.dialog
+package com.swago.room.reward
 
 import android.os.Bundle
 import android.view.Gravity

+ 1 - 0
room/src/main/res/layout/view_rewards.xml

@@ -35,6 +35,7 @@
         android:textSize="10dp"
         android:textColor="#fff"
         tools:text="0"
+        android:text="50"
         android:layout_marginEnd="@dimen/dp_4"
         android:gravity="center"
         android:drawableLeft="@mipmap/ic_coin_store"