|
@@ -1,11 +1,14 @@
|
|
|
package com.swago.room.anchor
|
|
|
|
|
|
+import android.Manifest
|
|
|
import android.content.Intent
|
|
|
+import android.os.Build
|
|
|
import android.os.Bundle
|
|
|
import android.util.Log
|
|
|
import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
import android.view.WindowManager
|
|
|
+import android.widget.Toast
|
|
|
import androidx.activity.viewModels
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout
|
|
|
import androidx.core.content.ContextCompat
|
|
@@ -14,6 +17,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
import com.alibaba.android.arouter.facade.annotation.Route
|
|
|
import com.gyf.immersionbar.ImmersionBar
|
|
|
+import com.permissionx.guolindev.PermissionX
|
|
|
import com.swago.baseswago.SwagoAdapter
|
|
|
import com.swago.baseswago.agora.AgoraManager
|
|
|
import com.swago.baseswago.agora.ISwagoIRtcEngineEventHandler
|
|
@@ -155,13 +159,39 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
|
|
|
|
|
|
binding.tvStartLive.setOnClickListener(object : NoDoubleClickListener() {
|
|
|
override fun onClick() {
|
|
|
- binding.tvStartLive.isEnabled = false
|
|
|
- val userModel = UserRoomModel()
|
|
|
- userModel.roomType = roomType
|
|
|
- SwagoRoomManager.changeRoom(userModel)
|
|
|
- if (roomType == RoomType.VIDEO){
|
|
|
- anchorRoomFragment?.setAudioRvState(false)
|
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU){
|
|
|
+ PermissionX.init(this@AnchorRoomActivity)
|
|
|
+ .permissions(Manifest.permission.POST_NOTIFICATIONS)
|
|
|
+ .request { allGranted, grantedList, deniedList ->
|
|
|
+ if (allGranted) {
|
|
|
+ binding.tvStartLive.isEnabled = false
|
|
|
+ val userModel = UserRoomModel()
|
|
|
+ userModel.roomType = roomType
|
|
|
+ SwagoRoomManager.changeRoom(userModel)
|
|
|
+ if (roomType == RoomType.VIDEO){
|
|
|
+ anchorRoomFragment?.setAudioRvState(false)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ binding.tvStartLive.isEnabled = true
|
|
|
+ Toast.makeText(
|
|
|
+ AppContext.getContext(),
|
|
|
+ "These permissions are denied: $deniedList",
|
|
|
+ Toast.LENGTH_LONG
|
|
|
+ ).show()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ binding.tvStartLive.isEnabled = false
|
|
|
+ val userModel = UserRoomModel()
|
|
|
+ userModel.roomType = roomType
|
|
|
+ SwagoRoomManager.changeRoom(userModel)
|
|
|
+ if (roomType == RoomType.VIDEO){
|
|
|
+ anchorRoomFragment?.setAudioRvState(false)
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
binding.ivClose.setOnClickListener(object : NoDoubleClickListener() {
|