This commit is contained in:
xianghr
2022-09-09 17:17:31 +08:00
parent a6aea5496a
commit cd06c3bb5a
10 changed files with 180 additions and 62 deletions

View File

@@ -45,6 +45,12 @@ class MessageType {
/// 自定义表情
static const custom_face = 115;
/// 群消息已读回执
static const groupHasReadReceipt = 116;
/// 富文本消息
static const advancedText = 117;
/// 高级撤回
static const advancedRevoke = 118;

View File

@@ -752,6 +752,46 @@ class MessageManager {
.then((value) =>
Utils.toObj(value, (map) => SearchResult.fromJson(value)));
/// 富文本消息
/// [text] 输入内容
/// [list] 富文本消息具体详细
Future<Message> createAdvancedTextMessage({
required String text,
List<RichMessageInfo> list = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'createAdvancedTextMessage',
_buildParam({
'text': text,
'richMessageInfoList': list.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}),
)
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
/// 富文本消息
/// [text] 回复的内容
/// [quoteMsg] 被回复的消息
/// [list] 富文本消息具体详细
Future<Message> createAdvancedQuoteMessage({
required String text,
required Message quoteMsg,
List<RichMessageInfo> list = const [],
String? operationID,
}) =>
_channel
.invokeMethod(
'createAdvancedQuoteMessage',
_buildParam({
'quoteText': text,
'quoteMessage': quoteMsg.toJson(),
'richMessageInfoList': list.map((e) => e.toJson()).toList(),
"operationID": Utils.checkOperationID(operationID),
}))
.then((value) => Utils.toObj(value, (map) => Message.fromJson(map)));
static Map _buildParam(Map param) {
param["ManagerName"] = "messageManager";
return param;

View File

@@ -219,7 +219,7 @@ class GroupMembersInfo {
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is GroupMembersInfo &&
other is GroupMembersInfo &&
runtimeType == other.runtimeType &&
groupID == other.groupID &&
userID == other.userID;

View File

@@ -1072,3 +1072,37 @@ class AdvancedMessage {
return data;
}
}
class RichMessageInfo {
String? type;
int? offset;
int? length;
String? url;
String? info;
RichMessageInfo({
this.type,
this.offset,
this.length,
this.url,
this.info,
});
RichMessageInfo.fromJson(Map<String, dynamic> json) {
type = json['type'];
offset = json['offset'];
length = json['length'];
url = json['url'];
info = json['info'];
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['type'] = this.type;
data['offset'] = this.offset;
data['length'] = this.length;
data['url'] = this.url;
data['info'] = this.info;
return data;
}
}