Browse Source

feat: joinChannel log

tongmengxiao 3 months ago
parent
commit
d309a5d788

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

@@ -102,7 +102,7 @@ class SwagoApp : Application() {
             jsonObject.put("message","${ex.message}")
             jsonObject.put("detail", ex.stackTraceToString())
             if (!BuildConfig.DEBUG){
-                LogProducer.addLog(jsonObject, "error")
+                LogProducer.addLog(jsonObject.toString(), "error")
             }
         }
     }

+ 6 - 0
baseswago/src/main/java/com/swago/baseswago/agora/AgoraManager.kt

@@ -7,6 +7,7 @@ import com.swago.baseswago.R
 import com.swago.baseswago.baseroom.RoleType
 import com.swago.baseswago.constant.UrlConstant
 import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.LogProducer
 import com.swago.baseswago.util.LogUtil
 import io.agora.rtc.Constants.*
 import io.agora.rtc.IRtcEngineEventHandler
@@ -233,6 +234,11 @@ object AgoraManager {
 
     fun joinChannel(channelName: String, userId: Int, token: String = "", option: String = "") {
         val result = mRtcEngine?.joinChannel(token, channelName, option, userId)
+        result?.let {
+            if (it < 0){
+                LogProducer.addLog("result:${result}", "joinChannel")
+            }
+        }
     }
 
 

+ 1 - 1
baseswago/src/main/java/com/swago/baseswago/im/GroupMsgParser.kt

@@ -105,7 +105,7 @@ class GroupMsgParser : IGroupNewMsgParser {
         try {
             val resultString = String(result)
             val jsonObject = JSONObject(resultString)
-            LogProducer.addLog(jsonObject, "imCallback")
+            LogProducer.addLog(resultString, "imCallback")
             LogUtil.d("SwagoIM",resultString)
             var parameterizedTypeImpl: ParameterizedTypeImpl? = null
             when(jsonObject.getInt("type")){

+ 1 - 1
baseswago/src/main/java/com/swago/baseswago/util/LogProducer.kt

@@ -56,7 +56,7 @@ object LogProducer {
             config?.setAccessKeySecret(accessKeySecret)
         }
     }
-    fun addLog(customLog:JSONObject,type:String){
+    fun addLog(customLog:String,type:String){
         if (null == client) {
             return
         }

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

@@ -41,6 +41,7 @@ import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.GlobalScope
 import kotlinx.coroutines.launch
 import java.io.File
+import java.lang.ref.WeakReference
 
 /**
  *@date 2021/8/17 22:39
@@ -156,7 +157,9 @@ class HomeActivity : BaseXActivity<ActivityHomeBinding>(), IPayCallback {
             SpUtil.putString("systemCount" , it.unreadTotal.toString())
             unreadMessageVm.setSystemUnreadCount(it.unreadTotal)
         }
+        val weakActivity = WeakReference(this)
         FirebaseMessaging.getInstance().token.addOnCompleteListener {
+            weakActivity.get() ?: return@addOnCompleteListener
             if (it.isSuccessful){
                 homeVm.pushDeviceToken(it.result)
             }

+ 1 - 1
room/src/main/java/com/swago/room/anchor/AnchorRoomActivity.kt

@@ -509,7 +509,7 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
                 val jsonObject = JSONObject()
                 jsonObject.put("state","$state")
                 jsonObject.put("code", "$code")
-                LogProducer.addLog(jsonObject, "onChannelMediaRelayStateChanged")
+                LogProducer.addLog(jsonObject.toString(), "pkState")
             }
 
         }

+ 4 - 4
room/src/main/java/com/swago/room/reward/RewardView.kt

@@ -189,7 +189,7 @@ class RewardView : FrameLayout, IRoomActiveListener, RoomTimer.TimeTickListener
                 duration = "five"
                 nextCoins = model.coin.ten
                 nextTime = 10
-                binding?.tvCoins?.text = "+${model.coin.five}fiv"
+                binding?.tvCoins?.text = "+${model.coin.five}"
                 //领取奖励倒计时
                 if (totalTime >= 300){
                     startGetAnimation()
@@ -203,7 +203,7 @@ class RewardView : FrameLayout, IRoomActiveListener, RoomTimer.TimeTickListener
                 duration = "ten"
                 nextCoins = model.coin.fifteen
                 nextTime = 15
-                binding?.tvCoins?.text = "+${model.coin.ten}ten"
+                binding?.tvCoins?.text = "+${model.coin.ten}"
 
                 //领取奖励倒计时
                 if (totalTime >= 600){
@@ -218,7 +218,7 @@ class RewardView : FrameLayout, IRoomActiveListener, RoomTimer.TimeTickListener
                 duration = "fifteen"
                 nextCoins = model.coin.thirty
                 nextTime = 30
-                binding?.tvCoins?.text = "+${model.coin.fifteen}fif"
+                binding?.tvCoins?.text = "+${model.coin.fifteen}"
                 //领取奖励倒计时
                 if (totalTime >= 900){
                     startGetAnimation()
@@ -232,7 +232,7 @@ class RewardView : FrameLayout, IRoomActiveListener, RoomTimer.TimeTickListener
                 duration = "thirty"
                 nextCoins = 0
                 nextTime = 0
-                binding?.tvCoins?.text = "+${model.coin.thirty}thi"
+                binding?.tvCoins?.text = "+${model.coin.thirty}"
                 //领取奖励倒计时
                 if (totalTime >= 1800){
                     startGetAnimation()

+ 5 - 7
room/src/main/java/com/swago/room/user/UserRoomFragment.kt

@@ -50,11 +50,9 @@ import kotlinx.coroutines.launch
  *description:
  */
 class UserRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
-    private var isSameDate:Boolean = false
+
     override fun initOther() {
         super.initOther()
-        isSameDate = SpUtil.readString("last_visit_date") == TimeUtil.getCurrentDate()
-        SpUtil.putString("last_visit_date", TimeUtil.getCurrentDate())
         binding.ivBenefit.setOnClickListener(object : NoDoubleClickListener() {
             override fun onClick() {
                 openBenefitBagDialog()
@@ -252,7 +250,6 @@ class UserRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
                 openMessageListDialog()
             }
             openShareFun = {
-
                 if (PKStateManager.roomState==1){
                     openLianMaiListDialog()
                 }else{
@@ -282,9 +279,10 @@ class UserRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
                 AudioNoticeUserDialog.newInstance().show(childFragmentManager,"AudioNoticeUserDialog")
             }
         }
-        if (!isSameDate){
-            isSameDate = true
-            openBenefitBagDialog()
+        UserInfo.getUserInfo()?.let {
+            if (it.isFirst_charge){
+                openBenefitBagDialog()
+            }
         }
     }