feat:更新数据的获取逻辑,接入配置按钮的跳转行为

This commit is contained in:
eggmanQQQ
2024-07-26 11:31:15 +08:00
parent f08b6d4577
commit 8fa429aca6
4 changed files with 73 additions and 31 deletions

View File

@@ -63,6 +63,7 @@ import com.chwl.app.music.widget.MusicPlayerView
import com.chwl.app.public_chat.ui.message.HeadlineViewModel
import com.chwl.app.room_chat.activity.RoomMsgActivity
import com.chwl.app.ui.pay.ChargeActivity
import com.chwl.app.ui.webview.CommonWebViewActivity
import com.chwl.app.ui.webview.DialogWebViewActivity
import com.chwl.app.ui.widget.ButtonItem
import com.chwl.app.ui.widget.GiftDialog
@@ -98,6 +99,7 @@ import com.chwl.core.manager.RoomEvent
import com.chwl.core.mentoring_relationship.event.MentoringStopCountingEvent
import com.chwl.core.room.anotherroompk.ShowGiftDialogEvent
import com.chwl.core.room.anotherroompk.ShowUserInfoDialogEvent
import com.chwl.core.room.bean.RightBottomIconConfig
import com.chwl.core.room.bean.RoomIcon
import com.chwl.core.room.bean.RoomInfo
import com.chwl.core.room.event.RoomAtEvent
@@ -797,40 +799,14 @@ open class BaseRoomFragment<V : IBaseRoomView?, P1 : BaseRoomPresenter<V>?> :
when (v.id) {
R.id.iv_config_entrance -> {
val roomInfo = AvRoomDataManager.get().mCurrentRoomInfo ?: return
val configInfo = roomInfo.rightBottomIconConfig ?: return
val configInfo = AvRoomDataManager.get().rightBottomIconConfig ?: return
if (configInfo.skipType == 1) {
playConfigWeb(configInfo.skipUrl)
} else if (configInfo.skipType == 2) {
val roomIcon: RoomIcon = RoomIcon(
skipContent = configInfo.skipUrl,
skipType = 3,
showType = 1,
code = "BAISHUN",
ruleValue = configInfo.reserve)
try {
val url = roomIcon.skipContent
val ruleValue = Gson().fromJson<RoomIcon.RuleValueBean>(
roomIcon.ruleValue,
RoomIcon.RuleValueBean::class.java
)
val config = Gson().fromJson<BaiShunGameConfig>(
ruleValue.RESERVE,
BaiShunGameConfig::class.java
)
if (config != null && url != null) {
config.reloadDynamicParams()
// listener?.onShowBaiShunGame(url, config)
(activity as? AVRoomActivity)?.showBaiShunGame(url, config)
} else {
SingleToastUtil.showToast(R.string.manager_trtc_trtcengineadapter_042)
}
} catch (e: Exception) {
e.printStackTrace()
}
playConfigBaishunGame(configInfo)
}
}
R.id.iv_game -> {
// RoomGameListDialog().show(childFragmentManager, "GAME_LIST")
val dialog = RoomGameplayDialog()
dialog.isOnlyPK = false
dialog.listener = object : RoomGameplayDialog.GameplayDialogListener {
@@ -852,6 +828,38 @@ open class BaseRoomFragment<V : IBaseRoomView?, P1 : BaseRoomPresenter<V>?> :
}
}
private fun playConfigWeb(url: String) {
CommonWebViewActivity.start(mContext, url)
}
private fun playConfigBaishunGame(configInfo: RightBottomIconConfig) {
val roomIcon: RoomIcon = RoomIcon(
skipContent = configInfo.skipUrl,
skipType = 3,
showType = 1,
code = "BAISHUN",
ruleValue = configInfo.reserve)
try {
val url = roomIcon.skipContent
val ruleValue = Gson().fromJson<RoomIcon.RuleValueBean>(
roomIcon.ruleValue,
RoomIcon.RuleValueBean::class.java
)
val config = Gson().fromJson<BaiShunGameConfig>(
ruleValue.RESERVE,
BaiShunGameConfig::class.java
)
if (config != null && url != null) {
config.reloadDynamicParams()
(activity as? AVRoomActivity)?.showBaiShunGame(url, config)
} else {
SingleToastUtil.showToast(R.string.manager_trtc_trtcengineadapter_042)
}
} catch (e: Exception) {
e.printStackTrace()
}
}
private fun sendMsg() {
val message = inputEdit.text.toString().trim()
if (isPublicMessageTab()) {