1
0

23 Коммиты 33e2d4e31e ... 5a689c2234

Автор SHA1 Сообщение Дата
  tongmengxiao 5a689c2234 feat: pk失败提示 1 месяц назад
  tongmengxiao 5f9b47715e feat: 领取奖励倒计时结束上报 1 месяц назад
  tongmengxiao cb46784e41 feat: benefit 1 месяц назад
  tongmengxiao f70f0ea0b7 feat: 6117 2 месяцев назад
  tongmengxiao bc1243f609 feat: 本地化 2 месяцев назад
  tongmengxiao a809756964 feat: READ_MEDIA_IMAGES 2 месяцев назад
  tongmengxiao 8688ed8d2a feat: traffic url 2 месяцев назад
  tongmengxiao d309a5d788 feat: joinChannel log 2 месяцев назад
  tongmengxiao 5eb17ab1e2 feat: firebase 注册令牌 2 месяцев назад
  tongmengxiao 1d9ff105eb feat: reward dialog 2 месяцев назад
  tongmengxiao 13499c7ea3 feat: 转盘webview setting 2 месяцев назад
  tongmengxiao 7ab5f18310 feat: messing 2 месяцев назад
  tongmengxiao cd7b5de997 feat: 领取奖励 2 месяцев назад
  tongmengxiao 1a75f2a186 feat: 转盘dialog 2 месяцев назад
  tongmengxiao 52a8c8fdd2 feat: 领取奖励 2 месяцев назад
  tongmengxiao 1524cb8e6c feat: 任务中心 2 месяцев назад
  tongmengxiao fd620d975a feat: 奢华礼物 2 месяцев назад
  tongmengxiao a3b50adf1f feat: 推送 2 месяцев назад
  tongmengxiao 3c1913b088 feat: 直播间每日首充弹窗 2 месяцев назад
  tongmengxiao 2a716cc682 feat: audio gift svga 2 месяцев назад
  tongmengxiao af29e2beed feat: push pkJoinFail 2 месяцев назад
  tongmengxiao fa2ea8f34d feat: 6116(2) 2 месяцев назад
  tongmengxiao 14f5cccf2e fix: leak 2 месяцев назад
72 измененных файлов с 1396 добавлено и 367 удалено
  1. 2 2
      app/build.gradle
  2. 14 0
      app/src/main/AndroidManifest.xml
  3. 75 0
      app/src/main/java/com/swago/app/MyFirebaseMessagingService.kt
  4. 8 54
      app/src/main/java/com/swago/app/SplashActivity.kt
  5. 1 1
      app/src/main/java/com/swago/app/SwagoApp.kt
  6. 1 0
      baseswago/build.gradle
  7. 6 0
      baseswago/src/main/java/com/swago/baseswago/agora/AgoraManager.kt
  8. 1 0
      baseswago/src/main/java/com/swago/baseswago/baseroom/IRoomInfo.kt
  9. 9 1
      baseswago/src/main/java/com/swago/baseswago/constant/UrlConstant.kt
  10. 1 1
      baseswago/src/main/java/com/swago/baseswago/dialog/BaseStoreDFragment.kt
  11. 112 0
      baseswago/src/main/java/com/swago/baseswago/dialog/TodayTrafficDialog.kt
  12. 1 1
      baseswago/src/main/java/com/swago/baseswago/im/GroupMsgParser.kt
  13. 6 0
      baseswago/src/main/java/com/swago/baseswago/inter/HomeApi.kt
  14. 28 2
      baseswago/src/main/java/com/swago/baseswago/inter/RoomApi.kt
  15. 11 0
      baseswago/src/main/java/com/swago/baseswago/model/MomentModel.java
  16. 31 0
      baseswago/src/main/java/com/swago/baseswago/model/UserInfoModel.java
  17. 16 0
      baseswago/src/main/java/com/swago/baseswago/model/live/OnlineRewardsModel.kt
  18. 10 0
      baseswago/src/main/java/com/swago/baseswago/model/live/RoomModel.java
  19. 14 0
      baseswago/src/main/java/com/swago/baseswago/util/FileUtil.kt
  20. 1 1
      baseswago/src/main/java/com/swago/baseswago/util/LogProducer.kt
  21. 50 52
      baseswago/src/main/java/com/swago/baseswago/util/SwagoInfo.kt
  22. 6 0
      baseswago/src/main/java/com/swago/baseswago/util/TimeUtil.kt
  23. 28 0
      baseswago/src/main/res/layout/dialog_today_traffic.xml
  24. 0 0
      baseswago/src/main/res/mipmap-xxhdpi/ic_coin_store.png
  25. BIN
      baseswago/src/main/res/mipmap-xxhdpi/icon_pk.png
  26. BIN
      baseswago/src/main/res/mipmap-xxhdpi/icon_rewards.png
  27. 8 0
      baseswago/src/main/res/values-ar/strings.xml
  28. 10 2
      baseswago/src/main/res/values-in/strings.xml
  29. 9 1
      baseswago/src/main/res/values-ms/strings.xml
  30. 8 0
      baseswago/src/main/res/values-zh/strings.xml
  31. 8 0
      baseswago/src/main/res/values/strings.xml
  32. 13 0
      home/src/main/java/com/swago/home/HomeActivity.kt
  33. 26 2
      home/src/main/java/com/swago/home/HomeFragment.kt
  34. 3 1
      home/src/main/java/com/swago/home/MessageFragment.kt
  35. 12 1
      home/src/main/java/com/swago/home/MineFragment.kt
  36. 5 0
      home/src/main/java/com/swago/home/innerhome/HomeAdapter.kt
  37. 7 0
      home/src/main/java/com/swago/home/innerhome/HomeVm.kt
  38. 9 1
      home/src/main/res/layout/fragment_mine.xml
  39. 10 0
      home/src/main/res/layout/item_home.xml
  40. BIN
      home/src/main/res/mipmap-xxhdpi/ic_traffic.png
  41. 9 132
      login/src/main/java/com/swago/login/LoginActivity.kt
  42. 16 2
      room/src/main/java/com/swago/room/anchor/AnchorRoomActivity.kt
  43. 2 1
      room/src/main/java/com/swago/room/anchor/AnchorRoomFragment.kt
  44. 47 1
      room/src/main/java/com/swago/room/base/BaseComFragment.kt
  45. 4 0
      room/src/main/java/com/swago/room/bean/UserRoomModel.kt
  46. 11 2
      room/src/main/java/com/swago/room/dialog/FooterMoreDialog.kt
  47. 23 1
      room/src/main/java/com/swago/room/gift/GiftDialog.kt
  48. 3 1
      room/src/main/java/com/swago/room/manager/JoinRoomManager.kt
  49. 3 1
      room/src/main/java/com/swago/room/piaotiao/WaftView.kt
  50. 13 2
      room/src/main/java/com/swago/room/pk/PkVm.kt
  51. 53 0
      room/src/main/java/com/swago/room/reward/GetRewardsDialog.kt
  52. 262 0
      room/src/main/java/com/swago/room/reward/RewardView.kt
  53. 57 18
      room/src/main/java/com/swago/room/user/UserRoomFragment.kt
  54. 3 1
      room/src/main/java/com/swago/room/vm/MsgVm.kt
  55. 52 2
      room/src/main/java/com/swago/room/vm/RoomVm.kt
  56. 1 1
      room/src/main/java/com/swago/room/widget/ComHeaderView.kt
  57. 15 9
      room/src/main/java/com/swago/room/widget/UserFooterView.kt
  58. 5 0
      room/src/main/res/drawable/shape_b131f6_12.xml
  59. 102 0
      room/src/main/res/layout/dialog_get_rewards.xml
  60. 16 4
      room/src/main/res/layout/fragment_base_com.xml
  61. 24 12
      room/src/main/res/layout/layout_user_footer_view.xml
  62. 50 0
      room/src/main/res/layout/view_rewards.xml
  63. BIN
      room/src/main/res/mipmap-xxhdpi/bg_dialog_rewards.png
  64. BIN
      room/src/main/res/mipmap-xxhdpi/bg_get_reward.png
  65. BIN
      room/src/main/res/mipmap-xxhdpi/bg_rewards_buttom.png
  66. BIN
      room/src/main/res/mipmap-xxhdpi/bg_time_reward.png
  67. BIN
      room/src/main/res/mipmap-xxhdpi/icon_mandate.png
  68. 53 36
      user/src/main/java/com/swago/user/EditInfoActivity.kt
  69. 1 1
      user/src/main/java/com/swago/user/SettingActivity.kt
  70. 1 6
      user/src/main/java/com/swago/user/store/StoreBuyDialog.kt
  71. 1 1
      user/src/main/java/com/swago/user/task/TaskActivity.kt
  72. 9 10
      user/src/main/res/layout/item_task.xml

+ 2 - 2
app/build.gradle

@@ -15,8 +15,8 @@ android {
         applicationId "com.swago.app"
         minSdkVersion 21
         targetSdkVersion 34
-        versionCode 6116
-        versionName "6.1.1.6"
+        versionCode 6117
+        versionName "6.1.1.7"
         multiDexEnabled true
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
 

+ 14 - 0
app/src/main/AndroidManifest.xml

@@ -81,6 +81,20 @@
                 android:name="android.support.FILE_PROVIDER_PATHS"
                 android:resource="@xml/file_paths" />
         </provider>
+        <meta-data
+            android:name="com.google.firebase.messaging.default_notification_icon"
+            android:resource="@mipmap/ic_launcher" />
+        <meta-data
+            android:name="com.google.firebase.messaging.default_notification_color"
+            android:resource="@color/purple_500" />
+
+        <service
+            android:name=".MyFirebaseMessagingService"
+            android:exported="false">
+            <intent-filter>
+                <action android:name="com.google.firebase.MESSAGING_EVENT" />
+            </intent-filter>
+        </service>
 
     </application>
 

+ 75 - 0
app/src/main/java/com/swago/app/MyFirebaseMessagingService.kt

@@ -0,0 +1,75 @@
+package com.swago.app
+
+import android.app.Notification
+import android.app.NotificationChannel
+import android.app.NotificationManager
+import android.app.PendingIntent
+import android.content.Context
+import android.content.Intent
+import android.graphics.BitmapFactory
+import android.os.Build
+import androidx.core.app.NotificationCompat
+import com.google.firebase.messaging.FirebaseMessagingService
+import com.google.firebase.messaging.RemoteMessage
+import com.swago.baseswago.util.LogUtil
+import com.swago.home.HomeActivity
+
+class MyFirebaseMessagingService: FirebaseMessagingService() {
+
+    override fun onMessageReceived(message: RemoteMessage) {
+        super.onMessageReceived(message)
+        LogUtil.d("MyFirebaseMessagingService","onMessageReceived" + message)
+        message.notification?.let {
+            sendNotification(it.title,it.body)
+        }
+
+    }
+
+    override fun onNewToken(token: String) {
+        super.onNewToken(token)
+        LogUtil.d("FirebaseMessaging","onNewToken" + token)
+    }
+
+    private fun sendNotification(title:String?,messageBody: String?) {
+        LogUtil.d("FCM", "sendNotification: " + messageBody)
+        // Create notification default intent.
+        val pendingIntent: PendingIntent
+        val manager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
+        val builder: NotificationCompat.Builder
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+            val channel = NotificationChannel(
+                "com.swago.app.MyFirebaseMessagingService" //这里的id里面输入自己的项目的包的路径
+                //这里的id里面输入自己的项目的包的路径
+                , "MeLiv", NotificationManager.IMPORTANCE_HIGH)
+            channel.enableLights(true)
+            channel.setShowBadge(true)
+            channel.lockscreenVisibility = Notification.VISIBILITY_PUBLIC
+            manager.createNotificationChannel(channel)
+            builder = NotificationCompat.Builder(this).setChannelId(
+                "com.swago.app.MyFirebaseMessagingService" //这里的id里面输入自己的项目的包的路径
+            )
+        } else {
+            builder = NotificationCompat.Builder(this)
+        }
+
+        pendingIntent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            PendingIntent.getActivity(this, 0, Intent(), PendingIntent.FLAG_IMMUTABLE)
+        } else {
+            PendingIntent.getActivity(this, 0, Intent(), PendingIntent.FLAG_UPDATE_CURRENT)
+        }
+
+        builder.setContentTitle(title)
+            .setContentText(messageBody)
+            .setWhen(System.currentTimeMillis())
+            .setSmallIcon(R.mipmap.ic_launcher_foreground)
+            .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_foreground))
+            .setPriority(Notification.PRIORITY_MAX)
+            .setWhen(System.currentTimeMillis())
+            .setContentIntent(pendingIntent)
+            .setFullScreenIntent(pendingIntent, true)
+            .build()
+        val notification = builder.build()
+        manager.notify(1, notification)
+    }
+
+}

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

