tongmengxiao 4 місяців тому
батько
коміт
bca6519c1e

+ 1 - 2
app/src/main/java/com/swago/app/SplashActivity.kt

@@ -178,8 +178,7 @@ class SplashActivity : AppCompatActivity() {
 
     override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
         super.onActivityResult(requestCode, resultCode, data)
-        if (requestCode == 1001){
-            isRunning = false
+        if (resultCode == RESULT_OK && requestCode == 1001){
             splashVm.loginByAuto()
         }
     }

+ 1 - 0
baseswago/src/main/java/com/swago/baseswago/model/home/OfficialSumModel.kt

@@ -8,5 +8,6 @@ data class OfficialSumModel(
     val message_content:String,
     val unread_total:String,
     val message_time:String,
+    val userId:String,
     val unreadTotal:Long
 )

BIN
baseswago/src/main/res/mipmap-xxhdpi/icon_living.png


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

@@ -136,11 +136,16 @@ class HomeActivity : BaseXActivity<ActivityHomeBinding>(), IPayCallback {
         conversationListener = object : V2TIMConversationListener(){
             override fun onTotalUnreadMessageCountChanged(totalUnreadCount: Long) {
                 super.onTotalUnreadMessageCountChanged(totalUnreadCount)
+                val systemCount = SpUtil.readString("systemCount")
+                if (!systemCount.isNullOrEmpty()){
+                    unreadMessageVm.systemMessage = systemCount.toLong()
+                }
                 unreadMessageVm.setTotalUnreadCount(totalUnreadCount)
             }
         }
         IMUtil.updateUnreadMessageCount(conversationListener!!)
         homeVm.systemMessageFun = {
+            SpUtil.putString("systemCount" , it.unreadTotal.toString())
             unreadMessageVm.setSystemUnreadCount(it.unreadTotal)
         }
     }

+ 5 - 1
home/src/main/java/com/swago/home/innerhome/HomeVm.kt

@@ -51,7 +51,11 @@ class HomeVm(application: Application) : BaseViewModel(application) {
             ImConstant.system_message
         ){
             it.data?.let {model ->
-                systemMessageFun?.invoke(model)
+                UserInfo.getUserInfo()?.let { userInfo ->
+                    if (model.userId == userInfo.id){
+                        systemMessageFun?.invoke(model)
+                    }
+                }
             }
         }
     }

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

@@ -10,6 +10,7 @@ import com.swago.baseswago.model.UnreadMessageVm
 import com.swago.baseswago.model.ViewModelProviderUtil
 import com.swago.baseswago.model.home.OfficialMsgModel
 import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.SpUtil
 import com.swago.home.R
 import com.swago.home.databinding.ActivityOfficialMessageBinding
 
@@ -50,5 +51,6 @@ class OfficialMessageActivity : BaseListActivity<ActivityOfficialMessageBinding,
         }
         unreadMessageVm = ViewModelProviderUtil.getUnreadMessageViewModel(application)
         unreadMessageVm.setSystemUnreadCount(0)
+        SpUtil.putString("systemCount" , "0")
     }
 }