public interface IYWConversationService
Modifier and Type | Method and Description |
---|---|
void |
addConversationListener(IYWConversationListener listener)
增加会话记录变更监听,包含新增、删除,会话中的数据有变更等
|
void |
addP2PPushListener(IYWP2PPushListener listener)
注册单聊新消息通知监听
|
void |
addPushListener(IYWPushListener listener)
注册新消息通知监听
|
void |
addTotalUnreadChangeListener(IYWConversationUnreadChangeListener listener)
添加针对全部会话的总体未读消息数变化的监听器
|
void |
addTribePushListener(IYWTribePushListener listener)
注册群聊新消息通知监听
|
void |
checkHasUnreadAtMsgs(Context context,
YWConversation conversation,
IWxCallback callback)
检查是否有未读的@消息
|
void |
deleteAllConversation()
删除所有的会话记录,并清空消息
该方法必须在UI主线程调用
|
void |
deleteConversation(YWConversation conversation)
删除某一条会话记录,并清空消息
该方法必须在UI主线程调用
|
int |
getAllUnreadCount()
获取所有会记录的未读总数
该方法必须在UI主线程调用
|
void |
getAtMsgList(Context context,
java.util.List<YWConversation> conversations,
int count,
IWxCallback callback)
获取每个会话的@消息列表
|
YWConversation |
getConversation(EServiceContact setting)
与某个聊天对象的会话记录
|
YWConversation |
getConversation(long tribeId)
Deprecated.
该方法已废弃,后续请使用
getTribeConversation(long) |
YWConversation |
getConversation(java.lang.String userId)
Deprecated.
该方法已废弃,后续请使用
getConversationByUserId(String) |
YWConversation |
getConversationByConversationId(java.lang.String conversationId)
获取某个会话记录
该方法必须在UI主线程调用
|
YWConversation |
getConversationById(java.lang.String conversationId)
Deprecated.
该方法已废弃,后续请使用
getConversationByConversationId(String) |
YWConversation |
getConversationByUserId(java.lang.String userId)
获取与某个聊天对象的会话记录,仅限同域的联系人会话,跨域联系人的会话请参考
getConversationByUserId(java.lang.String)
该方法必须在UI主线程调用 |
YWConversation |
getConversationByUserId(java.lang.String userId,
java.lang.String targetAppKey)
获取与某个聊天对象的会话记录,支持跨域联系人的获得
该方法必须在UI主线程调用
|
YWConversationCreater |
getConversationCreater()
获取会话的创建器
|
java.util.List<YWConversation> |
getConversationList()
获取当前登录用户所有的聊天会话,该列表只做只做只读用途,请勿自行往集合中增删东西,请通过云旺提供的api进行增删
该方法必须在UI主线程调用
|
YWConversation |
getCustomConversation(java.lang.String conversationId)
获取自定义会话
|
YWConversation |
getCustomConversationByConversationId(java.lang.String conversationId)
根据会话Id查询自定义会话
|
YWConversation |
getCustomViewConversationByConversationId(java.lang.String conversationId)
根据会话Id查询自定义View的会话
|
void |
getRecentConversations(int count,
boolean needSync,
boolean isManual,
IWxCallback result)
获取最近联系人,该列表只做只读用途,
该方法必须在UI主线程调用
|
YWConversation |
getTribeConversation(long tribeId)
根据群ID,获取群会话
|
void |
markAllReaded()
将所有的消息记录置为已读
该方法必须在UI主线程调用
|
void |
markReaded(YWConversation conversation)
将所有的消息记录置为已读
该方法必须在UI主线程调用
|
void |
removeConversationListener(IYWConversationListener listener)
移除会话记录变更监听
|
void |
removeP2PPushListener(IYWP2PPushListener listener)
注销单聊新消息通知监听
|
void |
removePushListener(IYWPushListener listener)
注销新消息通知监听
|
void |
removeTopConversation(YWConversation conversation)
将当前会话取消置顶
该方法必须在UI主线程调用
|
void |
removeTotalUnreadChangeListener(IYWConversationUnreadChangeListener listener)
删除针对全部会话的总体未读消息数变化的监听器
|
void |
removeTribePushListener(IYWTribePushListener listener)
注销群聊新消息通知监听
|
void |
setMessageLifeCycleListener(IYWMessageLifeCycleListener listener)
设置发送消息生命周期回调监听
|
void |
setSendMessageToContactInBlackListListener(IYWSendMessageToContactInBlackListListener listener) |
void |
setTopConversation(YWConversation conversation)
将当前会话置顶
该方法必须在UI主线程调用
|
void |
syncRecentConversations(IWxCallback callback)
[同步最近会话]:从服务器获取最近20个联系人及每人对应会话的最近1条消息]
|
boolean |
updateOrCreateCustomConversation(YWCustomConversationUpdateModel customConversationModel)
仅用于更新或者创建一个自定义会话,如果会话已存在则更新 。conversationId作为会话的标识必须传入.unreadCount 属性如果设置了会累加。
|
boolean |
updateOrCreateCustomViewConversation(YWCustomConversationUpdateModel customConversationModel)
更新或者创建一个自定义View展示的会话,如果会话已存在则更新。
|
boolean updateOrCreateCustomConversation(YWCustomConversationUpdateModel customConversationModel)
customConversationModel
- void addPushListener(IYWPushListener listener)
listener
- 推送消息监听void removePushListener(IYWPushListener listener)
listener
- 推送消息监听void addP2PPushListener(IYWP2PPushListener listener)
listener
- 推送消息监听void removeP2PPushListener(IYWP2PPushListener listener)
listener
- 推送消息监听void addTribePushListener(IYWTribePushListener listener)
listener
- 推送消息监听void removeTribePushListener(IYWTribePushListener listener)
listener
- 推送消息监听java.util.List<YWConversation> getConversationList()
void getRecentConversations(int count, boolean needSync, boolean isManual, IWxCallback result)
count
- 获取最近联系人个数needSync
- true,需要从服务器同步最近联系人,false 只取本地最近联系人isManual
- 是否手动触发result
- IWxCallback.onSuccess(Object...)
返回List
useridsvoid deleteConversation(YWConversation conversation)
conversation
- 会话记录void deleteAllConversation()
int getAllUnreadCount()
void addConversationListener(IYWConversationListener listener)
listener
- 会话记录变更监听void removeConversationListener(IYWConversationListener listener)
listener
- 会话记录变更监听YWConversation getConversation(java.lang.String userId)
getConversationByUserId(String)
getConversationByUserId(String)
userId
- 聊天对象id, 如果是单聊即为对方的userIdYWConversation getConversationByUserId(java.lang.String userId)
getConversationByUserId(java.lang.String)
该方法必须在UI主线程调用userId
- 聊天对象id, 如果是单聊即为对方的userIdYWConversation getConversationByUserId(java.lang.String userId, java.lang.String targetAppKey)
userId
- 聊天对象id, 如果是单聊即为对方的userIdtargetAppKey
- 聊天对象appkeyYWConversation getConversation(long tribeId)
getTribeConversation(long)
tribeId
- YWConversation getTribeConversation(long tribeId)
tribeId
- YWConversation getConversationById(java.lang.String conversationId)
getConversationByConversationId(String)
getConversationByConversationId(String)
conversationId
- 会话idYWConversation getConversationByConversationId(java.lang.String conversationId)
conversationId
- 会话idYWConversation getConversation(EServiceContact setting)
setting
- e客服会话设置信息YWConversation getCustomConversation(java.lang.String conversationId)
conversationId
- YWConversationCreater getConversationCreater()
void setTopConversation(YWConversation conversation)
conversation
- 需要置顶显示的会话void removeTopConversation(YWConversation conversation)
conversation
- 需要取消置顶的会话void markAllReaded()
void markReaded(YWConversation conversation)
conversation
- void addTotalUnreadChangeListener(IYWConversationUnreadChangeListener listener)
listener
- 总体未读消息数变化的监听器void removeTotalUnreadChangeListener(IYWConversationUnreadChangeListener listener)
listener
- 总体未读消息数变化的监听器void syncRecentConversations(IWxCallback callback)
callback
- onSuccess(Object...obj)中的obj为空,会话最近一条消息直接被更新到Cache和DBvoid checkHasUnreadAtMsgs(Context context, YWConversation conversation, IWxCallback callback)
context
- conversation
- 标识一个会话callback
- 回调接口,成功回调IWxCallback.onSuccess(Object... result)
,解析方式:YWMessage message = result[0];void getAtMsgList(Context context, java.util.List<YWConversation> conversations, int count, IWxCallback callback)
conversations
- 会话实例count
- 每个会话要获取的@消息条数callback
- 完成操作后的回调。执行成功后,@消息存入DB。
并且会在onSuccess(Object... result)中返回最新的一条未读@消息,格式为onSuccess(YWMessage)boolean updateOrCreateCustomViewConversation(YWCustomConversationUpdateModel customConversationModel)
customConversationModel
- YWConversation getCustomConversationByConversationId(java.lang.String conversationId)
conversationId
- 会话IdYWConversation getCustomViewConversationByConversationId(java.lang.String conversationId)
conversationId
- 会话Idvoid setMessageLifeCycleListener(IYWMessageLifeCycleListener listener)
listener
- void setSendMessageToContactInBlackListListener(IYWSendMessageToContactInBlackListListener listener)