|
@@ -28,7 +28,10 @@ import com.tencent.qcloud.tim.uikit.modules.conversation.base.ConversationInfo
|
|
|
*description:
|
|
|
*/
|
|
|
class MessageFragment : BaseXFragment<FragmentMessageBinding>() {
|
|
|
+ private val userVm by viewModels<UserVm>()
|
|
|
private val officialVm by activityViewModels<OfficialVm>()
|
|
|
+ private var conversationInfo: ConversationInfo ?= null
|
|
|
+ private var jumpDetail = true
|
|
|
|
|
|
override fun loadData() {
|
|
|
officialVm.getMsgSum()
|
|
@@ -41,11 +44,8 @@ class MessageFragment : BaseXFragment<FragmentMessageBinding>() {
|
|
|
.permissions(Manifest.permission.RECORD_AUDIO,Manifest.permission.CAMERA)
|
|
|
.request { allGranted, grantedList, deniedList ->
|
|
|
if (allGranted) {
|
|
|
- ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
|
|
|
- .withInt("type", V2TIMConversation.V2TIM_C2C)
|
|
|
- .withString("account", messageInfo?.id)
|
|
|
- .withString("chatName", messageInfo?.title)
|
|
|
- .navigation()
|
|
|
+ conversationInfo = messageInfo
|
|
|
+ userVm.getOtherUserInfo(messageInfo.id,"")
|
|
|
} else {
|
|
|
Toast.makeText(
|
|
|
AppContext.getContext(),
|
|
@@ -91,5 +91,22 @@ class MessageFragment : BaseXFragment<FragmentMessageBinding>() {
|
|
|
binding.tvCount.visibility = View.VISIBLE
|
|
|
}
|
|
|
}
|
|
|
+ userVm.otherUserInfoLiveData.observe(this){
|
|
|
+ if (jumpDetail){
|
|
|
+ ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
|
|
|
+ .withInt("type", V2TIMConversation.V2TIM_C2C)
|
|
|
+ .withString("account", conversationInfo?.id)
|
|
|
+ .withString("chatName", conversationInfo?.title)
|
|
|
+ .withString("headSpecial" , it.android_head_special)
|
|
|
+ .navigation()
|
|
|
+ }
|
|
|
+ jumpDetail = false
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onResume() {
|
|
|
+ super.onResume()
|
|
|
+ jumpDetail = true
|
|
|
}
|
|
|
}
|