@@ -39,55 +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 {
-                        Toast.makeText(
-                            this@SplashActivity,
-                            getString(com.swago.login.R.string.these_permissions_denied)+" $deniedList",
-                            Toast.LENGTH_LONG
-                        ).show()
-                        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 {
-                        Toast.makeText(
-                            this@SplashActivity,
-                            getString(com.swago.login.R.string.these_permissions_denied)+" $deniedList",
-                            Toast.LENGTH_LONG
-                        ).show()
-                        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(
@@ -104,11 +63,6 @@ class SplashActivity : AppCompatActivity() {
                             }
                         }
                     } else {
-                        Toast.makeText(
-                            this@SplashActivity,
-                            getString(com.swago.login.R.string.these_permissions_denied)+" $deniedList",
-                            Toast.LENGTH_LONG
-                        ).show()
                         ARouter.getInstance().build(ARouteConstant.Login.login).navigation()
                         finish()
                     }

+ 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")
             }
         }
     }

+ 1 - 0
baseswago/build.gradle

@@ -129,6 +129,7 @@ dependencies {
     api 'com.google.firebase:firebase-auth-ktx'
     api 'com.google.firebase:firebase-firestore-ktx'
     api 'com.google.firebase:firebase-perf-ktx'
+    api 'com.google.firebase:firebase-messaging-ktx'
     //jsoup
     api 'org.jsoup:jsoup:1.12.1'
     //适配阿拉伯语

+ 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 - 0
baseswago/src/main/java/com/swago/baseswago/baseroom/IRoomInfo.kt

@@ -51,4 +51,5 @@ interface IRoomInfo {
     fun getHeadSpecial():String //头像框
     fun getBadgeSpecial():String //徽章
     fun getChatSpecial():String //聊天气泡
+    fun getTimeKey():String //在直播间里时间
 }

+ 9 - 1
baseswago/src/main/java/com/swago/baseswago/constant/UrlConstant.kt

@@ -29,6 +29,13 @@ object UrlConstant {
         }
     }
 
