Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
ba0b1574
Commit
ba0b1574
authored
Sep 28, 2021
by
刘鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat : im聊天列表更新
parent
4ce3a7ca
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
135 deletions
+46
-135
config.gradle
config.gradle
+2
-2
IMChatUtil.kt
m-im/src/main/java/com/yidianling/im/helper/IMChatUtil.kt
+21
-129
ImRetrofitApi.kt
m-im/src/main/java/com/yidianling/im/http/ImRetrofitApi.kt
+2
-1
IMServiceImpl.kt
m-im/src/main/java/com/yidianling/im/modular/service/IMServiceImpl.kt
+1
-1
MedicalChatActivity.kt
m-im/src/main/java/com/yidianling/im/ui/activity/MedicalChatActivity.kt
+17
-1
ChatAdapter.kt
m-im/src/main/java/com/yidianling/im/ui/page/fragment/adapter/ChatAdapter.kt
+3
-1
No files found.
config.gradle
View file @
ba0b1574
...
...
@@ -10,7 +10,7 @@ ext {
"m-fm"
:
"0.0.30.03"
,
"m-user"
:
"0.0.61.68"
,
"m-home"
:
"0.0.22.70"
,
"m-im"
:
"0.0.19.8
1
"
,
"m-im"
:
"0.0.19.8
6
"
,
"m-dynamic"
:
"0.0.7.28"
,
"m-article"
:
"0.0.0.10"
,
...
...
@@ -93,7 +93,7 @@ ext {
"m-fm"
:
"0.0.30.01"
,
"m-user"
:
"0.0.61.68"
,
"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-article"
:
"0.0.0.8"
,
...
...
m-im/src/main/java/com/yidianling/im/helper/IMChatUtil.kt
View file @
ba0b1574
...
...
@@ -28,7 +28,6 @@ import com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.R
import
com.yidianling.im.api.bean.IMExpertBuild
import
com.yidianling.im.bean.DoctorAssistantRespDtoBean
import
com.yidianling.im.bean.GetExpert
import
com.yidianling.im.bean.UserTypeBean
import
com.yidianling.im.bridge.P2PCustomActionHandlerImpl
...
...
@@ -145,7 +144,7 @@ object IMChatUtil {
fun
startChat
(
context
:
AppCompatActivity
?,
chatItemBean
:
ChatItemBean
)
{
SessionHelper
.
startP2PSession
(
context
,
chatItemBean
.
utype
,
3
,
chatItemBean
.
toUid
.
toString
(),
null
,
P2PCustomActionHandlerImpl
(
chatItemBean
)
...
...
@@ -178,59 +177,18 @@ object IMChatUtil {
//时间内已收集过信息,直接跳转到聊天页
startChat
(
context
,
toUid
,
isFromQingShu
)
}
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
(
context
,
toUid
,
object
:
ChatDataRequestListener
{
override
fun
onSuccess
(
expertInfo
:
IMExpertBuild
)
{
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
()
prepareAssistantChatData
(
context
,
toUid
,
object
:
ChatDataRequestListener
{
override
fun
onSuccess
(
expertInfo
:
IMExpertBuild
)
{
startChatSession
(
toUid
,
expertInfo
,
isFromQingShu
,
context
)
}
handleError
(
context
,
throwable
!!
)
})
}
}
...
...
@@ -254,54 +212,12 @@ object IMChatUtil {
if
(
context
.
supportFragmentManager
!=
null
&&
!
context
.
isDestroyed
)
{
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
{
override
fun
onSuccess
(
expertInfo
:
IMExpertBuild
)
{
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
!!
)
prepareAssistantChatData
(
context
,
toUid
,
object
:
ChatDataRequestListener
{
override
fun
onSuccess
(
expertInfo
:
IMExpertBuild
)
{
startChatSession
(
toUid
,
expertInfo
,
isFromQingShu
,
context
)
}
)
}
)
}
...
...
@@ -338,7 +254,7 @@ object IMChatUtil {
p2PCustomActionHandlerImpl
.
isFromQingShu
=
isFromQingShu
SessionHelper
.
startP2PSession
(
context
,
expertInfo
.
shareData
.
user_type
,
3
,
toUid
,
null
,
p2PCustomActionHandlerImpl
...
...
@@ -369,33 +285,9 @@ object IMChatUtil {
if
(!
isLogin
(
context
,
true
))
{
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
)
}
}
else
{
if
(
loadingDialog
!=
null
&&
loadingDialog
!!
.
isVisible
)
{
loadingDialog
?.
dismissAllowingStateLoss
()
}
ToastUtil
.
toastShort
(
res
.
msg
)
}
},
{
throwable
:
Throwable
?
->
if
(
loadingDialog
!=
null
&&
loadingDialog
!!
.
isVisible
)
{
loadingDialog
?.
dismissAllowingStateLoss
()
}
handleError
(
context
,
throwable
!!
)
}
)
prepareAssistantChatData
(
context
,
toUid
,
listener
)
}
/**
...
...
m-im/src/main/java/com/yidianling/im/http/ImRetrofitApi.kt
View file @
ba0b1574
...
...
@@ -146,8 +146,9 @@ interface ImRetrofitApi {
* location字段说明(sign1存储页面位置,1:首页导医入口进入2:M站入口进入3:问答列表页进入4:我的入口进入
* 5:情绪疏导在线咨询入口进入6:咨询列表页导医入口进入7:实用心理课入口进入8:实用心理课课程列表页进入9:测评解读页进入
* 10:搜索页面进入11:首页咨询列表进入12:厌学的真相在线咨询入口,0是小壹意向客户传0)
*
*
18:医疗导医使用
* ffrom_2 亲子教育添加字段
* ffrom_2 main_xinliyisheng 医疗导医使用
*naviType = "1";导医配置开关,返100跳转咨询tab,如果返其他则维持原有逻辑。
* */
...
...
m-im/src/main/java/com/yidianling/im/modular/service/IMServiceImpl.kt
View file @
ba0b1574
...
...
@@ -303,7 +303,7 @@ class IMServiceImpl : IImService {
}
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
))
}
...
...
m-im/src/main/java/com/yidianling/im/ui/activity/MedicalChatActivity.kt
View file @
ba0b1574
package
com.yidianling.im.ui.activity
import
android.content.Context
import
android.content.Intent
import
android.view.View
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.alibaba.android.arouter.facade.annotation.Route
...
...
@@ -23,10 +25,21 @@ import com.yidianling.im.ui.page.widget.ChatUnusualView
import
com.yidianling.im.ui.param.ChatParam
import
de.greenrobot.event.EventBus
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"
)
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
allChatData
:
ChatModelBean
=
ChatModelBean
()
//全部数据
...
...
@@ -68,6 +81,7 @@ class MedicalChatActivity : BaseActivity(), XRecyclerView.LoadingListener {
override
fun
onLoadMoreComplete
(
p0
:
View
?)
{
}
})
iv_back
.
setOnClickListener
{
finish
()
}
}
private
fun
initStatus
()
{
...
...
@@ -77,13 +91,14 @@ class MedicalChatActivity : BaseActivity(), XRecyclerView.LoadingListener {
override
fun
onResume
()
{
super
.
onResume
()
resetPageShow
()
getChatMessageData
()
}
fun
clearData
()
{
showData
.
clear
()
chatAdapter
?.
notifyDataSetChanged
()
resetPageShow
()
resetPageShow
()
}
/**
...
...
@@ -183,6 +198,7 @@ class MedicalChatActivity : BaseActivity(), XRecyclerView.LoadingListener {
chatAdapter
?.
notifyDataSetChanged
()
resetPageShow
()
}
resetPageShow
()
}
/**
...
...
m-im/src/main/java/com/yidianling/im/ui/page/fragment/adapter/ChatAdapter.kt
View file @
ba0b1574
...
...
@@ -68,7 +68,9 @@ class ChatAdapter(
P2PCustomActionHandlerImpl
(
"4108805"
,
"课程小助手-壹壹"
,
"4108805"
)
)
}
else
{
IMChatUtil
.
startCms
(
context
as
AppCompatActivity
,
1
,
null
)
IMChatUtil
.
startChat
(
context
as
AppCompatActivity
,
mList
[
position
])
// IMChatUtil.startCms(context as AppCompatActivity, 18, "main_xinliyisheng")
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment