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