+    private val TRAFFIC_URL by lazy {
+        if (BuildConfig.DEBUG) {
+            "http://test-h5.swago.cn"
+        } else {
+            "https://web-view.me-live.cn"
+        }
+    }
 
     private val gson by lazy {
         Gson()
@@ -85,7 +92,8 @@ object UrlConstant {
     val WITHDRAW_CUSTOMER = "${BASE_WEB_URL}/withdrawal/customer"//所有用户都跳跳这个 1.2.0版本改的
     //排行榜
     val RANKING = "${BASE_WEB_URL}/goldCoinRank"
-
+    //转盘
+    val TRAFFIC = "${TRAFFIC_URL}/checkIn"
     var appGameRootPath =
         AppContext.getContext().getExternalFilesDir("")?.absolutePath + File.separator + "gameFile"
 

+ 1 - 1
user/src/main/java/com/swago/user/store/BaseStoreDFragment.kt → baseswago/src/main/java/com/swago/baseswago/dialog/BaseStoreDFragment.kt

@@ -1,4 +1,4 @@
-package com.swago.user.store
+package com.swago.baseswago.dialog
 
 import android.os.Bundle
 import android.view.Gravity

+ 112 - 0
baseswago/src/main/java/com/swago/baseswago/dialog/TodayTrafficDialog.kt

@@ -0,0 +1,112 @@
+package com.swago.baseswago.dialog
+
+import android.graphics.Bitmap
+import android.graphics.Color
+import android.os.Build
+import android.os.Bundle
+import android.view.Gravity
+import android.view.ViewGroup
+import android.webkit.JavascriptInterface
+import android.webkit.WebChromeClient
+import android.webkit.WebSettings
+import android.webkit.WebView
+import android.webkit.WebViewClient
+import androidx.constraintlayout.widget.ConstraintLayout
+import androidx.transition.Visibility
+import com.google.firebase.firestore.core.View
+import com.swago.baseswago.constant.UrlConstant
+import com.swago.baseswago.databinding.DialogTodayTrafficBinding
+import com.swago.baseswago.util.DpPxUtil
+import com.swago.baseswago.util.SwagoInfo
+import com.swago.baseswago.util.UserInfo
+import org.json.JSONObject
+
+class TodayTrafficDialog : BaseStoreDFragment<DialogTodayTrafficBinding>() {
+    private var showDialog:Boolean = true
+    private val jsLoad by lazy {
+        JSLoad()
+    }
+    init {
+        setGravity(Gravity.CENTER)
+        setDimAmount(0.6f)
+        setCanCancel(true)
+        setHeightMatchParent()
+    }
+
+    companion object {
+        fun newInstance(): TodayTrafficDialog {
+            val args = Bundle()
+            val fragment = TodayTrafficDialog()
+            fragment.arguments = args
+            return fragment
+        }
+    }
+
+    override fun initOther() {
+        binding?.loadingProgress?.visibility = android.view.View.VISIBLE
+        binding?.webview?.apply {
+            //设置大小
+            val params = ConstraintLayout.LayoutParams(
+                ViewGroup.LayoutParams.MATCH_PARENT,
+                ViewGroup.LayoutParams.MATCH_PARENT
+            )
+            params.topMargin =  DpPxUtil.getScreenHeight()/6
+            this.layoutParams = params
+            try {
+                val jsonObject = JSONObject()
+                jsonObject.put("TokenParam", UserInfo.getLoginModel()?.token?:"")
+                jsonObject.put("UserIdParam", UserInfo.getUserInfo()?.id?:"")
+                jsonObject.put("LocaleParam", SwagoInfo.getLanguageCode())
+                jsonObject.put("AppVersionParam", SwagoInfo.getVersionCode())
+                jsonObject.put("ClientParam", SwagoInfo.getAppClient())
+                jsonObject.put("ChannelParam", SwagoInfo.getChannel())
+                jsonObject.put("DeviceParam", SwagoInfo.getDeviceInfo())
+                settings.userAgentString = settings.userAgentString + jsonObject.toString()
+            } catch (e: Exception) {
+                e.printStackTrace()
+            }
+
+            if (Build.VERSION.SDK_INT >= 21) {
+                settings.mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
+            }
+            settings.javaScriptEnabled = true
+            addJavascriptInterface(jsLoad, "melive")
+            settings.allowUniversalAccessFromFileURLs = true
+            settings.allowFileAccess = true
+            settings.allowFileAccessFromFileURLs = true
+            settings.useWideViewPort = true
+            settings.loadWithOverviewMode = true
+            settings.javaScriptCanOpenWindowsAutomatically = true//设置允许JS弹窗
+            settings.domStorageEnabled = true
+            settings.cacheMode = WebSettings.LOAD_CACHE_ELSE_NETWORK
+            settings.domStorageEnabled = true
+            isHorizontalScrollBarEnabled = true
+            isVerticalScrollBarEnabled = true
+            settings.databaseEnabled = true
+            setBackgroundColor(Color.TRANSPARENT)
+            webViewClient = object : WebViewClient(){
+                override fun onPageFinished(view: WebView?, url: String?) {
+                    super.onPageFinished(view, url)
+                    binding?.loadingProgress?.visibility = android.view.View.GONE
+
+                }
+            }
+            loadUrl(UrlConstant.TRAFFIC)
+        }
+    }
+
+    override fun initLiveData() {
+
+    }
+    inner class JSLoad {
+        @JavascriptInterface
+        fun HtmlcallNative(s:String) {
+            dismissAllowingStateLoss()
+        }
+    }
+
+    override fun dismiss() {
+        super.dismiss()
+        showDialog = true
+    }
+}

+ 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")){

+ 6 - 0
baseswago/src/main/java/com/swago/baseswago/inter/HomeApi.kt

@@ -61,4 +61,10 @@ interface HomeApi {
     @POST("/v1/user/last/invite/log")
     suspend fun getInviteLog():InviteLogModel
 
+    /**
+     * firebase上报用户deviceToken
+     */
+    @FormUrlEncoded
+    @POST("/v1/user/upload/devicetoken")
+    suspend fun pushDeviceToken(@Field("device_token")page:String): Any
 }

+ 28 - 2
baseswago/src/main/java/com/swago/baseswago/inter/RoomApi.kt

@@ -84,14 +84,14 @@ interface RoomApi {
      */
     @FormUrlEncoded
     @POST("/v1/rtc/leave/broadcast")
-    suspend fun leaveRoom(@Field("room_id") room_id: String): Any
+    suspend fun leaveRoom(@Field("room_id") room_id: String, @Field("time_key") time_key: String): Any
 
     /**
      * 退出房间(小黑屋)
      */
     @FormUrlEncoded
     @POST("/v1/rtc/house/leave/broadcast")
-    suspend fun houseLeaveRoom(@Field("room_id") room_id: String): Any
+    suspend fun houseLeaveRoom(@Field("room_id") room_id: String, @Field("time_key") time_key: String): Any
 
 
     /**
@@ -409,6 +409,13 @@ interface RoomApi {
     @POST("/v1/rtc/broadcast/pk/act")
     suspend fun pkSure(@Field("pk_id") pk_id: String): Any
 
+    /**
+     * 加入pk频道异常回调
+     */
+    @FormUrlEncoded
+    @POST("/v1/rtc/broadcast/pk/join/fail")
+    suspend fun pkJoinFail(@Field("pk_id") pk_id: String): Any
+
 
     /**
      * 获取直播间信息
@@ -728,5 +735,24 @@ interface RoomApi {
     @POST("v1/rtc/system/upload/broadcast")
     suspend fun uploadBroadcast(@Field("room_id")room_id:String):Any
 
+    /**
+     * 查询直播间在线时长与奖励领取情况
+     *
+     */
+    @POST("v1/rtc/broadcast/get/onlineduration")
+    suspend fun getOnlineRewards():OnlineRewardsModel
 
+    /**
+     * 领取在线奖励
+     */
+    @FormUrlEncoded
+    @POST("v1/rtc/broadcast/receive/onlineduration")
+    suspend fun receiveOnlineRewards(@Field("duration")duration:String):Any
+
+    /**
+     * 倒计时结束
+     */
+    @FormUrlEncoded
+    @POST("v1/rtc/broadcast/countdown/over")
+    suspend fun countdownOverRewards(@Field("time_key")time_key:String):Any
 }

+ 11 - 0
baseswago/src/main/java/com/swago/baseswago/model/MomentModel.java

@@ -37,6 +37,7 @@ public class MomentModel implements Parcelable {
     private String badge_special;
     private String join_special;
     private String chat_special;
+    private boolean is_pk;
 
     public MomentModel(){
 
@@ -63,6 +64,7 @@ public class MomentModel implements Parcelable {
         badge_special = in.readString();
         join_special = in.readString();
         chat_special = in.readString();
+        is_pk = in.readInt() != 0;
     }
 
     @Override
@@ -87,6 +89,7 @@ public class MomentModel implements Parcelable {
         dest.writeString(badge_special);
         dest.writeString(join_special);
         dest.writeString(chat_special);
+        dest.writeInt(is_pk ? 1: 0);
     }
 
     @Override
@@ -281,4 +284,12 @@ public class MomentModel implements Parcelable {
     public void setChat_special(String chat_special) {
         this.chat_special = chat_special;
     }
+
+    public boolean getIs_pk() {
+        return is_pk;
+    }
+
+    public void setIs_pk(boolean is_pk) {
+        this.is_pk = is_pk;
+    }
 }

+ 31 - 0
baseswago/src/main/java/com/swago/baseswago/model/UserInfoModel.java

@@ -103,6 +103,17 @@ public class UserInfoModel {
      * 是否充值用户
      */
     private int is_recharge;
+
+    /**
+     * 今天转盘是否抽奖
+     * */
+    private boolean is_zhuanpan_every_day;
+
+    /**
+     * 每日首充
+     * */
+    private boolean first_charge;
+
     private String android_join_special;
     private String android_head_special;
     private String android_badge_special;
@@ -413,6 +424,26 @@ public class UserInfoModel {
         this.is_recharge = is_recharge;
     }
 
+    public boolean isFirst_charge() {
+        return first_charge;
+    }
+
+    public void setFirst_charge(boolean first_charge) {
+        this.first_charge = first_charge;
+    }
+
+    public boolean isIs_zhuanpan_every_day() {
+        return is_zhuanpan_every_day;
+    }
+
+    public boolean getIs_zhuanpan_every_day() {
+        return is_zhuanpan_every_day;
+    }
+
+    public void setIs_zhuanpan_every_day(boolean is_zhuanpan_every_day) {
+        this.is_zhuanpan_every_day = is_zhuanpan_every_day;
+    }
+
     public String getAndroid_join_special() {
         return android_join_special;
     }

+ 16 - 0
baseswago/src/main/java/com/swago/baseswago/model/live/OnlineRewardsModel.kt

@@ -0,0 +1,16 @@
+package com.swago.baseswago.model.live
+
+data class OnlineRewardsModel (
+    var five:Boolean,
+    var ten:Boolean,
+    var fifteen:Boolean,
+    var thirty:Boolean,
+    var onlineDuration:Int,
+    val coin:CoinOnlineBean,
+    )
+
+data class CoinOnlineBean (
+    val five:Int,
+    val ten:Int,
+    val fifteen:Int,
+    val thirty:Int)

+ 10 - 0
baseswago/src/main/java/com/swago/baseswago/model/live/RoomModel.java

@@ -52,6 +52,7 @@ public class RoomModel {
     private String give_val;
 
     private String broadcast_bg_url;
+    private String time_key;
 
     private String join_special;
     private String head_special;
@@ -278,6 +279,14 @@ public class RoomModel {
         this.broadcast_bg_url = broadcast_bg_url;
     }
 
+    public String getTime_key() {
+        return time_key;
+    }
+
+    public void setTime_key(String time_key) {
+        this.time_key = time_key;
+    }
+
     public CusNewMsgBean<RoomUserChangeModel> getJoin_im_data() {
         return join_im_data;
     }
@@ -325,4 +334,5 @@ public class RoomModel {
     public void setBroadcast_head_special(String broadcast_head_special) {
         this.broadcast_head_special = broadcast_head_special;
     }
+
 }

+ 14 - 0
baseswago/src/main/java/com/swago/baseswago/util/FileUtil.kt

@@ -2,7 +2,9 @@ package com.swago.baseswago.util
 
 import android.app.Application
 import android.content.Context
+import android.net.Uri
 import android.os.Build
+import android.provider.MediaStore
 import java.io.*
 import java.lang.Exception
 import java.util.*
@@ -191,4 +193,16 @@ object FileUtil {
         }
     }
 
+    fun getRealPathFromURI(uri: Uri): String? {
+        var path: String? = null
+        val projection = arrayOf(MediaStore.Images.Media.DATA)
+        val cursor = AppContext.getContext().contentResolver.query(uri, projection, null, null, null)
+        cursor?.use {
+            if (it.moveToFirst()) {
+                val columnIndex = it.getColumnIndexOrThrow(MediaStore.Images.Media.DATA)
+                path = it.getString(columnIndex)
+            }
+        }
+        return path
+    }
 }

+ 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
         }

+ 50 - 52
baseswago/src/main/java/com/swago/baseswago/util/SwagoInfo.kt

@@ -14,7 +14,7 @@ import java.util.*
  *description:
  */
 object SwagoInfo {
-    var key = "bGtobGtqc3NoYWtzaGRzaWhzaWRoc2lzaWR0YmZnZGU="
+    var key = "bGtobGtqc3M4MjczMzgzOTI5M2Roc2lzaWR0YmZnZGU="
     private var versionCode = ""
     private var languageCode = "en"
     var languageId = 0
@@ -119,57 +119,55 @@ object SwagoInfo {
     }
 
     private fun getUniqueDeviceId():String{
-        if (PermissionX.isGranted(AppContext.getContext(), Manifest.permission.READ_EXTERNAL_STORAGE)){
-           if (AppContext.getContext().getExternalFilesDir(null) == null){
-               return ""
-           }else{
-               val path = "${AppContext.getContext().getExternalFilesDir(null)!!.path}/swagoFile"
-               val pathFile = File("$path/uuid.txt")
-               if (pathFile.exists()){
-                   var br: BufferedReader? = null
-                   var isr: InputStreamReader? = null
-                   try {
-                       isr = InputStreamReader(FileInputStream(pathFile))
-                       br = BufferedReader(isr)
-                       val stringBuilder = StringBuffer()
-                       var line:String?
-                       while (br.readLine().also { line = it } != null) {
-                           stringBuilder.append(line)
-                       }
-                       LogUtil.d("设备唯一标识","本地文件获取:"+stringBuilder.toString())
-                       return stringBuilder.toString()
-                   }catch (e:Exception){
-                       e.printStackTrace()
-                   }finally {
-                       try {
-                           isr?.close()
-                           br?.close()
-                       } catch (e: Exception) {
-                           e.printStackTrace()
-                       }
-                   }
-               }else{
-                   File(path).mkdirs()
-                   pathFile.createNewFile()
-                   val rawImei = "${System.currentTimeMillis()}${"Android ${Build.VERSION.RELEASE}"}"
-                   val imei = MD5Util.md5Hex(rawImei)
-                   var writer:FileWriter? = null
-                   try {
-                       writer = FileWriter(pathFile)
-                       writer.write(imei)
-                       LogUtil.d("设备唯一标识","创建的时候获取:"+imei)
-                       return imei
-                   }catch (e:Exception){
-                       e.printStackTrace()
-                   }finally {
-                       try {
-                           writer?.close()
-                       } catch (e: Exception) {
-                           e.printStackTrace()
-                       }
-                   }
-               }
-           }
+        if (AppContext.getContext().getExternalFilesDir(null) == null){
+            return ""
+        }else{
+            val path = "${AppContext.getContext().getExternalFilesDir(null)!!.path}/swagoFile"
+            val pathFile = File("$path/uuid.txt")
+            if (pathFile.exists()){
+                var br: BufferedReader? = null
+                var isr: InputStreamReader? = null
+                try {
+                    isr = InputStreamReader(FileInputStream(pathFile))
+                    br = BufferedReader(isr)
+                    val stringBuilder = StringBuffer()
+                    var line:String?
+                    while (br.readLine().also { line = it } != null) {
+                        stringBuilder.append(line)
+                    }
+                    LogUtil.d("设备唯一标识","本地文件获取:"+stringBuilder.toString())
+                    return stringBuilder.toString()
+                }catch (e:Exception){
+                      e.printStackTrace()
+                }finally {
+                    try {
+                        isr?.close()
+                        br?.close()
+                    } catch (e: Exception) {
+                        e.printStackTrace()
+                    }
+                }
+            }else{
+                File(path).mkdirs()
+                pathFile.createNewFile()
+                val rawImei = "${System.currentTimeMillis()}${"Android ${Build.VERSION.RELEASE}"}"
+                val imei = MD5Util.md5Hex(rawImei)
+                var writer:FileWriter? = null
+                try {
+                    writer = FileWriter(pathFile)
+                    writer.write(imei)
+                    LogUtil.d("设备唯一标识","创建的时候获取:"+imei)
+                    return imei
+                }catch (e:Exception){
+                    e.printStackTrace()
+                }finally {
+                    try {
+                        writer?.close()
+                    } catch (e: Exception) {
+                        e.printStackTrace()
+                    }
+                }
+            }
         }
         return ""
     }

+ 6 - 0
baseswago/src/main/java/com/swago/baseswago/util/TimeUtil.kt

@@ -79,4 +79,10 @@ object TimeUtil {
     fun formatMin(time: Long):String{
         return "${time/60}min"
     }
+
+    fun getCurrentDate(): String {
+        // 获取当前日期,并将其转换为字符串
+        val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
+        return dateFormat.format(Date())
+    }
 }

+ 28 - 0
baseswago/src/main/res/layout/dialog_today_traffic.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/cl"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <WebView
+        android:id="@+id/webview"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_marginTop="80dp"/>
+
+    <ProgressBar
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        android:id="@+id/loading_progress"
+        style="?android:attr/progressBarStyle"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:padding="6dp"
+        android:background="@drawable/shape_80000000_20"/>
+
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 0 - 0
user/src/main/res/mipmap-xxhdpi/ic_coin_store.png → baseswago/src/main/res/mipmap-xxhdpi/ic_coin_store.png


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


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


+ 8 - 0
baseswago/src/main/res/values-ar/strings.xml

@@ -363,4 +363,12 @@
     <string name="login_fail">فشل تسجيل الدخول</string>
     <string name="user_refused_invitation">رفض المستخدم دعوتك</string>
     <string name="user_agreed_invitation">وافق المستخدم على دعوتك</string>
+    <string name="user_above_level_10">يمكن للمستخدمين فوق المستوى 10 الحصول عليه</string>
+    <string name="pk_now_wait">المرساة الحالية هي PK، يرجى الانتظار </string>
+    <string name="congratulations">تهانينا!</string>
+    <string name="you_get">تحصل</string>
+    <string name="continue_in_room_earn_coins">ابق في الغرفة لمدة %s دقيقة لتربح عملات %s أخرى.</string>
+    <string name="please_setting_camera_microphone">رجى الانتقال إلى الإعدادات لتمكين أذونات الكاميرا </string>
+    <string name="successful_collection">تم الاستلام بنجاح</string>
+    <string name="pk_failed_re_pk">الشبكة غير مستقرة، وفشل اتصال pk. يرجى المحاولة مرة أخرى.</string>
 </resources>

+ 10 - 2
baseswago/src/main/res/values-in/strings.xml

@@ -52,11 +52,11 @@
     <string name="recharge_gear">List isi ulang</string>
     <string name="recharge">Isi ulang</string>
     <string name="daily_task">Tugas Harian</string>
-    <string name="newer_task">Tugas pengguna baru</string>
+    <string name="newer_task">Tugas Pengguna Baru</string>
     <string name="reward">Bonus:</string>
     <string name="exp">Pengalaman</string>
     <string name="receive">Terima</string>
-    <string name="uncomplete">Belum selesar</string>
+    <string name="uncomplete">Belum</string>
     <string name="complete">Selesai</string>
     <string name="live_end">Live ini telah terakhir</string>
     <string name="sure_close">Mengonfirmasi</string>
@@ -375,4 +375,12 @@
     <string name="login_fail">Gagal masuk</string>
     <string name="user_refused_invitation">Pengguna menolak undangan Anda</string>
     <string name="user_agreed_invitation">Pengguna menyetujui undangan Anda</string>
+    <string name="user_above_level_10">Pengguna di atas level 10 dapat menerimanya</string>
+    <string name="pk_now_wait">Host sedang PK, harap tunggu ya</string>
+    <string name="congratulations">Selamat!</string>
+    <string name="you_get">You get</string>
+    <string name="continue_in_room_earn_coins">Lanjutkan di ruangan host selama %s menit untuk mendapatkan %s koin lagi.</string>
+    <string name="please_setting_camera_microphone">Silakan mengaktifkan izin kamera dan mikrofon di pengaturan.</string>
+    <string name="successful_collection">Berhasil diterima</string>
+    <string name="pk_failed_re_pk">Jaringan tidak stabil dan koneksi PK gagal, silakan coba lagi</string>
 </resources>

+ 9 - 1
baseswago/src/main/res/values-ms/strings.xml

@@ -56,7 +56,7 @@
     <string name="reward">hadiah:</string>
     <string name="exp">pengalaman</string>
     <string name="receive">terima</string>
-    <string name="uncomplete">tidak di selesai kan</string>
+    <string name="uncomplete">Belum</string>
     <string name="complete">selesai</string>
     <string name="live_end">Live telah sampai ke penghujungnya</string>
     <string name="sure_close">mengesahkan</string>
@@ -375,4 +375,12 @@
     <string name="login_fail">Daftar masuk gagal</string>
     <string name="user_refused_invitation">Pengguna menolak jemputan anda</string>
     <string name="user_agreed_invitation">Pengguna menerima jemputan anda</string>
+    <string name="user_above_level_10">Pengguna di atas level 10 dapat menerimanya</string>
+    <string name="pk_now_wait">Host sedang PK, harap tunggu ya</string>
+    <string name="congratulations">Selamat!</string>
+    <string name="you_get">You get</string>
+    <string name="continue_in_room_earn_coins">Lanjutkan di ruangan host selama %s menit untuk mendapatkan %s koin lagi.</string>
+    <string name="please_setting_camera_microphone">Silakan mengaktifkan izin kamera dan mikrofon di pengaturan.</string>
+    <string name="successful_collection">Berhasil diterima</string>
+    <string name="pk_failed_re_pk">Jaringan tidak stabil dan koneksi PK gagal, silakan coba lagi</string>
 </resources>

+ 8 - 0
baseswago/src/main/res/values-zh/strings.xml

@@ -363,4 +363,12 @@
     <string name="login_fail">登录失败</string>
     <string name="user_refused_invitation">用户拒绝了你的邀请</string>
     <string name="user_agreed_invitation">用户同意了你的邀请</string>
+    <string name="user_above_level_10">10级以上用户可以领取</string>
+    <string name="pk_now_wait">当前主播正在PK,请稍后</string>
+    <string name="congratulations">Congratulations!</string>
+    <string name="you_get">You get</string>
+    <string name="continue_in_room_earn_coins">Continue in the room for %s mins to earn another %s coins.</string>
+    <string name="please_setting_camera_microphone">请到设置里开启相机和麦克风权限</string>
+    <string name="successful_collection">领取成功</string>
+    <string name="pk_failed_re_pk">网络不稳定,PK连接失败,请重新PK</string>
 </resources>

+ 8 - 0
baseswago/src/main/res/values/strings.xml

@@ -395,4 +395,12 @@
     <string name="login_fail">login fail</string>
     <string name="user_refused_invitation">user refused your invitation</string>
     <string name="user_agreed_invitation">user agreed your invitation</string>
+    <string name="user_above_level_10">Users above level 10 can obtain it</string>
+    <string name="pk_now_wait">Host on pk now , pls wait and try again </string>
+    <string name="congratulations">Congratulations!</string>
+    <string name="you_get">You get</string>
+    <string name="continue_in_room_earn_coins">Continue in the room for %s mins to earn another %s coins.</string>
+    <string name="please_setting_camera_microphone">Please go to settings to enable camera and microphone permissions</string>
+    <string name="successful_collection">Successful collection</string>
+    <string name="pk_failed_re_pk">Network instability, PK connection failed, please re-PK</string>
 </resources>

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

@@ -9,6 +9,7 @@ import androidx.lifecycle.lifecycleScope
 import androidx.viewpager.widget.ViewPager
 import com.alibaba.android.arouter.facade.annotation.Route
 import com.android.billingclient.api.Purchase
+import com.google.firebase.messaging.FirebaseMessaging
 import com.swago.baseswago.PayVm
 import com.swago.baseswago.SwagoAdapter
 import com.swago.baseswago.UserVm
@@ -18,6 +19,7 @@ import com.swago.baseswago.constant.UrlConstant
 import com.swago.baseswago.dialog.CloseAccountDialog
 import com.swago.baseswago.dialog.InviteBindingDialog
 import com.swago.baseswago.dialog.OrderLostDialog
+import com.swago.baseswago.dialog.TodayTrafficDialog
 import com.swago.baseswago.im.GroupMsgParser
 import com.swago.baseswago.im.IMMessageManager
 import com.swago.baseswago.inter.ApiManager
@@ -39,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
@@ -150,6 +153,16 @@ 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)
+                LogUtil.d("FirebaseMessaging","isSuccessful:" + it
+                    .result)
+            }
+        }
+
     }
 
     /**

+ 26 - 2
home/src/main/java/com/swago/home/HomeFragment.kt

@@ -5,7 +5,9 @@ import android.content.Context
 import android.content.Intent
 import android.graphics.Color
 import android.graphics.Typeface
+import android.net.Uri
 import android.os.Build
+import android.provider.Settings
 import android.view.View
 import android.widget.Toast
 import androidx.fragment.app.activityViewModels
@@ -17,10 +19,13 @@ import com.swago.baseswago.SwagoAdapter
 import com.swago.baseswago.UserVm
 import com.swago.baseswago.constant.ARouteConstant
 import com.swago.baseswago.constant.UrlConstant
+import com.swago.baseswago.dialog.TodayTrafficDialog
 import com.swago.baseswago.fragment.BaseXFragment
 import com.swago.baseswago.util.AppContext
 import com.swago.baseswago.util.DpPxUtil
 import com.swago.baseswago.util.NoDoubleClickListener
+import com.swago.baseswago.util.SwagoInfo
+import com.swago.baseswago.util.UserInfo
 import com.swago.home.databinding.FragmentHomeBinding
 import com.swago.home.innerhome.FollowFragment
 import com.swago.home.innerhome.HotFragment
@@ -34,6 +39,7 @@ import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTit
 import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator
 import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.SimplePagerTitleView
 
+
 /**
  *@date 2021/11/20 10:31
  *description:
@@ -51,6 +57,13 @@ class HomeFragment : BaseXFragment<FragmentHomeBinding>() {
 
 
     override fun loadData() {
+//        UserInfo.getUserInfo()?.let{
+//            if (!it.is_zhuanpan_every_day){
+//                TodayTrafficDialog.newInstance().show(childFragmentManager,"TodayTrafficDialog")
+//            }
+//        }.also {
+//            TodayTrafficDialog.newInstance().show(childFragmentManager,"TodayTrafficDialog")
+//        }
     }
 
     override fun initOther() {
@@ -130,11 +143,17 @@ class HomeFragment : BaseXFragment<FragmentHomeBinding>() {
                                 ARouter.getInstance().build(ARouteConstant.Room.anchor).navigation()
                             } else {
                                 binding.ivLive.isEnabled = true
+                                val intent = Intent()
+                                intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
+                                val uri = Uri.fromParts("package", activity?.packageName, null)
+                                intent.setData(uri)
+                                startActivity(intent)
                                 Toast.makeText(
                                     AppContext.getContext(),
-                                    AppContext.getContext().getString(R.string.these_permissions_denied)+" $deniedList",
+                                    AppContext.getContext().getString(R.string.please_setting_camera_microphone),
                                     Toast.LENGTH_LONG
                                 ).show()
+
                             }
                         }
                 } else {
@@ -146,9 +165,14 @@ class HomeFragment : BaseXFragment<FragmentHomeBinding>() {
                                 ARouter.getInstance().build(ARouteConstant.Room.anchor).navigation()
                             } else {
                                 binding.ivLive.isEnabled = true
+                                val intent = Intent()
+                                intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
+                                val uri = Uri.fromParts("package", activity?.packageName, null)
+                                intent.setData(uri)
+                                startActivity(intent)
                                 Toast.makeText(
                                     AppContext.getContext(),
-                                    AppContext.getContext().getString(R.string.these_permissions_denied)+" $deniedList",
+                                    AppContext.getContext().getString(R.string.please_setting_camera_microphone),
                                     Toast.LENGTH_LONG
                                 ).show()
                             }

+ 3 - 1
home/src/main/java/com/swago/home/MessageFragment.kt

@@ -106,7 +106,9 @@ class MessageFragment : BaseXFragment<FragmentMessageBinding>() {
     }
 
      fun setMessageSum(){
-         officialVm.getMsgSum()
+         if (isAdded){
+             officialVm.getMsgSum()
+         }
      }
 
     override fun onResume() {

+ 12 - 1
home/src/main/java/com/swago/home/MineFragment.kt

@@ -15,6 +15,7 @@ import com.swago.baseswago.UserVm
 import com.swago.baseswago.constant.ARouteConstant
 import com.swago.baseswago.constant.UrlConstant
 import com.swago.baseswago.dialog.BenefitBagDialog
+import com.swago.baseswago.dialog.TodayTrafficDialog
 import com.swago.baseswago.fragment.BaseXFragment
 import com.swago.baseswago.util.*
 import com.swago.home.databinding.FragmentMineBinding
@@ -174,7 +175,17 @@ class MineFragment : BaseXFragment<FragmentMineBinding>() {
             }
         })
 
-        payVm.getBenefit()
+        binding.ivTraffic.setOnClickListener(object :NoDoubleClickListener(){
+            override fun onClick() {
+                UserInfo.getUserInfo()?.let{
+                    if (!it.is_zhuanpan_every_day){
+                        TodayTrafficDialog.newInstance().show(childFragmentManager,"TodayTrafficDialog")
+                    }
+                }
+            }
+        })
+
+//        payVm.getBenefit()
     }
 
     override fun initLiveData() {

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

@@ -49,6 +49,11 @@ class HomeAdapter  : BaseQuickAdapter<MomentModel, BaseViewHolder>(R.layout.item
 
                 setVisible(R.id.ivPassword , false)
             }
+            if (item.is_pk){
+                setVisible(R.id.ivPk , true)
+            } else {
+                setVisible(R.id.ivPk , false)
+            }
 //            setImageResource(R.id.ivCountry,R.drawable.flag_ac)
         }
     }

+ 7 - 0
home/src/main/java/com/swago/home/innerhome/HomeVm.kt

@@ -141,4 +141,11 @@ class HomeVm(application: Application) : BaseViewModel(application) {
         }
     }
 
+    fun pushDeviceToken(token:String){
+        requestData2 {
+            requestData{
+                ApiManager.homeApi.pushDeviceToken(token)
+            }
+        }
+    }
 }

+ 9 - 1
home/src/main/res/layout/fragment_mine.xml

@@ -491,6 +491,14 @@
         </LinearLayout>
     </ScrollView>
 
-
+    <ImageView
+        android:id="@+id/ivTraffic"
+        android:layout_width="54dp"
+        android:layout_height="54dp"
+        android:src="@mipmap/ic_traffic"
+        android:layout_marginEnd="12dp"
+        android:layout_marginBottom="12dp"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"/>
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 10 - 0
home/src/main/res/layout/item_home.xml

@@ -33,6 +33,16 @@
         android:src="@mipmap/ic_live_lock"
         android:visibility="gone"/>
 
+    <ImageView
+        android:id="@+id/ivPk"
+        android:layout_width="25dp"
+        android:layout_height="25dp"
+        android:layout_marginTop="2dp"
+        android:layout_marginStart="10dp"
+        app:layout_constraintTop_toTopOf="@+id/ivLive"
+        app:layout_constraintLeft_toLeftOf="parent"
+        android:visibility="gone"
+        android:src="@mipmap/icon_pk"/>
 
     <com.swago.baseswago.cusview.BoldTextView
         android:id="@+id/tvName"

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


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

@@ -58,41 +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)
-                                    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
-                            )
-                            .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()
-                                }
-                            }
+                     if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
+                         FBLogin.login(this@LoginActivity)
                     }else{
                         PermissionX.init(this@LoginActivity)
                             .permissions(
@@ -103,11 +70,6 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
                                     FBLogin.login(this@LoginActivity)
                                 } else {
                                     FBLogin.login(this@LoginActivity)
-                                    Toast.makeText(
-                                        this@LoginActivity,
-                                        getString(R.string.these_permissions_denied)+ "$deniedList",
-                                        Toast.LENGTH_LONG
-                                    ).show()
                                 }
                             }
                     }
@@ -120,41 +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)
-                                    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
-                            )
-                            .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()
-                                }
-                            }
+                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
+                        GoogleLogin.login(this@LoginActivity)
                     }else{
                         PermissionX.init(this@LoginActivity)
                             .permissions(
@@ -165,11 +94,6 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
                                     GoogleLogin.login(this@LoginActivity)
                                 } else {
                                     GoogleLogin.login(this@LoginActivity)
-                                    Toast.makeText(
-                                        this@LoginActivity,
-                                        getString(R.string.these_permissions_denied)+"$deniedList",
-                                        Toast.LENGTH_LONG
-                                    ).show()
                                 }
                             }
                     }
@@ -219,53 +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)
-                                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
-                        )
-                        .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()
-                            }
-                        }
+                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(
@@ -282,11 +164,6 @@ class LoginActivity : BaseXActivity<ActivityLoginBinding>() {
                                 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()
                             }
                         }
                 }

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

@@ -38,8 +38,10 @@ import com.swago.baseswago.model.live.pk.PunishPKModel
 import com.swago.baseswago.model.live.pk.StartPKModel
 import com.swago.baseswago.model.live.pk.StopPKModel
 import com.swago.baseswago.util.DpPxUtil
+import com.swago.baseswago.util.LogProducer
 import com.swago.baseswago.util.LogUtil
 import com.swago.loadUrlNoPlaceHolder
+import com.swago.room.BuildConfig
 import com.swago.room.R
 import com.swago.room.audio.AudioRoomManager
 import com.swago.room.audio.IAudioRoomListener
@@ -71,6 +73,7 @@ import io.agora.rtc.IRtcEngineEventHandler
 import io.agora.rtc.video.VideoEncoderConfiguration
 import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.launch
+import org.json.JSONObject
 
 
 /**
@@ -496,8 +499,19 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
     }
 
     override fun onChannelMediaRelayStateChanged(state: Int, code: Int) {
-        if (PKStateManager.roomState == PKStateManager.PK && state == 2 && code == 0) {
-            pkVm.pkSure(PKStateManager.pkId)
+        if (PKStateManager.roomState == PKStateManager.PK) {
+            if (state == 2 && code == 0){
+                pkVm.pkSure(PKStateManager.pkId)
+            } else if (state == 3){
+                pkVm.pkJoinFail(PKStateManager.pkId)
+            }
+            if (!BuildConfig.DEBUG){
+                val jsonObject = JSONObject()
+                jsonObject.put("state","$state")
+                jsonObject.put("code", "$code")
+                LogProducer.addLog(jsonObject.toString(), "pkState")
+            }
+
         }
     }
 

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

@@ -186,7 +186,7 @@ class AnchorRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
 
 
     private fun openMoreDialog(){
-        FooterMoreDialog.newInstance(unReadNum).apply {
+        FooterMoreDialog.newInstance(unReadNum,1).apply {
             openMessageFun = {
                 openMessageListDialog()
             }
@@ -227,6 +227,7 @@ class AnchorRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
     }
 
     override fun stopPK(stopPKModel: StopPKModel) {
+        pkAcceptDialog = null
     }
 
     override fun punishPK(punishPKModel: PunishPKModel, isGetDataFromIM: Boolean) {

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

@@ -23,6 +23,7 @@ import com.liulishuo.okdownload.core.breakpoint.BreakpointInfo
 import com.liulishuo.okdownload.core.cause.EndCause
 import com.liulishuo.okdownload.core.cause.ResumeFailedCause
 import com.permissionx.guolindev.PermissionX
+import com.swago.baseswago.PayVm
 import com.swago.baseswago.PersonDataDFragment
 import com.swago.baseswago.UserVm
 import com.swago.baseswago.baseroom.*
@@ -58,6 +59,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.reward.GetRewardsDialog
 import com.swago.room.dialog.JoinFanClubDialog
 import com.swago.room.dialog.LevelUpDialog
 import com.swago.room.dialog.MessageListDialog
@@ -115,6 +117,7 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
     val roomOtherVm by activityViewModels<RoomOtherVm>()
     val msgVm by activityViewModels<MsgVm>()
     val userVm by activityViewModels<UserVm>()
+    val payVm by activityViewModels<PayVm>()
     lateinit var unreadMessageVm: UnreadMessageVm
 
     /**
@@ -208,7 +211,6 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
         audioGiftManager.audioGiftViewList.add(binding.audioAllGiftView)
         //进场特效
         msgVm.joinRoomManager.initViewStub(binding.joinRoomViewStub, activity)
-        //
         binding.danMuView.setActivity(activity)
         binding.hongbaoPiaotiao.setActivity(activity)
         binding.hongbaoPiaotiao.goToTargetRoom = {
@@ -576,6 +578,16 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
             binding.ivRedEnvelopeView.addRedEnvelopList(it)
         }
 
+        //查询直播间在线时长与奖励领取情况
+        roomVm.onlineRewardsData.observe(this){
+            binding.ivRewards.checkOnlineTime(it)
+        }
+
+        //积分领取成功
+        roomVm.getRewardsSuccess.observe(this){
+            binding.ivRewards.setRewardsSuccess(it)
+        }
+
         //IM下发新的红包
         msgVm.newRedEnvelopeCome = {
             binding.ivRedEnvelopeView.addIMRedEnvelope(it)
@@ -668,6 +680,28 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
                 }
             }.show(childFragmentManager, "RedEnvelopResultDialog")
         }
+
+        //领取直播积分
+        binding.ivRewards.openGetCoins = { duration, coins,nextCoins,nextTimes ->
+            GetRewardsDialog.newInstance(duration, coins,nextCoins,nextTimes ).apply {
+                this.openGetCoins = {
+                    roomVm.receiveOnlineRewards(it)
+                }
+            }.show(childFragmentManager,"GetRewardsDialog")
+        }
+
+        binding.ivRewards.countdownOverFun = {
+            SwagoRoomManager.iRoomInfo?.let{
+                roomVm.countdownOverRewards(it.getTimeKey())
+            }
+
+        }
+
+        roomVm.countdownOver.observe(this){
+            binding.ivRewards.countdownOverSuccess()
+        }
+
+
         pkVm.pkState = { pkState ->
             binding.bannerView.visibility = if (pkState) View.INVISIBLE else View.VISIBLE
             binding.videoPlayBannerView.visibility = if (pkState) View.INVISIBLE else View.VISIBLE
@@ -819,6 +853,7 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
     }
 
     private var isFirst = true
+    private var getOnlineRewards = true
     override fun joinedRoom(iRoomInfo: IRoomInfo) {
         roomOtherVm.getRedEnvelopeList()
         if (iRoomInfo.getRoomType() != RoomType.HOUSE.type){
@@ -869,6 +904,17 @@ abstract class BaseComFragment<T : FragmentBaseComBinding> : BaseXFragment<T>(),
                 } else {
                     binding.ivBenefit.visibility = View.GONE
                 }
+
+                if (it.user_wealth_level.toInt()>=10){
+                    //查询直播间在线时长与奖励领取情况
+                    if (getOnlineRewards){
+                        getOnlineRewards = false
+                        roomVm.getOnlineRewards()
+                    }
+                } else {
+                    binding.ivRewards.checkOnlineTime(null)
+                    binding.ivRewards.visibility = View.VISIBLE
+                }
             }
         }
 

+ 4 - 0
room/src/main/java/com/swago/room/bean/UserRoomModel.kt

@@ -221,4 +221,8 @@ class UserRoomModel : IRoomInfo {
             roomModel?.chat_special ?: ""
         }
     }
+
+    override fun getTimeKey(): String {
+        return roomModel?.time_key ?: ""
+    }
 }

+ 11 - 2
room/src/main/java/com/swago/room/dialog/FooterMoreDialog.kt

@@ -9,6 +9,7 @@ import com.swago.baseswago.baseroom.SwagoRoomManager
 import com.swago.baseswago.dialog.BaseXDFragment
 import com.swago.baseswago.util.NoDoubleClickListener
 import com.swago.baseswago.util.SwagoLoading
+import com.swago.room.R
 import com.swago.room.bean.UserRoomModel
 import com.swago.room.databinding.DialogAudioNoticeBinding
 import com.swago.room.databinding.DialogFooterMoreBinding
@@ -20,6 +21,7 @@ class FooterMoreDialog : BaseXDFragment<DialogFooterMoreBinding>() {
     var openShareFun:(()->Unit)? = null
     var openMusicFun:(()->Unit)? = null
     var clearJifenFun:(()->Unit)? = null
+    private var mType = 0
 
     init {
         setGravity(Gravity.BOTTOM)
@@ -28,9 +30,10 @@ class FooterMoreDialog : BaseXDFragment<DialogFooterMoreBinding>() {
     }
 
     companion object{
-        fun newInstance(unReadNum:Long): FooterMoreDialog {
+        fun newInstance(unReadNum:Long,type:Int): FooterMoreDialog {
             val args = Bundle()
             args.putLong("unReadNum", unReadNum)
+            args.putInt("type",type)
             val fragment = FooterMoreDialog()
             fragment.arguments = args
             return fragment
@@ -44,17 +47,23 @@ class FooterMoreDialog : BaseXDFragment<DialogFooterMoreBinding>() {
     override fun initLiveData() {
         arguments?.let {
             val unReadNum = it.getLong("unReadNum",0)
+            mType = it.getInt("type")
             if (unReadNum > 0){
                 binding.tvNum.visibility = View.VISIBLE
                 binding.tvNum.text = "$unReadNum"
             } else {
                 binding.tvNum.visibility = View.GONE
             }
+            if (mType == 1){
+                binding.ivShare.setImageResource(R.mipmap.live_share)
+            } else if (mType == 2){
+                binding.ivShare.setImageResource(R.mipmap.live_lianmai_user)
+            }
         }
         SwagoRoomManager.iRoomInfo?.let{
             if (it.getRoomType() == 2){
                 binding.ivClearJifen.visibility = View.VISIBLE
-            } else if (it.getRoomType() == 1){
+            } else if (it.getRoomType() == 1 && mType == 1){
                 binding.ivVideoMusic.visibility = View.VISIBLE
             }
         }

+ 23 - 1
room/src/main/java/com/swago/room/gift/GiftDialog.kt

@@ -134,6 +134,19 @@ class GiftDialog : BaseXDFragment<DialogGiftBinding>() {
                     binding.rvAudioUser.layoutManager = LinearLayoutManager(activity,RecyclerView.HORIZONTAL,false)
                     binding.rvAudioUser.adapter = adapter
                     adapter.setOnItemClickListener { _, view, position ->
+                        if (type == 2){
+                            if (adapter.data[position].selected){
+                                return@setOnItemClickListener
+                            }
+                            adapter.data.forEachIndexed { index, maiUserInfo ->
+                                adapter.data[index].selected = false
+                            }
+                            adapter.data[position].selected = true
+                            selectedUserList.clear()
+                            selectedUserList.add(adapter.data[position].user_id)
+                            adapter.notifyDataSetChanged()
+                            return@setOnItemClickListener
+                        }
                         adapter.data[position].selected = !adapter.data[position].selected
                         if (adapter.data[position].selected){
                             selectedUserList.add(adapter.data[position].user_id)
@@ -326,6 +339,15 @@ class GiftDialog : BaseXDFragment<DialogGiftBinding>() {
                 override fun onPageSelected(position: Int) {
                     type = position + 1
                     binding.combo.visibility = View.GONE
+                    if (type == 2 && adapter.data.size > 0){
+                        adapter.data.forEachIndexed { index, _ ->
+                            adapter.data[index].selected = false
+                        }
+                        adapter.data[0].selected = true
+                        selectedUserList.clear()
+                        selectedUserList.add(adapter.data[0].user_id)
+                        adapter.notifyDataSetChanged()
+                    }
                 }
             })
 
@@ -800,8 +822,8 @@ class GiftDialog : BaseXDFragment<DialogGiftBinding>() {
                     if (it.receivers.isNotEmpty())
                         receiverName.deleteCharAt(receiverName.length - 1)
                     it.im_data.data.receiverName = receiverName.toString()
+                    it.im_data.data.svga = it.svgaUrl
                     msgVm.playSvgUrl?.invoke(it.im_data.data ,true)
-                    msgVm.addAudioGiftAnimFun?.invoke(it)
                 }
             }
             if (type == 2 || type == 3) {

+ 3 - 1
room/src/main/java/com/swago/room/manager/JoinRoomManager.kt

@@ -30,6 +30,7 @@ import com.swago.loadUrl
 import com.swago.room.R
 import de.hdodenhof.circleimageview.CircleImageView
 import java.io.File
+import java.lang.ref.WeakReference
 import java.net.URL
 import java.util.LinkedList
 
@@ -59,7 +60,8 @@ class JoinRoomManager : IRoomActiveListener {
 
     fun initViewStub(viewStub: ViewStub?, activity: FragmentActivity?) {
         mActivity = activity
-        svgParser = SVGAParser(mActivity)
+        val activityRef = WeakReference(mActivity)
+        svgParser = SVGAParser(activityRef.get())
         viewStub?.apply {
             val view = this.inflate()
             svgaImageView = view.findViewById(R.id.svgaImageView)

+ 3 - 1
room/src/main/java/com/swago/room/piaotiao/WaftView.kt

@@ -23,6 +23,7 @@ import com.swago.baseswago.util.SwagoInfo
 import com.swago.loadUrl
 import com.swago.room.R
 import com.swago.room.databinding.ViewWaftBinding
+import java.lang.ref.WeakReference
 import java.net.URL
 import java.util.*
 
@@ -45,7 +46,8 @@ class WaftView : FrameLayout {
 
     private fun initView(context: Context) {
         binding = ViewWaftBinding.inflate(LayoutInflater.from(context), this, true)
-        svgaParser = SVGAParser(context)
+        val activityRef = WeakReference(context)
+        svgaParser = SVGAParser(activityRef.get())
         this.context = context
     }
 

+ 13 - 2
room/src/main/java/com/swago/room/pk/PkVm.kt

@@ -97,7 +97,6 @@ class PkVm(application: Application) : AbsMsgVm(application) {
                             ipkListener.stopPK(stopPKModel)
                         }
                     }
-                    pkState?.invoke(false)
                 }
                 2 -> {
                     if (PKStateManager.roomState != PKStateManager.PK) {
@@ -177,7 +176,19 @@ class PkVm(application: Application) : AbsMsgVm(application) {
             ApiManager.roomApi.pkSure(pkId)
         }
     }
-
+    /**
+     * 加入pk频道异常
+     */
+    fun pkJoinFail(pkId: String) {
+        requestData {
+            ApiManager.roomApi.pkJoinFail(pkId)
+            Toast.makeText(
+                AppContext.getContext(),
+                AppContext.getContext().getString(R.string.pk_failed_re_pk),
+                Toast.LENGTH_LONG
+            ).show()
+        }
+    }
 
     val acceptOrRefuseLiveData by lazy {
         MutableLiveData<Int>()

+ 53 - 0
room/src/main/java/com/swago/room/reward/GetRewardsDialog.kt

@@ -0,0 +1,53 @@
+package com.swago.room.reward
+
+import android.os.Bundle
+import android.view.Gravity
+import com.swago.baseswago.dialog.BaseXDFragment
+import com.swago.baseswago.util.NoDoubleClickListener
+import com.swago.room.R
+import com.swago.room.databinding.DialogGetRewardsBinding
+
+class GetRewardsDialog : BaseXDFragment<DialogGetRewardsBinding>() {
+    private var duration :String =""
+    var openGetCoins:((duration:String) ->Unit)? = null
+    init {
+        setGravity(Gravity.CENTER)
+        setDimAmount(0.5f)
+        setCanCancel(false)
+    }
+
+    companion object{
+        fun newInstance(duration : String, coins : Int, nextCoins : Int,nextTimes : Int ): GetRewardsDialog {
+            val args = Bundle()
+            args.putString("duration",duration)
+            args.putInt("coins",coins)
+            args.putInt("nextCoins",nextCoins)
+            args.putInt("nextTimes",nextTimes)
+            val fragment = GetRewardsDialog()
+            fragment.arguments = args
+            return fragment
+        }
+    }
+
+    override fun initOther() {
+        arguments?.let {
+            duration = it.getString("duration","")
+            val coins = it.getInt("coins")
+            val nextCoins = it.getInt("nextCoins")
+            val nextTimes = it.getInt("nextTimes")
+            binding.tvCoins.text = "+${coins}"
+            binding.tvHint.text= getString(R.string.continue_in_room_earn_coins).format(nextTimes,nextCoins)
+
+        }
+
+        binding.tvSure.setOnClickListener(object: NoDoubleClickListener(){
+            override fun onClick() {
+                openGetCoins?.invoke(duration)
+                dismissAllowingStateLoss()
+            }
+        })
+    }
+
+    override fun initLiveData() {
+    }
+}

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

@@ -0,0 +1,262 @@
+package com.swago.room.reward
+
+import android.animation.Animator
+import android.animation.ObjectAnimator
+import android.content.Context
+import android.util.AttributeSet
+import android.view.LayoutInflater
+import android.view.View
+import android.widget.FrameLayout
+import android.widget.Toast
+import com.swago.baseswago.baseroom.IRoomActiveListener
+import com.swago.baseswago.baseroom.IRoomInfo
+import com.swago.baseswago.baseroom.RoomTimer
+import com.swago.baseswago.baseroom.SwagoRoomManager
+import com.swago.baseswago.model.RedEnvelope
+import com.swago.baseswago.model.live.OnlineRewardsModel
+import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.LogUtil
+import com.swago.baseswago.util.NoDoubleClickListener
+import com.swago.baseswago.util.TimeUtil
+import com.swago.room.R
+import com.swago.room.databinding.ViewRewardsBinding
+
+
+class RewardView : FrameLayout, IRoomActiveListener, RoomTimer.TimeTickListener {
+    private var binding: ViewRewardsBinding? = null
+    private var timeL = 300L //倒计时
+    private var totalTime = 0L //在直播间里时间
+    private var duration: String = ""
+    private var coins: Int = 0
+    private var nextCoins: Int = 0
+    private var nextTime: Int = 0
+    private var showChangeRoom = false
+    private var countdownOver = false //倒计时是否结束
+    private var rewardsModel: OnlineRewardsModel? = null
+    private var scaleXAnimator: ObjectAnimator? = null
+    private var scaleYAnimator: ObjectAnimator? = null
+    var openGetCoins: ((duration: String, coins: Int, nextCoins: Int, nextTime: Int) -> Unit)? =
+        null
+    var countdownOverFun: (() -> Unit)?= null
+
+    private
+    constructor(context: Context) : this(context, null)
+    constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
+    constructor(context: Context, attrs: AttributeSet?, defStyle: Int) : super(
+        context,
+        attrs,
+        defStyle
+    ) {
+        initView()
+    }
+
+    private fun initView() {
+        SwagoRoomManager.addListener(this)
+        RoomTimer.timeTickList.add(this)
+        binding = ViewRewardsBinding.inflate(LayoutInflater.from(context), this, true)
+
+        binding?.ivRewards?.setOnClickListener(object : NoDoubleClickListener() {
+            override fun onClick() {
+                if (rewardsModel == null) {
+                    Toast.makeText(
+                        AppContext.getContext(),
+                        AppContext.getContext().getString(R.string.user_above_level_10),
+                        Toast.LENGTH_SHORT
+                    ).show()
+                    return
+                }
+                if (scaleXAnimator?.isRunning == true && countdownOver){
+                    openGetCoins?.invoke(duration, coins, nextCoins, nextTime)
+                }
+            }
+        })
+        startAnimation()
+    }
+
+    private fun startAnimation() {
+        // 创建X轴放大的动画
+        scaleXAnimator = ObjectAnimator.ofFloat(binding?.clReward, "scaleX", 1.0f, 1.05f)
+        scaleXAnimator?.setDuration(500)
+        scaleXAnimator?.repeatCount = ObjectAnimator.INFINITE
+        scaleXAnimator?.repeatMode = ObjectAnimator.REVERSE
+
+        // 创建Y轴放大的动画
+        scaleYAnimator = ObjectAnimator.ofFloat(binding?.clReward, "scaleY", 1.0f, 1.05f)
+        scaleYAnimator?.setDuration(500)
+        scaleYAnimator?.repeatCount = ObjectAnimator.INFINITE
+        scaleYAnimator?.repeatMode = ObjectAnimator.REVERSE
+
+    }
+
+    override fun changeRoom(iRoomInfo: IRoomInfo) {
+
+    }
+
+    override fun leaveRoom(iRoomInfo: IRoomInfo) {
+        visibility = View.GONE
+    }
+
+    override fun joinedRoom(iRoomInfo: IRoomInfo) {
+        if (showChangeRoom){
+            visibility = View.VISIBLE
+        }
+    }
+
+    override fun endRoom(iRoomInfo: IRoomInfo?) {
+
+    }
+
+    override fun closeRoomed() {
+        scaleXAnimator?.cancel()
+        scaleYAnimator?.cancel()
+        scaleXAnimator = null
+        scaleYAnimator = null
+        RoomTimer.timeTickList.remove(this)
+        SwagoRoomManager.removeListener(this)
+    }
+
+    override fun onTimeCount(time: Int) {
+        if (timeL == 0L){
+            if (scaleXAnimator?.isRunning == false && rewardsModel != null){
+                startGetAnimation()
+                countdownOverFun?.invoke()
+            }
+        } else {
+            totalTime ++
+            timeL--
+            binding?.tvTime?.text = TimeUtil.convertMinSecond(timeL)
+        }
+
+    }
+
+    fun checkOnlineTime(model: OnlineRewardsModel?) {
+        showChangeRoom = true
+        if (model == null) {
+            rewardsModel = null
+            binding?.tvTime?.setBackgroundResource(R.mipmap.bg_get_reward)
+            binding?.tvTime?.text = "Get!"
+            timeL = 0L
+            return
+        }
+        rewardsModel = model
+        visibility = View.VISIBLE
+        totalTime = model.onlineDuration * 60L
+        nextReward()
+    }
+
+    private fun startGetAnimation() {
+        // 启动动画
+        timeL = 0L
+        scaleXAnimator?.start()
+        scaleYAnimator?.start()
+        binding?.tvTime?.setBackgroundResource(R.mipmap.bg_get_reward)
+        binding?.tvTime?.text = "Get!"
+    }
+
+    fun setRewardsSuccess(success:Boolean){
+        countdownOver = false
+        if (success){
+            scaleXAnimator?.cancel()
+            scaleYAnimator?.cancel()
+            binding?.tvTime?.setBackgroundResource(R.mipmap.bg_time_reward)
+            when(duration){
+                "five" -> {
+                    totalTime = totalTime.coerceAtLeast(300)
+                    rewardsModel?.five = true
+                    nextReward()
+                }
+                "ten" -> {
+                    totalTime = totalTime.coerceAtLeast(900)
+                    rewardsModel?.ten = true
+                    nextReward()
+                }
+                "fifteen" -> {
+                    totalTime = totalTime.coerceAtLeast(1800)
+                    rewardsModel?.fifteen = true
+                    nextReward()
+                }
+                "thirty" -> {
+                    totalTime = totalTime.coerceAtLeast(3600)
+                    rewardsModel?.thirty = true
+                    visibility = View.GONE
+                    showChangeRoom = false
+                }
+            }
+        }
+    }
+    private fun nextReward(){
+        rewardsModel?.let { model ->
+            //待领取的奖励
+            if (!model.five){
+                visibility = View.VISIBLE
+                coins = model.coin.five
+                duration = "five"
+                nextCoins = model.coin.ten
+                nextTime = 10
+                binding?.tvCoins?.text = "+${model.coin.five}"
+                //领取奖励倒计时
+                if (totalTime >= 300){
+                    startGetAnimation()
+                } else {
+                    timeL = 300 - totalTime
+                    binding?.tvTime?.text = TimeUtil.convertMinSecond(timeL)
+                }
+            } else if (!model.ten){
+                visibility = View.VISIBLE
+                coins = model.coin.ten
+                duration = "ten"
+                nextCoins = model.coin.fifteen
+                nextTime = 15
+                binding?.tvCoins?.text = "+${model.coin.ten}"
+
+                //领取奖励倒计时
+                if (totalTime >= 900){
+                    startGetAnimation()
+                } else {
+                    timeL = 900 - totalTime
+                    binding?.tvTime?.text = TimeUtil.convertMinSecond(timeL)
+                }
+            } else if (!model.fifteen){
+                visibility = View.VISIBLE
+                coins = model.coin.fifteen
+                duration = "fifteen"
+                nextCoins = model.coin.thirty
+                nextTime = 30
+                binding?.tvCoins?.text = "+${model.coin.fifteen}"
+                //领取奖励倒计时
+                if (totalTime >= 1800){
+                    startGetAnimation()
+                } else {
+                    timeL = 1800 - totalTime
+                    binding?.tvTime?.text = TimeUtil.convertMinSecond(timeL)
+                }
+            } else if (!model.thirty){
+                visibility = View.VISIBLE
+                coins = model.coin.thirty
+                duration = "thirty"
+                nextCoins = 0
+                nextTime = 0
+                binding?.tvCoins?.text = "+${model.coin.thirty}"
+                //领取奖励倒计时
+                if (totalTime >= 3600){
+                    startGetAnimation()
+                } else {
+                    timeL = 3600 - totalTime
+                    binding?.tvTime?.text = TimeUtil.convertMinSecond(timeL)
+                }
+            } else {
+                visibility =View.GONE
+                showChangeRoom = false
+            }
+
+        }
+
+    }
+
+    /**
+     * 倒计时结束成功
+     * */
+    fun countdownOverSuccess(){
+        countdownOver = true
+    }
+}

+ 57 - 18
room/src/main/java/com/swago/room/user/UserRoomFragment.kt

@@ -3,10 +3,12 @@ package com.swago.room.user
 import android.view.View
 import android.widget.Toast
 import androidx.constraintlayout.widget.ConstraintLayout
+import com.alibaba.android.arouter.launcher.ARouter
 import com.google.gson.Gson
 import com.swago.baseswago.PersonDataDFragment
 import com.swago.baseswago.baseroom.IRoomInfo
 import com.swago.baseswago.baseroom.SwagoRoomManager
+import com.swago.baseswago.constant.ARouteConstant
 import com.swago.baseswago.dialog.BenefitBagDialog
 import com.swago.baseswago.dialog.EnterPasswordDialog
 import com.swago.baseswago.dialog.ReportDialog
@@ -17,6 +19,7 @@ import com.swago.baseswago.model.live.pk.StopPKModel
 import com.swago.baseswago.util.AppContext
 import com.swago.baseswago.util.NoDoubleClickListener
 import com.swago.baseswago.util.SpUtil
+import com.swago.baseswago.util.TimeUtil
 import com.swago.baseswago.util.UserInfo
 import com.swago.room.R
 import com.swago.room.audio.UserByAnchorInviteDialog
@@ -24,6 +27,7 @@ import com.swago.room.base.BaseComFragment
 import com.swago.room.bean.UserRoomModel
 import com.swago.room.databinding.FragmentBaseComBinding
 import com.swago.room.dialog.AudioNoticeUserDialog
+import com.swago.room.dialog.FooterMoreDialog
 import com.swago.room.dialog.ShareDialog
 import com.swago.room.game.GameListDialog
 import com.swago.room.gift.GiftDialog
@@ -33,6 +37,7 @@ import com.swago.room.hongbao.RedEnvelopeDialog
 import com.swago.room.inter.IFooter
 import com.swago.room.inter.IHeader
 import com.swago.room.lianmai.UserLianMaiDialog
+import com.swago.room.pk.PKStateManager
 import com.swago.room.widget.ComHeaderView
 import com.swago.room.widget.UserFooterView
 import com.swago.room.wishgift.WishGiftOnUserDialog
@@ -45,22 +50,12 @@ import kotlinx.coroutines.launch
  *description:
  */
 class UserRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
-
+    private var isSameDate:Boolean = false
     override fun initOther() {
         super.initOther()
         binding.ivBenefit.setOnClickListener(object : NoDoubleClickListener() {
             override fun onClick() {
-                val dialog = BenefitBagDialog.newInstance()
-                dialog.benefitIconDismissFun = {
-                    UserInfo.getUserInfo()?.let {
-                        if (it.is_benefit == 0) {
-                            binding.ivBenefit.visibility = View.VISIBLE
-                        } else {
-                            binding.ivBenefit.visibility = View.GONE
-                        }
-                    }
-                }
-                dialog.show(childFragmentManager, "BenefitBagDialog")
+                openBenefitBagDialog()
             }
         })
 
@@ -127,8 +122,12 @@ class UserRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
             openShareDialog()
         }
 
-        footerView.openLianMaiFun = {
-            openLianMaiListDialog()
+        footerView.openMoreDialog = {
+            openMoreDialog()
+        }
+
+        footerView.openMandateFun = {
+            ARouter.getInstance().build(ARouteConstant.User.taskCenter).navigation()
         }
 
         unreadMessageVm.unreadMessageData.observe(this){
@@ -230,11 +229,12 @@ class UserRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
 
             }.show(parentFragmentManager , "EnterPasswordDialog")
         }
-    }
 
-
-    private fun openLianMaiListDialog() {
-        UserLianMaiDialog.newInstance().show(childFragmentManager,"UserLianMaiDialog")
+        payVm.benefitLiveData.observe(this){
+            if (it.is_benefit==0&&it.is_pop_discount_package==0){
+                BenefitBagDialog.newInstance().show(childFragmentManager, "BenefitBagDialog")
+            }
+        }
     }
 
     fun dismissDialog() {
@@ -250,6 +250,26 @@ class UserRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
         this.broadcastStatus = broadcastStatus
     }
 
+    private fun openMoreDialog(){
+        FooterMoreDialog.newInstance(unReadNum, 2).apply {
+            openMessageFun = {
+                openMessageListDialog()
+            }
+            openShareFun = {
+                if (PKStateManager.roomState==1){
+                    openLianMaiListDialog()
+                }else{
+                    Toast.makeText(AppContext.getContext(), "当前主播正在PK,请稍后", Toast.LENGTH_SHORT).show()
+                }
+
+            }
+        }.show(childFragmentManager , "FooterMoreDialog")
+    }
+
+    private fun openLianMaiListDialog() {
+        UserLianMaiDialog.newInstance().show(childFragmentManager,"UserLianMaiDialog")
+    }
+
     override fun changeRoom(iRoomInfo: IRoomInfo) {
         super.changeRoom(iRoomInfo)
     }
@@ -265,6 +285,10 @@ class UserRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
                 AudioNoticeUserDialog.newInstance().show(childFragmentManager,"AudioNoticeUserDialog")
             }
         }
+        if (!isSameDate){
+            isSameDate = true
+            payVm.getBenefit()
+        }
     }
 
     override fun endRoom(iRoomInfo: IRoomInfo?) {
@@ -274,6 +298,21 @@ class UserRoomFragment : BaseComFragment<FragmentBaseComBinding>() {
         super.closeRoomed()
     }
 
+    private fun openBenefitBagDialog(){
+        BenefitBagDialog.newInstance().apply {
+            this.benefitIconDismissFun = {
+                UserInfo.getUserInfo()?.let {
+                    if (it.is_benefit == 0) {
+                        this@UserRoomFragment.binding.ivBenefit.visibility = View.VISIBLE
+                    } else {
+                        this@UserRoomFragment.binding.ivBenefit.visibility = View.GONE
+                    }
+                }
+            }
+        }.show(childFragmentManager, "BenefitBagDialog")
+    }
+
+
     /*********************PK**************************/
     override fun startPK(startPKModel: StartPKModel, isGetDataFromIM: Boolean) {
     }

+ 3 - 1
room/src/main/java/com/swago/room/vm/MsgVm.kt

@@ -731,6 +731,7 @@ class MsgVm(application: Application) : AbsMsgVm(application) {
                                     imGiftModel.giftEnName = it.giftEnName
                                     imGiftModel.senderName = it.senderName
                                     imGiftModel.multiple = it.multiple
+                                    imGiftModel.svga = it.svgaUrl
                                     val receiverName = StringBuffer()
                                     it.receivers.forEach {
                                         receiverName.append("${it.receiverName} ,")
@@ -740,9 +741,10 @@ class MsgVm(application: Application) : AbsMsgVm(application) {
                                     imGiftModel.receiverName = receiverName.toString()
 
                                     playSvgUrl?.invoke(imGiftModel ,true)
+                                } else {
+                                    addAudioGiftAnimFun?.invoke(it)
                                 }
 
-                                addAudioGiftAnimFun?.invoke(it)
                             }
                         }
 

+ 52 - 2
room/src/main/java/com/swago/room/vm/RoomVm.kt

@@ -291,9 +291,9 @@ class RoomVm(application: Application) : AbsRoomVm(application) {
         requestData2(false) {
             requestData {
                 if (iRoomInfo.getRoomType() == RoomType.HOUSE.type){
-                    ApiManager.roomApi.houseLeaveRoom(iRoomInfo.getRoomId())
+                    ApiManager.roomApi.houseLeaveRoom(iRoomInfo.getRoomId(),iRoomInfo.getTimeKey())
                 } else {
-                    ApiManager.roomApi.leaveRoom(iRoomInfo.getRoomId())
+                    ApiManager.roomApi.leaveRoom(iRoomInfo.getRoomId(),iRoomInfo.getTimeKey())
                 }
             }
 
@@ -520,4 +520,54 @@ class RoomVm(application: Application) : AbsRoomVm(application) {
         }
     }
 
+    /**
+     *查询直播间在线时长与奖励领取情况
+     * */
+    val onlineRewardsData by lazy {
+        MutableLiveData<OnlineRewardsModel>()
+    }
+    fun getOnlineRewards(){
+        requestData2(false) {
+            requestData {
+                val data = ApiManager.roomApi.getOnlineRewards()
+                onlineRewardsData.value = data
+            }
+        }
+    }
+    /**
+     *奖励领取成功
+     * */
+    val getRewardsSuccess by lazy {
+        MutableLiveData<Boolean>()
+    }
+    fun receiveOnlineRewards(duration:String){
+        requestData2(false) {
+            requestData {
+                 ApiManager.roomApi.receiveOnlineRewards(duration)
+                 getRewardsSuccess.value = true
+                Toast.makeText(
+                    AppContext.getContext(),
+                    AppContext.getContext().getString(R.string.successful_collection),
+                    Toast.LENGTH_SHORT
+                ).show()
+            }
+
+            requestError{
+                Toast.makeText(AppContext.getContext(), it.message, Toast.LENGTH_SHORT).show()
+            }
+        }
+    }
+
+    /**
+     *倒计时结束
+     * */
+    val countdownOver by lazy {
+        MutableLiveData<Boolean>()
+    }
+    fun countdownOverRewards(time_key:String){
+        requestData {
+            ApiManager.roomApi.countdownOverRewards(time_key)
+            countdownOver.value = true
+        }
+    }
 }

+ 1 - 1
room/src/main/java/com/swago/room/widget/ComHeaderView.kt

@@ -88,7 +88,7 @@ class ComHeaderView  : ConstraintLayout, IRoomActiveListener, IHeader, RoomTimer
             }
         })
 
