Commit ba0b1574 by 刘鹏

feat : im聊天列表更新

parent 4ce3a7ca
...@@ -10,7 +10,7 @@ ext { ...@@ -10,7 +10,7 @@ ext {
"m-fm" : "0.0.30.03", "m-fm" : "0.0.30.03",
"m-user" : "0.0.61.68", "m-user" : "0.0.61.68",
"m-home" : "0.0.22.70", "m-home" : "0.0.22.70",
"m-im" : "0.0.19.81", "m-im" : "0.0.19.86",
"m-dynamic" : "0.0.7.28", "m-dynamic" : "0.0.7.28",
"m-article" : "0.0.0.10", "m-article" : "0.0.0.10",
...@@ -93,7 +93,7 @@ ext { ...@@ -93,7 +93,7 @@ ext {
"m-fm" : "0.0.30.01", "m-fm" : "0.0.30.01",
"m-user" : "0.0.61.68", "m-user" : "0.0.61.68",
"m-home" : "0.0.22.70", "m-home" : "0.0.22.70",
"m-im" : "0.0.19.75", "m-im" : "0.0.19.86",
"m-dynamic" : "0.0.7.28", "m-dynamic" : "0.0.7.28",
"m-article" : "0.0.0.8", "m-article" : "0.0.0.8",
......
...@@ -28,7 +28,6 @@ import com.yidianling.common.tools.LogUtil ...@@ -28,7 +28,6 @@ import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.R import com.yidianling.im.R
import com.yidianling.im.api.bean.IMExpertBuild import com.yidianling.im.api.bean.IMExpertBuild
import com.yidianling.im.bean.DoctorAssistantRespDtoBean
import com.yidianling.im.bean.GetExpert import com.yidianling.im.bean.GetExpert
import com.yidianling.im.bean.UserTypeBean import com.yidianling.im.bean.UserTypeBean
import com.yidianling.im.bridge.P2PCustomActionHandlerImpl import com.yidianling.im.bridge.P2PCustomActionHandlerImpl
...@@ -145,7 +144,7 @@ object IMChatUtil { ...@@ -145,7 +144,7 @@ object IMChatUtil {
fun startChat(context: AppCompatActivity?, chatItemBean: ChatItemBean) { fun startChat(context: AppCompatActivity?, chatItemBean: ChatItemBean) {
SessionHelper.startP2PSession( SessionHelper.startP2PSession(
context, context,
chatItemBean.utype, 3,
chatItemBean.toUid.toString(), chatItemBean.toUid.toString(),
null, null,
P2PCustomActionHandlerImpl(chatItemBean) P2PCustomActionHandlerImpl(chatItemBean)
...@@ -178,59 +177,18 @@ object IMChatUtil { ...@@ -178,59 +177,18 @@ object IMChatUtil {
//时间内已收集过信息,直接跳转到聊天页 //时间内已收集过信息,直接跳转到聊天页
startChat(context, toUid, isFromQingShu) startChat(context, toUid, isFromQingShu)
} else { } else {
getImJavaApi().getUserType(toUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ res: BaseResponse<UserTypeBean> ->
if (res.code == 200 && res.data != null) {
if (res.data!!.chatEvent) { //和助理私聊需要打开常用语弹窗
ChatStatusCacheHelper.setStatusCache("chatEvent", res.data!!.chatEvent)
}
if (TextUtils.equals(res.data!!.userType, USER_TYPE_EXPERT.toString())
) { //专家
//在uid用户类型确定为专家的情况下,根据uid调用接口判断是进入专家私聊还是助理私聊
getImJavaApi().getChatUid(toUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp: BaseAPIResponse<DoctorAssistantRespDtoBean> ->
val bean = resp.data
val toUid = bean.chatUid
prepareChatData(context, toUid, object :
ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) {
if (resp.data != null && resp.data.role == 2) {
//2 代运营
CmsExamQuestionPaperActivity.start(context, toUid, expertInfo, 0)
} else {
startChatSession(toUid, expertInfo, isFromQingShu, context)
}
}
})
}) { t: Throwable? ->
handleError(context, t!!)
}
} else {
prepareAssistantChatData( prepareAssistantChatData(
context, context,
toUid, toUid,
object : ChatDataRequestListener { object : ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) { override fun onSuccess(expertInfo: IMExpertBuild) {
startChatSession(toUid, expertInfo, isFromQingShu, context) startChatSession(
} toUid,
}) expertInfo,
} isFromQingShu,
} else { context
if (loadingDialog != null && loadingDialog!!.isVisible) { )
loadingDialog?.dismissAllowingStateLoss()
}
ToastUtil.toastShort(res.msg)
}
}, { throwable: Throwable? ->
if (loadingDialog != null && loadingDialog!!.isVisible) {
loadingDialog?.dismissAllowingStateLoss()
} }
handleError(context, throwable!!)
}) })
} }
} }
...@@ -254,55 +212,13 @@ object IMChatUtil { ...@@ -254,55 +212,13 @@ object IMChatUtil {
if (context.supportFragmentManager != null && !context.isDestroyed) { if (context.supportFragmentManager != null && !context.isDestroyed) {
loadingDialog?.show(context.supportFragmentManager, null) loadingDialog?.show(context.supportFragmentManager, null)
} }
getImJavaApi().getUserType(toUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ res: BaseResponse<UserTypeBean> ->
if (res.code == 200 && res.data != null) {
if (res.data!!.chatEvent) { //和助理私聊需要打开常用语弹窗
ChatStatusCacheHelper.setStatusCache(
"chatEvent",
res.data!!.chatEvent
)
}
if (TextUtils.equals(res.data!!.userType, USER_TYPE_EXPERT.toString())) { //专家
//在uid用户类型确定为专家的情况下,根据uid调用接口判断是进入专家私聊还是助理私聊
getImJavaApi().getChatUid(toUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ resp: BaseAPIResponse<DoctorAssistantRespDtoBean> ->
val bean = resp.data
val toUid = bean.chatUid
prepareChatData(context, toUid, object :
ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) {
startChatSession(toUid, expertInfo, isFromQingShu, context)
}
})
}) { t: Throwable? ->
handleError(context, t!!)
}
} else {
prepareAssistantChatData(context, toUid, object : ChatDataRequestListener { prepareAssistantChatData(context, toUid, object : ChatDataRequestListener {
override fun onSuccess(expertInfo: IMExpertBuild) { override fun onSuccess(expertInfo: IMExpertBuild) {
startChatSession(toUid, expertInfo, isFromQingShu, context) startChatSession(toUid, expertInfo, isFromQingShu, context)
} }
}) })
} }
} else {
if (loadingDialog != null && loadingDialog!!.isVisible) {
loadingDialog?.dismissAllowingStateLoss()
}
ToastUtil.toastShort(res.msg)
}
}, { throwable: Throwable? ->
if (loadingDialog != null && loadingDialog!!.isVisible) {
loadingDialog?.dismissAllowingStateLoss()
}
handleError(context, throwable!!)
}
)
}
fun startChatCloseReplaceChat(context: AppCompatActivity, toUid: String) { fun startChatCloseReplaceChat(context: AppCompatActivity, toUid: String) {
...@@ -338,7 +254,7 @@ object IMChatUtil { ...@@ -338,7 +254,7 @@ object IMChatUtil {
p2PCustomActionHandlerImpl.isFromQingShu = isFromQingShu p2PCustomActionHandlerImpl.isFromQingShu = isFromQingShu
SessionHelper.startP2PSession( SessionHelper.startP2PSession(
context, context,
expertInfo.shareData.user_type, 3,
toUid, toUid,
null, null,
p2PCustomActionHandlerImpl p2PCustomActionHandlerImpl
...@@ -369,33 +285,9 @@ object IMChatUtil { ...@@ -369,33 +285,9 @@ object IMChatUtil {
if (!isLogin(context, true)) { if (!isLogin(context, true)) {
return return
} }
val dis = getImJavaApi().getUserType(toUid)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ res: BaseResponse<UserTypeBean> ->
if (res.code == 200 && res.data != null) {
if (res.data!!.chatEvent) { //和助理私聊需要打开常用语弹窗
ChatStatusCacheHelper.setStatusCache("chatEvent", res.data!!.chatEvent)
}
if (TextUtils.equals(res.data!!.userType, "2")) {
//接口返回值是专家,java接口
prepareExpertChatData(context, toUid, listener)
} else { //非专家 php接口
prepareAssistantChatData(context, toUid, listener) prepareAssistantChatData(context, toUid, listener)
}
} else {
if (loadingDialog != null && loadingDialog!!.isVisible) {
loadingDialog?.dismissAllowingStateLoss()
}
ToastUtil.toastShort(res.msg)
}
}, { throwable: Throwable? ->
if (loadingDialog != null && loadingDialog!!.isVisible) {
loadingDialog?.dismissAllowingStateLoss()
}
handleError(context, throwable!!)
}
)
} }
/** /**
......
...@@ -146,8 +146,9 @@ interface ImRetrofitApi { ...@@ -146,8 +146,9 @@ interface ImRetrofitApi {
* location字段说明(sign1存储页面位置,1:首页导医入口进入2:M站入口进入3:问答列表页进入4:我的入口进入 * location字段说明(sign1存储页面位置,1:首页导医入口进入2:M站入口进入3:问答列表页进入4:我的入口进入
* 5:情绪疏导在线咨询入口进入6:咨询列表页导医入口进入7:实用心理课入口进入8:实用心理课课程列表页进入9:测评解读页进入 * 5:情绪疏导在线咨询入口进入6:咨询列表页导医入口进入7:实用心理课入口进入8:实用心理课课程列表页进入9:测评解读页进入
* 10:搜索页面进入11:首页咨询列表进入12:厌学的真相在线咨询入口,0是小壹意向客户传0) * 10:搜索页面进入11:首页咨询列表进入12:厌学的真相在线咨询入口,0是小壹意向客户传0)
* * 18:医疗导医使用
* ffrom_2 亲子教育添加字段 * ffrom_2 亲子教育添加字段
* ffrom_2 main_xinliyisheng 医疗导医使用
*naviType = "1";导医配置开关,返100跳转咨询tab,如果返其他则维持原有逻辑。 *naviType = "1";导医配置开关,返100跳转咨询tab,如果返其他则维持原有逻辑。
* */ * */
......
...@@ -303,7 +303,7 @@ class IMServiceImpl : IImService { ...@@ -303,7 +303,7 @@ class IMServiceImpl : IImService {
} }
override fun startP2PSession(mContext: Context, userType: Int, account: String, toChatUsername: String, toName: String, head: String) { override fun startP2PSession(mContext: Context, userType: Int, account: String, toChatUsername: String, toName: String, head: String) {
SessionHelper.startP2PSession(mContext, userType, account, null, SessionHelper.startP2PSession(mContext, 3, account, null,
P2PCustomActionHandlerImpl(toChatUsername, toName, head)) P2PCustomActionHandlerImpl(toChatUsername, toName, head))
} }
......
package com.yidianling.im.ui.activity package com.yidianling.im.ui.activity
import android.content.Context
import android.content.Intent
import android.view.View import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
...@@ -23,10 +25,21 @@ import com.yidianling.im.ui.page.widget.ChatUnusualView ...@@ -23,10 +25,21 @@ import com.yidianling.im.ui.page.widget.ChatUnusualView
import com.yidianling.im.ui.param.ChatParam import com.yidianling.im.ui.param.ChatParam
import de.greenrobot.event.EventBus import de.greenrobot.event.EventBus
import kotlinx.android.synthetic.main.im_chat_fragment_layout.* import kotlinx.android.synthetic.main.im_chat_fragment_layout.*
import kotlinx.android.synthetic.main.im_chat_fragment_layout.chat_recyclerview
import kotlinx.android.synthetic.main.im_chat_fragment_layout.ll_chat_unusual_view
import kotlinx.android.synthetic.main.medical_chat_list.*
@Route(path = "/im/medical") @Route(path = "/im/medical")
class MedicalChatActivity : BaseActivity(), XRecyclerView.LoadingListener { class MedicalChatActivity : BaseActivity(), XRecyclerView.LoadingListener {
companion object{
@JvmStatic
fun start(context: Context) {
val starter = Intent(context, MedicalChatActivity::class.java)
context.startActivity(starter)
}
}
private var chatAdapter: ChatAdapter? = null private var chatAdapter: ChatAdapter? = null
private var allChatData: ChatModelBean = ChatModelBean() //全部数据 private var allChatData: ChatModelBean = ChatModelBean() //全部数据
...@@ -68,6 +81,7 @@ class MedicalChatActivity : BaseActivity(), XRecyclerView.LoadingListener { ...@@ -68,6 +81,7 @@ class MedicalChatActivity : BaseActivity(), XRecyclerView.LoadingListener {
override fun onLoadMoreComplete(p0: View?) { override fun onLoadMoreComplete(p0: View?) {
} }
}) })
iv_back.setOnClickListener { finish() }
} }
private fun initStatus() { private fun initStatus() {
...@@ -77,13 +91,14 @@ class MedicalChatActivity : BaseActivity(), XRecyclerView.LoadingListener { ...@@ -77,13 +91,14 @@ class MedicalChatActivity : BaseActivity(), XRecyclerView.LoadingListener {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
resetPageShow() getChatMessageData()
} }
fun clearData() { fun clearData() {
showData.clear() showData.clear()
chatAdapter?.notifyDataSetChanged() chatAdapter?.notifyDataSetChanged()
resetPageShow() resetPageShow()
resetPageShow()
} }
/** /**
...@@ -183,6 +198,7 @@ class MedicalChatActivity : BaseActivity(), XRecyclerView.LoadingListener { ...@@ -183,6 +198,7 @@ class MedicalChatActivity : BaseActivity(), XRecyclerView.LoadingListener {
chatAdapter?.notifyDataSetChanged() chatAdapter?.notifyDataSetChanged()
resetPageShow() resetPageShow()
} }
resetPageShow()
} }
/** /**
......
...@@ -68,7 +68,9 @@ class ChatAdapter( ...@@ -68,7 +68,9 @@ class ChatAdapter(
P2PCustomActionHandlerImpl("4108805", "课程小助手-壹壹", "4108805") P2PCustomActionHandlerImpl("4108805", "课程小助手-壹壹", "4108805")
) )
} else { } else {
IMChatUtil.startCms(context as AppCompatActivity, 1, null) IMChatUtil.startChat(context as AppCompatActivity, mList[position])
// IMChatUtil.startCms(context as AppCompatActivity, 18, "main_xinliyisheng")
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment