im::floo::floolib::BMXChatServiceListener
聊天监听者
Public Functions
Name | |
---|---|
synchronized void | delete() |
void | swigReleaseOwnership() |
void | swigTakeOwnership() |
void | onStatusChanged(BMXMessage msg, [BMXErrorCode] error) 消息发送状态发生变化 |
void | onAttachmentUploadProgressChanged(BMXMessage msg, int percent) 附件上传进度发送变化 |
void | onRecallStatusChanged(BMXMessage msg, [BMXErrorCode] error) 消息撤回状态发送变化 |
void | onReceive(BMXMessageList list) 收到消息 |
void | onReceiveCommandMessages(BMXMessageList list) 收到命令消息 |
void | onReceiveSystemMessages(BMXMessageList list) 收到系统通知消息 |
void | onReceiveReadAcks(BMXMessageList list) 收到消息已读回执 |
void | onReceiveDeliverAcks(BMXMessageList list) 收到消息已送达回执 |
void | onReceiveRecallMessages(BMXMessageList list) 收到撤回消息 |
void | onReceiveReadCancels(BMXMessageList list) 收到消息已读取消(多设备其他设备同步消息已读状态变为未读) |
void | onReceiveReadAllMessages(BMXMessageList list) 收到消息全部已读(多设备同步某消息之前消息全部设置为已读) |
void | onReceiveDeleteMessages(BMXMessageList list) 收到删除消息 (多设备同步删除消息) |
void | onReceivePlayAcks(BMXMessageList list) 收到消息已播放回执 |
void | onAttachmentStatusChanged(BMXMessage msg, [BMXErrorCode] error, int percent) 附件下载状态发生变化 |
void | onAttachmentDownloadByUrlStatusChanged(long msgId, [BMXErrorCode] error, int percent) 附件下载状态发生变化 |
void | onRetrieveHistoryMessages(BMXConversation conversation) 拉取历史消息 |
void | onLoadAllConversation() 已经加载完未读会话列表 |
void | onConversationCreate(BMXConversation conversation, BMXMessage msg) 本地创建新会话 |
void | onConversationDelete(long conversationId, [BMXErrorCode] error) 删除会话 |
void | onTotalUnreadCountChanged(int unreadCount) 更新总未读数 |
BMXChatServiceListener() | |
void | registerChatService(BMXChatService service) |
Protected Functions
Name | |
---|---|
BMXChatServiceListener(long cPtr, boolean cMemoryOwn) | |
void | finalize() |
void | swigDirectorDisconnect() |
long | getCPtr(BMXChatServiceListener obj) |
Protected Attributes
Name | |
---|---|
transient boolean | swigCMemOwn |
Public Functions Documentation
function delete
inline synchronized void delete()
Example:
function swigReleaseOwnership
inline void swigReleaseOwnership()
Example:
function swigTakeOwnership
inline void swigTakeOwnership()
Example:
function onStatusChanged
inline void onStatusChanged(
BMXMessage msg,
BMXErrorCode error
)
消息发送状态发生变化
Parameters:
- msg 发生状态变化的消息
- error 状态错误码
Example:
public void onStatusChanged(BMXMessage msg, BMXErrorCode error) {
// 发送状态更新页面
if (msg != null && isCurrentSession(msg)) {
mView.updateChatMessage(msg);
// 如果失败判断弹出提示
if (error != null && error.swigValue() != BMXErrorCode.NoError.swigValue()) {
String errorMsg = error.name();
((Activity)mView.getContext())
.runOnUiThread(() -> ToastUtil.showTextViewPrompt(errorMsg));
}
}
}
public void onStatusChanged(BMXMessage msg, BMXErrorCode error) {
}
public void onStatusChanged(BMXMessage msg, BMXErrorCode error) {
super.onStatusChanged(msg, error);
for (BMXChatServiceListener listener : mListener) {
listener.onStatusChanged(msg, error);
}
}
function onAttachmentUploadProgressChanged
inline void onAttachmentUploadProgressChanged(
BMXMessage msg,
int percent
)
附件上传进度发送变化
Parameters:
- msg 上传附件的消息
- percent 附件上传的进度
Example:
public void onAttachmentUploadProgressChanged(BMXMessage msg, int percent) {
// 附件消息上传进度
ChatAttachmentManager.getInstance().onProgressCallback(msg, percent);
Log.d("progressChanged", percent + "");
}
public void onAttachmentUploadProgressChanged(BMXMessage msg, int percent) {
}
public void onAttachmentUploadProgressChanged(BMXMessage msg, int percent) {
super.onAttachmentUploadProgressChanged(msg, percent);
for (BMXChatServiceListener listener : mListener) {
listener.onAttachmentUploadProgressChanged(msg, percent);
}
}
function onRecallStatusChanged
inline void onRecallStatusChanged(
BMXMessage msg,
BMXErrorCode error
)
消息撤回状态发送变化
Parameters:
- msg 撤回状态发生变化的消息
- error 状态错误码
Example:
public void onRecallStatusChanged(BMXMessage msg, BMXErrorCode error) {
if (msg == null) {
return;
}
boolean success = error != null
&& error.swigValue() == BMXErrorCode.NoError.swigValue();
String errorMsg = error != null && !TextUtils.isEmpty(error.name()) ? error.name()
: "撤回失败";
if (success) {
// 撤回成功需要删除原始消息
if (mView != null) {
mView.deleteChatMessage(msg);
}
} else {
// 原始消息不为空 则没有撤回成功
((Activity)mView.getContext())
.runOnUiThread(() -> ToastUtil.showTextViewPrompt(errorMsg));
}
}
public void onRecallStatusChanged(BMXMessage msg, BMXErrorCode error) {
}
public void onRecallStatusChanged(BMXMessage msg, BMXErrorCode error) {
super.onRecallStatusChanged(msg, error);
for (BMXChatServiceListener listener : mListener) {
listener.onRecallStatusChanged(msg, error);
}
}
function onReceive
inline void onReceive(
BMXMessageList list
)
收到消息
Parameters:
- list 接收到的消息列表
Example:
public void onReceive(BMXMessageList list) {
// 收到消息
if (list != null && !list.isEmpty()) {
List<BMXMessage> messages = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
BMXMessage message = list.get(i);
if (message != null && isCurrentSession(message) && filterMessage(message)) {
((MaxIMApplication) getApplication()).typeWriterMsgId = message.msgId();
// 当前会话
messages.add(message);
}
}
mView.receiveChatMessage(messages);
}
}
public void onReceive(BMXMessageList list) {
// 收到消息
loadSession();
}
public void onReceive(BMXMessageList list) {
super.onReceive(list);
if (list != null && !list.isEmpty()) {
notifyNotification(list.get(0));
}
for (BMXChatServiceListener listener : mListener) {
listener.onReceive(list);
}
}
public void onReceive(BMXMessageList list) {
super.onReceive(list);
// 收到消息
if (list != null && !list.isEmpty()) {
for (int i = 0; i < list.size(); i++) {
BMXMessage message = list.get(i);
}
}
}
public void onReceive(BMXMessageList list) {
super.onReceive(list);
// 收到消息
if (list != null && !list.isEmpty()) {
for (int i = 0; i < list.size(); i++) {
BMXMessage message = list.get(i);
handleRTCMessage(message);
}
}
}
function onReceiveCommandMessages
inline void onReceiveCommandMessages(
BMXMessageList list
)
收到命令消息
Parameters:
- list 接收到的消息列表
Example:
public void onReceiveCommandMessages(BMXMessageList list) {
}
function onReceiveSystemMessages
inline void onReceiveSystemMessages(
BMXMessageList list
)
收到系统通知消息
Parameters:
- list 接收到的系统消息列表
Example:
public void onReceiveSystemMessages(BMXMessageList list) {
// 收到系统消息
if (list != null && !list.isEmpty()) {
List<BMXMessage> messages = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
BMXMessage message = list.get(i);
if (message != null && isCurrentSession(message) && filterMessage(message)) {
// 当前会话
messages.add(message);
}
}
mView.receiveChatMessage(messages);
}
}
public void onReceiveSystemMessages(BMXMessageList list) {
// 收到系统消息
loadSession();
}
public void onReceiveSystemMessages(BMXMessageList list) {
super.onReceiveSystemMessages(list);
for (BMXChatServiceListener listener : mListener) {
listener.onReceiveSystemMessages(list);
}
}
function onReceiveReadAcks
inline void onReceiveReadAcks(
BMXMessageList list
)
收到消息已读回执
Parameters:
- list 接收到的已读回执消息列表
Example:
public void onReceiveReadAcks(BMXMessageList list) {
// 收到已读回执
if (list != null && !list.isEmpty()) {
for (int i = 0; i < list.size(); i++) {
BMXMessage message = list.get(i);
if (message != null) {
// 当前会话
if (mView != null) {
mView.updateChatMessage(message);
}
}
}
}
}
public void onReceiveReadAcks(BMXMessageList list) {
loadSession();
}
public void onReceiveReadAcks(BMXMessageList list) {
super.onReceiveReadAcks(list);
for (BMXChatServiceListener listener : mListener) {
listener.onReceiveReadAcks(list);
}
}
function onReceiveDeliverAcks
inline void onReceiveDeliverAcks(
BMXMessageList list
)
收到消息已送达回执
Parameters:
- list 接收到的已送达回执消息列表
Example:
public void onReceiveDeliverAcks(BMXMessageList list) {
}
public void onReceiveDeliverAcks(BMXMessageList list) {
}
public void onReceiveDeliverAcks(BMXMessageList list) {
super.onReceiveDeliverAcks(list);
for (BMXChatServiceListener listener : mListener) {
listener.onReceiveDeliverAcks(list);
}
}
function onReceiveRecallMessages
inline void onReceiveRecallMessages(
BMXMessageList list
)
收到撤回消息
Parameters:
- list 接收到的撤回消息列表
Example:
public void onReceiveRecallMessages(BMXMessageList list) {
// 收到撤回消息
if (list != null && !list.isEmpty()) {
for (int i = 0; i < list.size(); i++) {
BMXMessage message = list.get(i);
if (message != null && isCurrentSession(message)) {
// 当前会话
if (mView != null) {
((Activity)mView.getContext())
.runOnUiThread(() -> ToastUtil.showTextViewPrompt("对方撤回一条消息"));
mView.deleteChatMessage(message);
}
}
}
}
}
public void onReceiveRecallMessages(BMXMessageList list) {
// 收到撤回消息
loadSession();
}
public void onReceiveRecallMessages(BMXMessageList list) {
super.onReceiveRecallMessages(list);
for (BMXChatServiceListener listener : mListener) {
listener.onReceiveRecallMessages(list);
}
}
function onReceiveReadCancels
inline void onReceiveReadCancels(
BMXMessageList list
)
收到消息已读取消(多设备其他设备同步消息已读状态变为未读)
Parameters:
- list 接收到的消息已读取消消息列表
Example:
function onReceiveReadAllMessages
inline void onReceiveReadAllMessages(
BMXMessageList list
)
收到消息全部已读(多设备同步某消息之前消息全部设置为已读)
Parameters:
- list 接收到的消息全部已读消息列表
Example:
function onReceiveDeleteMessages
inline void onReceiveDeleteMessages(
BMXMessageList list
)
收到删除消息 (多设备同步删除消息)
Parameters:
- list 接收到的删除消息列表
Example:
function onReceivePlayAcks
inline void onReceivePlayAcks(
BMXMessageList list
)
收到消息已播放回执
Parameters:
- list 接收到的已读回执消息列表
Example:
function onAttachmentStatusChanged
inline void onAttachmentStatusChanged(
BMXMessage msg,
BMXErrorCode error,
int percent
)
附件下载状态发生变化
Parameters:
- msg 发生下载状态变化的消息
- error 状态错误码
- percent 附件下载的进度
Example:
public void onAttachmentStatusChanged(BMXMessage msg, BMXErrorCode error, int percent) {
// 附件消息下载进度
ChatAttachmentManager.getInstance().onProgressCallback(msg, percent);
Log.d("statusChanged", percent + "");
}
public void onAttachmentStatusChanged(BMXMessage msg, BMXErrorCode error, int percent) {
}
public void onAttachmentStatusChanged(BMXMessage msg, BMXErrorCode error, int percent) {
super.onAttachmentStatusChanged(msg, error, percent);
for (BMXChatServiceListener listener : mListener) {
listener.onAttachmentStatusChanged(msg, error, percent);
}
}
function onAttachmentDownloadByUrlStatusChanged
inline void onAttachmentDownloadByUrlStatusChanged(
long msgId,
BMXErrorCode error,
int percent
)
附件下载状态发生变化
Parameters:
- msgId 发生下载状态变化的消息ID
- error 状态错误码
- percent 附件下载的进度
Example:
function onRetrieveHistoryMessages
inline void onRetrieveHistoryMessages(
BMXConversation conversation
)
拉取历史消息
Parameters:
- conversation 发生了拉取指历史消息的会话
Example:
function onLoadAllConversation
inline void onLoadAllConversation()
已经加载完未读会话列表
Example:
function onConversationCreate
inline void onConversationCreate(
BMXConversation conversation,
BMXMessage msg
)
本地创建新会话
Parameters:
- conversation 新创建的本地会话
- msg 会话的最新消息,存在返回不存在返回为空
Example:
function onConversationDelete
inline void onConversationDelete(
long conversationId,
BMXErrorCode error
)
删除会话
Parameters:
- conversationId 删除的本地会话id
- error 状态错误码
Example:
function onTotalUnreadCountChanged
inline void onTotalUnreadCountChanged(
int unreadCount
)
更新总未读数
Parameters:
- unreadCount 本地全部会话未读总数
Example:
function BMXChatServiceListener
inline BMXChatServiceListener()
Example:
private BMXChatServiceListener mChatListener = new BMXChatServiceListener() {
@Override
public void onStatusChanged(BMXMessage msg, BMXErrorCode error) {
super.onStatusChanged(msg, error);
for (BMXChatServiceListener listener : mListener) {
listener.onStatusChanged(msg, error);
}
}
@Override
public void onAttachmentStatusChanged(BMXMessage msg, BMXErrorCode error, int percent) {
super.onAttachmentStatusChanged(msg, error, percent);
for (BMXChatServiceListener listener : mListener) {
listener.onAttachmentStatusChanged(msg, error, percent);
}
}
@Override
public void onRecallStatusChanged(BMXMessage msg, BMXErrorCode error) {
function registerChatService
inline void registerChatService(
BMXChatService service
)
Protected Functions Documentation
Example:
function BMXChatServiceListener
inline BMXChatServiceListener(
long cPtr,
boolean cMemoryOwn
)
Example:
private BMXChatServiceListener mChatListener = new BMXChatServiceListener() {
@Override
public void onStatusChanged(BMXMessage msg, BMXErrorCode error) {
super.onStatusChanged(msg, error);
for (BMXChatServiceListener listener : mListener) {
listener.onStatusChanged(msg, error);
}
}
@Override
public void onAttachmentStatusChanged(BMXMessage msg, BMXErrorCode error, int percent) {
super.onAttachmentStatusChanged(msg, error, percent);
for (BMXChatServiceListener listener : mListener) {
listener.onAttachmentStatusChanged(msg, error, percent);
}
}
@Override
public void onRecallStatusChanged(BMXMessage msg, BMXErrorCode error) {
function finalize
inline void finalize()
Example:
function swigDirectorDisconnect
inline void swigDirectorDisconnect()
Example:
function getCPtr
static inline long getCPtr(
BMXChatServiceListener obj
)
Protected Attributes Documentation
variable swigCMemOwn
transient boolean swigCMemOwn;
Example:
Updated on 2022-01-26 at 17:18:31 +0800