-        binding.tvIncome.setOnClickListener(object:NoDoubleClickListener(){
+        binding.clIncome.setOnClickListener(object:NoDoubleClickListener(){
             override fun onClick() {
                 ARouter.getInstance()
                     .build(ARouteConstant.Room.rankList)

+ 15 - 9
room/src/main/java/com/swago/room/widget/UserFooterView.kt

@@ -32,7 +32,8 @@ class UserFooterView : ConstraintLayout, IFooter,IRoomActiveListener {
     var openGiftPanelFun:(()->Unit)? = null
     var openGameFun:(()->Unit)? = null
     var openShareFun:(()->Unit)? = null
-    var openLianMaiFun:(()->Unit)? = null
+    var openMoreDialog:(()->Unit)? = null
+    var openMandateFun:(()->Unit)? = null
 
     constructor(context: Context) : this(context, null)
     constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
@@ -78,15 +79,18 @@ class UserFooterView : ConstraintLayout, IFooter,IRoomActiveListener {
             }
         })
 
-        binding.ivLianMai.setOnClickListener(object : NoDoubleClickListener() {
+        binding.ivMore.setOnClickListener(object : NoDoubleClickListener(){
             override fun onClick() {
-                if (PKStateManager.roomState==1){
-                    openLianMaiFun?.invoke()
-                }else{
-                    Toast.makeText(AppContext.getContext(), "当前主播正在PK,请稍后", Toast.LENGTH_SHORT).show()
-                }
+                openMoreDialog?.invoke()
+            }
+
+        })
 
+        binding.ivMandate.setOnClickListener(object : NoDoubleClickListener(){
+            override fun onClick() {
+                openMandateFun?.invoke()
             }
+
         })
     }
 
@@ -109,11 +113,13 @@ class UserFooterView : ConstraintLayout, IFooter,IRoomActiveListener {
     override fun joinedRoom(iRoomInfo: IRoomInfo) {
         visibility = View.VISIBLE
         if (iRoomInfo.getRoomType() == RoomType.AUDIO.type || iRoomInfo.getRoomType() == RoomType.HOUSE.type){
-            binding.ivLianMai.visibility = View.GONE
             binding.ivShare.visibility = View.VISIBLE
+            binding.ivMore.visibility = View.GONE
+            binding.clMessage.visibility = View.VISIBLE
         }else if(iRoomInfo.getRoomType() == RoomType.VIDEO.type){
-            binding.ivLianMai.visibility = View.VISIBLE
             binding.ivShare.visibility = View.VISIBLE
+            binding.ivMore.visibility = View.VISIBLE
+            binding.clMessage.visibility = View.GONE
         }
     }
 

+ 5 - 0
room/src/main/res/drawable/shape_b131f6_12.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="#b131f6"/>
+    <corners android:radius="12dp"/>
+</shape>

+ 102 - 0
room/src/main/res/layout/dialog_get_rewards.xml

@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:tools="http://schemas.android.com/tools"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:layout_marginStart="40dp"
+        android:layout_marginEnd="40dp"
+        android:background="@mipmap/bg_dialog_rewards"
+        app:layout_constraintTop_toTopOf="parent"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+
+        <TextView
+            android:id="@+id/tvTitle"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            android:layout_marginTop="150dp"
+            android:textSize="16sp"
+            android:textStyle="bold"
+            android:textColor="@color/_ffffff"
+            android:text="@string/congratulations"
+            android:drawablePadding="2dp"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+        <TextView
+            android:id="@+id/tvGet"
+            app:layout_constraintTop_toBottomOf="@+id/tvTitle"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            android:layout_marginTop="12dp"
+            android:textSize="14sp"
+            android:textColor="@color/_ffffff"
+            android:text="@string/you_get"
+            android:drawablePadding="2dp"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/clCoins"
+            android:layout_width="match_parent"
+            android:layout_height="64dp"
+            android:layout_marginStart="30dp"
+            android:layout_marginEnd="30dp"
+            android:layout_marginTop="12dp"
+            android:background="@drawable/shape_b131f6_12"
+            app:layout_constraintTop_toBottomOf="@+id/tvGet">
+            <TextView
+                android:id="@+id/tvCoins"
+                android:gravity="center"
+                android:textSize="27sp"
+                android:textColor="#fff"
+                tools:text= "+0"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:layout_constraintBottom_toBottomOf="parent"
+                android:drawableLeft="@mipmap/icon_coin"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"/>
+        </androidx.constraintlayout.widget.ConstraintLayout>
+
+        <TextView
+            android:id="@+id/tvHint"
+            app:layout_constraintTop_toBottomOf="@+id/clCoins"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            android:layout_marginTop="10dp"
+            android:textSize="12sp"
+            android:layout_marginStart="30dp"
+            android:layout_marginEnd="30dp"
+            android:gravity="center"
+            android:textColor="@color/_ffffff"
+            tools:text="sssssss"
+            android:drawablePadding="2dp"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"/>
+
+        <TextView
+            android:id="@+id/tvSure"
+            android:textSize="18sp"
+            android:textColor="#704200"
+            android:text="Get"
+            android:gravity="center"
+            android:layout_marginStart="24dp"
+            android:layout_marginEnd="24dp"
+            android:layout_marginBottom="10dp"
+            android:textStyle="bold"
+            app:layout_constraintBottom_toBottomOf="parent"
+            android:background="@mipmap/bg_rewards_buttom"
+            app:layout_constraintTop_toBottomOf="@+id/tvHint"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            android:layout_width="0dp"
+            android:layout_height="80dp"/>
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 16 - 4
room/src/main/res/layout/fragment_base_com.xml

@@ -97,13 +97,25 @@
 
     <com.swago.room.widget.RecommendBannerView
         android:id="@+id/playBannerView"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/ivRewards"
         app:layout_constraintEnd_toEndOf="parent"
         tools:visibility="visible"
         android:visibility="gone"
+        android:layout_marginTop="@dimen/dp_10"
         android:layout_marginRight="2dp"
-        android:layout_marginTop="280dp"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"/>
+
+
+    <com.swago.room.reward.RewardView
+        android:id="@+id/ivRewards"
+        app:layout_constraintTop_toBottomOf="@+id/ivBenefit"
+        app:layout_constraintEnd_toEndOf="parent"
+        android:layout_marginEnd="6dp"
+        tools:visibility="visible"
+        android:visibility="gone"
+        android:layout_marginTop="@dimen/dp_10"
+        android:src="@mipmap/icon_rewards"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"/>
 
@@ -231,6 +243,6 @@
     <com.swago.room.audio.widget.AudioContainGiftView
         android:id="@+id/audioAllGiftView"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"/>
+        android:layout_height="match_parent" />
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 24 - 12
room/src/main/res/layout/layout_user_footer_view.xml

@@ -41,22 +41,11 @@
         android:layout_width="40dp"
         android:layout_height="40dp"/>
 
-    <ImageView
-        android:id="@+id/ivLianMai"
-        android:layout_marginStart="10dp"
-        app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintStart_toEndOf="@+id/ivChat"
-        android:background="@drawable/shape_80000000_20"
-        android:src="@mipmap/live_lianmai_user"
-        android:padding="7dp"
-        android:layout_width="40dp"
-        android:layout_height="40dp"/>
-
     <ImageView
         android:id="@+id/ivShare"
         android:layout_marginStart="10dp"
         app:layout_constraintTop_toTopOf="parent"
-        app:layout_constraintStart_toEndOf="@+id/ivLianMai"
+        app:layout_constraintStart_toEndOf="@+id/ivChat"
         android:background="@drawable/shape_80000000_20"
         android:src="@mipmap/live_share"
         android:padding="7dp"
@@ -64,6 +53,7 @@
         android:layout_height="40dp"/>
 
     <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/cl_Message"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         app:layout_constraintTop_toTopOf="parent"
@@ -93,6 +83,28 @@
             android:background="@drawable/shape_d54941_circle"/>
     </androidx.constraintlayout.widget.ConstraintLayout>
 
+    <ImageView
+        android:id="@+id/ivMandate"
+        android:layout_marginStart="10dp"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintStart_toEndOf="@+id/cl_Message"
+        android:background="@drawable/shape_80000000_20"
+        android:src="@mipmap/icon_mandate"
+        android:padding="7dp"
+        android:layout_width="40dp"
+        android:layout_height="40dp"/>
 
+    <ImageView
+        android:id="@+id/ivMore"
+        android:layout_marginStart="10dp"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintStart_toEndOf="@+id/ivMandate"
+        android:visibility="gone"
+        tools:visibility="visible"
+        android:background="@drawable/shape_80000000_20"
+        android:src="@mipmap/live_more"
+        android:padding="3dp"
+        android:layout_width="40dp"
+        android:layout_height="40dp"/>
 
 </androidx.constraintlayout.widget.ConstraintLayout>

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

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="52dp"
+    android:layout_height="52dp"
+    android:id="@+id/clReward"
+    android:layout_marginEnd="2dp"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools">
+
+    <ImageView
+        android:id="@+id/ivRewards"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        android:src="@mipmap/icon_rewards"
+        android:layout_marginEnd="@dimen/dp_4"
+        android:layout_marginTop="6dp"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"/>
+
+    <TextView
+        android:id="@+id/tvTime"
+        android:textColor="#fff"
+        tools:text="0"
+        android:gravity="center_horizontal"
+        android:textSize="8dp"
+        android:layout_marginTop="2dp"
+        android:background="@mipmap/bg_time_reward"
+        app:layout_constraintTop_toTopOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        android:layout_width="29dp"
+        android:layout_height="15dp"/>
+    
+    <TextView
+        android:id="@+id/tvCoins"
+        android:textSize="10dp"
+        android:textColor="#fff"
+        tools:text="0"
+        android:text="20"
+        android:layout_marginEnd="@dimen/dp_4"
+        android:gravity="center"
+        android:drawableLeft="@mipmap/ic_coin_store"
+        android:layout_marginBottom="3dp"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"/>
+    
+
+</androidx.constraintlayout.widget.ConstraintLayout>

BIN
room/src/main/res/mipmap-xxhdpi/bg_dialog_rewards.png


BIN
room/src/main/res/mipmap-xxhdpi/bg_get_reward.png


BIN
room/src/main/res/mipmap-xxhdpi/bg_rewards_buttom.png


BIN
room/src/main/res/mipmap-xxhdpi/bg_time_reward.png


BIN
room/src/main/res/mipmap-xxhdpi/icon_mandate.png


+ 53 - 36
user/src/main/java/com/swago/user/EditInfoActivity.kt

@@ -1,5 +1,6 @@
 package com.swago.user
 
+import android.Manifest
 import android.content.Intent
 import android.os.Bundle
 import android.text.Editable
@@ -17,6 +18,7 @@ import com.bumptech.glide.Glide
 import com.huantansheng.easyphotos.EasyPhotos
 import com.huantansheng.easyphotos.callback.SelectCallback
 import com.huantansheng.easyphotos.models.album.entity.Photo
+import com.permissionx.guolindev.PermissionX
 import com.swago.baseswago.UserVm
 import com.swago.baseswago.activity.BaseXActivity
 import com.swago.baseswago.constant.ARouteConstant
@@ -204,45 +206,54 @@ class EditInfoActivity : BaseXActivity<ActivityUserEditBinding>() {
 
         binding.ivAvatar.setOnClickListener(object : NoDoubleClickListener() {
             override fun onClick() {
-                EasyPhotos.createAlbum(
-                    this@EditInfoActivity,
-                    false,
-                    false,
-                    GlideEngine.getInstance()
-                )
-                    .setFileProviderAuthority(AppContext.getContext().packageName + "/fileprovider")
-                    .setCount(1)//参数说明:最大可选数,默认1
-                    .start(object : SelectCallback() {
-                        override fun onResult(
-                            picList: ArrayList<Photo>?,
-                            isOriginal: Boolean
-                        ) {
-                            if (picList != null && picList.size > 0) {
-                                Glide.with(this@EditInfoActivity).load(picList[0].uri.toString())
-                                    .error(R.mipmap.default_avatar).into(binding.ivAvatar)
-                                Luban.with(this@EditInfoActivity)
-                                    .load(picList[0].path)
-                                    .ignoreBy(100)
-                                    .setCompressListener(object : OnCompressListener {
-                                        override fun onStart() {
-                                        }
-
-                                        override fun onSuccess(file: File?) {
-                                            SwagoLoading.showLoadingDialog(this@EditInfoActivity)
-                                            userVm.uploadFile(file.toString())
-                                        }
-
-                                        override fun onError(e: Throwable?) {}
-
-                                    }).launch()
+                if (!PermissionX.isGranted(AppContext.getContext(), Manifest.permission.READ_MEDIA_IMAGES) && PermissionX.isGranted(AppContext.getContext(), Manifest.permission.READ_MEDIA_VISUAL_USER_SELECTED)){
+                    val intent = Intent(Intent.ACTION_GET_CONTENT)
+                    intent.type = "image/*"
+                    intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, false)
+                    startActivityForResult(intent, 112)
+
+                } else {
+                    EasyPhotos.createAlbum(
+                        this@EditInfoActivity,
+                        false,
+                        false,
+                        GlideEngine.getInstance()
+                    )
+                        .setFileProviderAuthority(AppContext.getContext().packageName + "/fileprovider")
+                        .setCount(1)//参数说明:最大可选数,默认1
+                        .start(object : SelectCallback() {
+                            override fun onResult(
+                                picList: ArrayList<Photo>?,
+                                isOriginal: Boolean
+                            ) {
+                                if (picList != null && picList.size > 0) {
+                                    Glide.with(this@EditInfoActivity).load(picList[0].uri.toString())
+                                        .error(R.mipmap.default_avatar).into(binding.ivAvatar)
+                                    Luban.with(this@EditInfoActivity)
+                                        .load(picList[0].path)
+                                        .ignoreBy(100)
+                                        .setCompressListener(object : OnCompressListener {
+                                            override fun onStart() {
+                                            }
+
+                                            override fun onSuccess(file: File?) {
+                                                SwagoLoading.showLoadingDialog(this@EditInfoActivity)
+                                                userVm.uploadFile(file.toString())
+                                            }
+
+                                            override fun onError(e: Throwable?) {}
+
+                                        }).launch()
+                                }
                             }
-                        }
 
-                        override fun onCancel() {
+                            override fun onCancel() {
+
+                            }
+                        })
+                }
+                }
 
-                        }
-                    })
-            }
         })
 
     }
@@ -267,6 +278,12 @@ class EditInfoActivity : BaseXActivity<ActivityUserEditBinding>() {
                 this@EditInfoActivity.country = country.name
                 binding.tvEditCountry.text = country.name
             }
+        } else if (requestCode == 112 && resultCode == RESULT_OK){
+            data?.data?.let {
+                FileUtil.getRealPathFromURI(it)?.let { path ->
+                    userVm.uploadFile(path)
+                }
+            }
         }
     }
 }

+ 1 - 1
user/src/main/java/com/swago/user/SettingActivity.kt

@@ -32,7 +32,7 @@ class SettingActivity : BaseXActivity<ActivitySettingBinding>() {
         setBackView(binding.toolbar.ivBack)
         binding.toolbar.tvTitle.text = AppContext.getContext().resources.getString(R.string.setting)
 
-        binding.tvVersion.text = getVersionName() + "(1)"
+        binding.tvVersion.text = getVersionName()
 
         binding.tvUserAgreement.setOnClickListener(object : NoDoubleClickListener() {
             override fun onClick() {

+ 1 - 6
user/src/main/java/com/swago/user/store/StoreBuyDialog.kt

@@ -3,24 +3,19 @@ package com.swago.user.store
 import android.os.Bundle
 import android.view.Gravity
 import android.view.View
-import android.view.View.OnClickListener
 import android.widget.Toast
-import androidx.activity.viewModels
 import androidx.fragment.app.viewModels
 import com.opensource.svgaplayer.SVGADrawable
 import com.opensource.svgaplayer.SVGAParser
-import com.opensource.svgaplayer.SVGASoundManager
 import com.opensource.svgaplayer.SVGAVideoEntity
-import com.swago.baseswago.dialog.BaseXDFragment
+import com.swago.baseswago.dialog.BaseStoreDFragment
 import com.swago.baseswago.model.mine.StoreItemBean
 import com.swago.baseswago.util.AppContext
-import com.swago.baseswago.util.LogUtil
 import com.swago.baseswago.util.NoDoubleClickListener
 import com.swago.loadUrl
 import com.swago.user.R
 import com.swago.user.databinding.DialogStoreDetailBinding
 import com.swago.user.vm.StoreVm
-import java.io.File
 import java.net.URL
 
 class StoreBuyDialog : BaseStoreDFragment<DialogStoreDetailBinding>() {

+ 1 - 1
user/src/main/java/com/swago/user/task/TaskActivity.kt

@@ -54,7 +54,7 @@ class TaskActivity : BaseXActivity<ActivityTaskBinding>(){
                 val simplePagerTitleView = SimplePagerTitleView(context)
                 simplePagerTitleView.text = listTitles[index]
                 val padding = DpPxUtil.dip2px(15f).toFloat()
-                simplePagerTitleView.textSize = 16f
+                simplePagerTitleView.textSize = 14f
                 simplePagerTitleView.typeface = Typeface.createFromAsset(AppContext.getContext().assets,"bold.otf")
                 simplePagerTitleView.setPadding(padding.toInt(), 0, padding.toInt(), 0)
                 simplePagerTitleView.normalColor = Color.parseColor("#828C9D")

+ 9 - 10
user/src/main/res/layout/item_task.xml

@@ -20,40 +20,39 @@
 
     <TextView
         android:id="@+id/tvReward"
-        android:textSize="14dp"
+        android:textSize="12sp"
         android:textColor="#868686"
         android:text = "@string/reward"
-        android:layout_marginTop="5dp"
         android:layout_marginBottom="10dp"
         android:layout_marginStart="15dp"
+        android:layout_marginTop="@dimen/dp_4"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/tvTitle"
-        app:layout_constraintBottom_toBottomOf="parent"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"/>
 
     <TextView
         android:id="@+id/tvRewardType"
-        android:textSize="14dp"
+        android:textSize="12sp"
         android:textColor="#868686"
         tools:text="经验"
-        android:layout_marginTop="5dp"
+        android:layout_marginStart="15dp"
         android:layout_marginBottom="10dp"
-        app:layout_constraintStart_toEndOf="@+id/tvReward"
-        app:layout_constraintTop_toBottomOf="@+id/tvTitle"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/tvReward"
         app:layout_constraintBottom_toBottomOf="parent"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"/>
 
     <TextView
         android:id="@+id/tvRewardTypeValue"
-        android:textSize="14dp"
+        android:textSize="12sp"
         android:text="+10"
         android:textColor="#FF9300"
-        android:layout_marginTop="5dp"
         android:layout_marginBottom="10dp"
+        android:layout_marginStart="@dimen/dp_4"
         app:layout_constraintStart_toEndOf="@+id/tvRewardType"
-        app:layout_constraintTop_toBottomOf="@+id/tvTitle"
+        app:layout_constraintTop_toBottomOf="@+id/tvReward"
         app:layout_constraintBottom_toBottomOf="parent"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"/>