im::floo::floolib::BMXMessageConfig
消息配置
Inherits from BMXBaseObject
Public Functions
Name | |
---|---|
synchronized void | delete() |
void | setMentionAll(boolean mentionAll)<br>设置是否@全员 |
boolean | getMentionAll()<br>获取是否@全员 |
void | setMentionList(ListOfLongLong mentionList) 设置通知成员id列表 |
ListOfLongLong | getMentionList()<br>获取@成员列表 |
void | setMentionedMessage(String mentionedMessage)<br>设置@消息 |
String | getMentionedMessage()<br>获取@消息 |
void | setPushMessage(String pushMessage) 设置推送消息 |
String | getPushMessage() 获取推送消息 |
void | setSenderNickname(String senderNickname) 设置发送者昵称 |
String | getSenderNickname() 获取发送者昵称 |
void | setGroupMemberList(ListOfLongLong groupMemberList) 设置需要群已读消息的群成员id列表 |
ListOfLongLong | getGroupMemberList() 获取需要群已读消息的群成员id列表 |
void | addGroupMember(long id) 添加群已读消息的群成员id列表成员 |
void | removeGroupMember(long id) 清除需要群已读消息的群成员id列表成员 |
void | clearGroupMemberList() 清空群已读消息的群成员id列表 |
void | setIOSConfig(String iosConfig) |
String | getIOSConfig() 获取iOS消息配置 |
void | setAndroidConfig(String androidConfig) |
String | getAndroidConfig() 获取Android消息配置 |
void | setPushShowBeginTime(int beginTime) |
int | getPushShowBeginTime() 获取推送消息开始展示时间 |
void | setPushShowEndTime(int endTime) |
int | getPushShowEndTime() 获取推送消息结束展示时间 |
void | setPushTitle(String pushTitle) |
String | getPushTitle() 获取推送消息标题 |
boolean | isSilence() |
BMXMessageConfig.BadgeCountType | getBadgeCountType() |
int | getBadgeCount(int count) |
String | getUsername() 获取消息发送者用户名 |
String | serialize() 序列化操作 |
BMXMessageConfig | createMessageConfig(boolean mentionAll) |
Protected Functions
Name | |
---|---|
BMXMessageConfig(long cPtr, boolean cMemoryOwn) | |
void | finalize() |
long | getCPtr(BMXMessageConfig obj) |
Public Functions Documentation
function delete
inline synchronized void delete()
Example:
function setMentionAll
inline void setMentionAll(
boolean mentionAll
)
设置是否@全员
Parameters:
- mentionAll
Example:
if (atMap != null && !atMap.isEmpty()) {
BMXMessageConfig config = BMXMessageConfig.createMessageConfig(false);
config.setSenderNickname(senderName);
config.setPushMessage(ChatUtils.getInstance().getMessageDesc(context, msg));
// @对象的存储信息 包括全部成员或者部分成员
if (atMap.containsKey("-1")) {
// @全部
String atTitle = atMap.get("-1");
if (!TextUtils.isEmpty(atTitle) && text.contains(atTitle)) {
// 如果包含全部直接走全部 还需要判断文本消息是否包含完成的@名称 如果没有就不触发@
config.setMentionAll(true);
}
} else {
// @部分成员 需要遍历添加@信息
ListOfLongLong atIds = new ListOfLongLong();
config.setMentionAll(false);
for (Map.Entry<String, String> entry : atMap.entrySet()) {
// 发送文字包含@对象的名称时再加入 防止输入框@对象名称被修改
if (entry.getValue() != null && !TextUtils.isEmpty(entry.getValue())
&& text.contains(entry.getValue())) {
if (atMap.containsKey("-1")) {
// @全部
String atTitle = atMap.get("-1");
if (!TextUtils.isEmpty(atTitle) && text.contains(atTitle)) {
// 如果包含全部直接走全部 还需要判断文本消息是否包含完成的@名称 如果没有就不触发@
config.setMentionAll(true);
}
} else {
// @部分成员 需要遍历添加@信息
ListOfLongLong atIds = new ListOfLongLong();
config.setMentionAll(false);
for (Map.Entry<String, String> entry : atMap.entrySet()) {
// 发送文字包含@对象的名称时再加入 防止输入框@对象名称被修改
if (entry.getValue() != null && !TextUtils.isEmpty(entry.getValue())
&& text.contains(entry.getValue())) {
// @部分成员 feed信息只需要feedId和userId 所以需要去除无用的信息
atIds.add(Long.valueOf(entry.getKey()));
}
}
config.setMentionList(atIds);
function getMentionAll
inline boolean getMentionAll()
获取是否@全员
Return: bool
Example:
spannableString.setSpan(new ForegroundColorSpan(Color.RED), 0, draftText.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
spannable.append(spannableString).append(draft);
desc.setText(spannable);
} else {
String msgDesc = ChatUtils.getInstance().getMessageDesc(mContext, lastMsg);
if (lastMsg != null && lastMsg.isReceiveMsg() && lastMsg.config() != null) {
// 有@
try {
BMXMessageConfig config = lastMsg.config();
if (config.getMentionAll()) {
msgDesc = mContext.getString(R.string.someone_at_you) + msgDesc;
} else {
ListOfLongLong atList = config.getMentionList();
if (atList != null && !atList.isEmpty()) {
for (int i = 0; i < atList.size(); i++) {
if (atList.get(
i) == (SharePreferenceUtils.getInstance().getUserId())) {
msgDesc = mContext.getString(R.string.someone_at_you) + msgDesc;
break;
function setMentionList
inline void setMentionList(
ListOfLongLong mentionList
)
设置通知成员id列表
Parameters:
- mentionList
Example:
ListOfLongLong atIds = new ListOfLongLong();
config.setMentionAll(false);
for (Map.Entry<String, String> entry : atMap.entrySet()) {
// 发送文字包含@对象的名称时再加入 防止输入框@对象名称被修改
if (entry.getValue() != null && !TextUtils.isEmpty(entry.getValue())
&& text.contains(entry.getValue())) {
// @部分成员 feed信息只需要feedId和userId 所以需要去除无用的信息
atIds.add(Long.valueOf(entry.getKey()));
}
}
config.setMentionList(atIds);
}
msg.setConfig(config);
}
return handlerMessage(msg);
function getMentionList
inline ListOfLongLong getMentionList()
获取@成员列表
Return: std::vector
Example:
desc.setText(spannable);
} else {
String msgDesc = ChatUtils.getInstance().getMessageDesc(mContext, lastMsg);
if (lastMsg != null && lastMsg.isReceiveMsg() && lastMsg.config() != null) {
// 有@
try {
BMXMessageConfig config = lastMsg.config();
if (config.getMentionAll()) {
msgDesc = mContext.getString(R.string.someone_at_you) + msgDesc;
} else {
ListOfLongLong atList = config.getMentionList();
if (atList != null && !atList.isEmpty()) {
for (int i = 0; i < atList.size(); i++) {
if (atList.get(
i) == (SharePreferenceUtils.getInstance().getUserId())) {
msgDesc = mContext.getString(R.string.someone_at_you) + msgDesc;
break;
}
}
function setMentionedMessage
inline void setMentionedMessage(
String mentionedMessage
)
设置@消息
Parameters:
- mentionedMessage
Example:
function getMentionedMessage
inline String getMentionedMessage()
获取@消息
Return: std::string
Example:
function setPushMessage
inline void setPushMessage(
String pushMessage
)
设置推送消息
Parameters:
- pushMessage
Example:
public BMXMessage sendTextMessage(Context context, BMXMessage.MessageType type, long from, long to, String text,
Map<String, String> atMap, String senderName) {
BMXMessage msg = BMXMessage.createMessage(from, to, type, to, text);
if (msg == null) {
return null;
}
// 文本功能添加@对象
if (atMap != null && !atMap.isEmpty()) {
BMXMessageConfig config = BMXMessageConfig.createMessageConfig(false);
config.setSenderNickname(senderName);
config.setPushMessage(ChatUtils.getInstance().getMessageDesc(context, msg));
// @对象的存储信息 包括全部成员或者部分成员
if (atMap.containsKey("-1")) {
// @全部
String atTitle = atMap.get("-1");
if (!TextUtils.isEmpty(atTitle) && text.contains(atTitle)) {
// 如果包含全部直接走全部 还需要判断文本消息是否包含完成的@名称 如果没有就不触发@
config.setMentionAll(true);
}
} else {
function getPushMessage
inline String getPushMessage()
获取推送消息
Return: std::string
Example:
function setSenderNickname
inline void setSenderNickname(
String senderNickname
)
设置发送者昵称
Parameters:
- senderNickname
Example:
public BMXMessage sendTextMessage(Context context, BMXMessage.MessageType type, long from, long to, String text,
Map<String, String> atMap, String senderName) {
BMXMessage msg = BMXMessage.createMessage(from, to, type, to, text);
if (msg == null) {
return null;
}
// 文本功能添加@对象
if (atMap != null && !atMap.isEmpty()) {
BMXMessageConfig config = BMXMessageConfig.createMessageConfig(false);
config.setSenderNickname(senderName);
config.setPushMessage(ChatUtils.getInstance().getMessageDesc(context, msg));
// @对象的存储信息 包括全部成员或者部分成员
if (atMap.containsKey("-1")) {
// @全部
String atTitle = atMap.get("-1");
if (!TextUtils.isEmpty(atTitle) && text.contains(atTitle)) {
// 如果包含全部直接走全部 还需要判断文本消息是否包含完成的@名称 如果没有就不触发@
config.setMentionAll(true);
}
} else {
function getSenderNickname
inline String getSenderNickname()
获取发送者昵称
Return: std::string
Example:
function setGroupMemberList
inline void setGroupMemberList(
ListOfLongLong groupMemberList
)
设置需要群已读消息的群成员id列表
Parameters:
- groupMemberList
Example:
function getGroupMemberList
inline ListOfLongLong getGroupMemberList()
获取需要群已读消息的群成员id列表
Return: std::vector
Example:
function addGroupMember
inline void addGroupMember(
long id
)
添加群已读消息的群成员id列表成员
Example:
function removeGroupMember
inline void removeGroupMember(
long id
)
清除需要群已读消息的群成员id列表成员
Example:
function clearGroupMemberList
inline void clearGroupMemberList()
清空群已读消息的群成员id列表
Example:
function setIOSConfig
inline void setIOSConfig(
String iosConfig
)
Example:
function getIOSConfig
inline String getIOSConfig()
获取iOS消息配置
Example:
function setAndroidConfig
inline void setAndroidConfig(
String androidConfig
)
Example:
function getAndroidConfig
inline String getAndroidConfig()
获取Android消息配置
Example:
function setPushShowBeginTime
inline void setPushShowBeginTime(
int beginTime
)
Example:
function getPushShowBeginTime
inline int getPushShowBeginTime()
获取推送消息开始展示时间
Example:
function setPushShowEndTime
inline void setPushShowEndTime(
int endTime
)
Example:
function getPushShowEndTime
inline int getPushShowEndTime()
获取推送消息结束展示时间
Example:
function setPushTitle
inline void setPushTitle(
String pushTitle
)
Example:
function getPushTitle
inline String getPushTitle()
获取推送消息标题
Example:
function isSilence
inline boolean isSilence()
Example:
function getBadgeCountType
inline BMXMessageConfig.BadgeCountType getBadgeCountType()
Example:
function getBadgeCount
inline int getBadgeCount(
int count
)
Example:
function getUsername
inline String getUsername()
获取消息发送者用户名
Example:
function serialize
inline String serialize()
序列化操作
Return: std::string
Example:
function createMessageConfig
static inline BMXMessageConfig createMessageConfig(
boolean mentionAll
)
Protected Functions Documentation
Example:
public String sendRTCCallMessage(BMXMessageConfig.RTCCallType type, long roomId, long from, long to,
String pin) {
BMXMessageConfig con = BMXMessageConfig.createMessageConfig(false);
con.setRTCCallInfo(type, roomId, from, BMXMessageConfig.RTCRoomType.Broadcast, pin);
con.setPushMessageLocKey("call_in");
BMXMessage msg = BMXMessage.createRTCMessage(from, to, BMXMessage.MessageType.Single, to, "");
msg.setConfig(con);
msg.setExtension("{\"rtc\":\"call\"}");
handlerMessage(msg);
return con.getRTCCallId();
public void sendRTCPickupMessage(long from, long to, String callId) {
BMXMessageConfig con = BMXMessageConfig.createMessageConfig(false);
con.setRTCPickupInfo(callId);
BMXMessage msg = BMXMessage.createRTCMessage(from, to, BMXMessage.MessageType.Single, to, "");
msg.setConfig(con);
handlerMessage(msg);
public void sendRTCHangupMessage(long from, long to, String callId, String content, String pushMessageLocKey, String pushMessageLocArgs, boolean peerDrop) {
BMXMessageConfig con = BMXMessageConfig.createMessageConfig(false);
con.setRTCHangupInfo(callId, peerDrop);
con.setPushMessageLocKey(pushMessageLocKey);
if (pushMessageLocArgs.length() > 0){
con.setPushMessageLocArgs(pushMessageLocArgs);
}
BMXMessage msg = BMXMessage.createRTCMessage(from, to, BMXMessage.MessageType.Single, to, content);
msg.setConfig(con);
handlerMessage(msg);
public BMXMessage sendTextMessage(Context context, BMXMessage.MessageType type, long from, long to, String text,
Map<String, String> atMap, String senderName) {
BMXMessage msg = BMXMessage.createMessage(from, to, type, to, text);
if (msg == null) {
return null;
}
// 文本功能添加@对象
if (atMap != null && !atMap.isEmpty()) {
BMXMessageConfig config = BMXMessageConfig.createMessageConfig(false);
config.setSenderNickname(senderName);
config.setPushMessage(ChatUtils.getInstance().getMessageDesc(context, msg));
// @对象的存储信息 包括全部成员或者部分成员
if (atMap.containsKey("-1")) {
// @全部
String atTitle = atMap.get("-1");
if (!TextUtils.isEmpty(atTitle) && text.contains(atTitle)) {
// 如果包含全部直接走全部 还需要判断文本消息是否包含完成的@名称 如果没有就不触发@
config.setMentionAll(true);
}
} else {
function BMXMessageConfig
inline BMXMessageConfig(
long cPtr,
boolean cMemoryOwn
)
Example:
function finalize
inline void finalize()
Example:
function getCPtr
static inline long getCPtr(
BMXMessageConfig obj
)
Example:
Updated on 2022-01-26 at 17:18:31 +0800