add 'localEx'

main
Brett 1 year ago
parent cd506801cf
commit 0ef41147fd
  1. 159
      lib/src/models/message.dart

@ -42,8 +42,8 @@ class Message {
/// Group ID. /// Group ID.
String? groupID; String? groupID;
/// Message content. /// Message localEx.
// String? content; String? localEx;
/// Message sequence number. /// Message sequence number.
int? seq; int? seq;
@ -137,7 +137,7 @@ class Message {
this.senderNickname, this.senderNickname,
this.senderFaceUrl, this.senderFaceUrl,
this.groupID, this.groupID,
// this.content, this.localEx,
this.seq, this.seq,
this.isRead, this.isRead,
this.hasReadTime, this.hasReadTime,
@ -179,65 +179,35 @@ class Message {
senderNickname = json['senderNickname']; senderNickname = json['senderNickname'];
senderFaceUrl = json['senderFaceUrl']; senderFaceUrl = json['senderFaceUrl'];
groupID = json['groupID']; groupID = json['groupID'];
// content = json['content']; localEx = json['localEx'];
seq = json['seq']; seq = json['seq'];
isRead = json['isRead']; isRead = json['isRead'];
status = json['status']; status = json['status'];
offlinePush = json['offlinePush'] != null offlinePush = json['offlinePush'] != null ? OfflinePushInfo.fromJson(json['offlinePush']) : null;
? OfflinePushInfo.fromJson(json['offlinePush'])
: null;
attachedInfo = json['attachedInfo']; attachedInfo = json['attachedInfo'];
ex = json['ex']; ex = json['ex'];
exMap = json['exMap'] ?? {}; exMap = json['exMap'] ?? {};
sessionType = json['sessionType']; sessionType = json['sessionType'];
pictureElem = json['pictureElem'] != null pictureElem = json['pictureElem'] != null ? PictureElem.fromJson(json['pictureElem']) : null;
? PictureElem.fromJson(json['pictureElem']) soundElem = json['soundElem'] != null ? SoundElem.fromJson(json['soundElem']) : null;
: null; videoElem = json['videoElem'] != null ? VideoElem.fromJson(json['videoElem']) : null;
soundElem = json['soundElem'] != null fileElem = json['fileElem'] != null ? FileElem.fromJson(json['fileElem']) : null;
? SoundElem.fromJson(json['soundElem']) atTextElem = json['atTextElem'] != null ? AtTextElem.fromJson(json['atTextElem']) : null;
: null; locationElem = json['locationElem'] != null ? LocationElem.fromJson(json['locationElem']) : null;
videoElem = json['videoElem'] != null
? VideoElem.fromJson(json['videoElem']) customElem = json['customElem'] != null ? CustomElem.fromJson(json['customElem']) : null;
: null; quoteElem = json['quoteElem'] != null ? QuoteElem.fromJson(json['quoteElem']) : null;
fileElem = mergeElem = json['mergeElem'] != null ? MergeElem.fromJson(json['mergeElem']) : null;
json['fileElem'] != null ? FileElem.fromJson(json['fileElem']) : null; notificationElem = json['notificationElem'] != null ? NotificationElem.fromJson(json['notificationElem']) : null;
atTextElem = json['atTextElem'] != null faceElem = json['faceElem'] != null ? FaceElem.fromJson(json['faceElem']) : null;
? AtTextElem.fromJson(json['atTextElem']) attachedInfoElem = json['attachedInfoElem'] != null ? AttachedInfoElem.fromJson(json['attachedInfoElem']) : null;
: null;
locationElem = json['locationElem'] != null
? LocationElem.fromJson(json['locationElem'])
: null;
customElem = json['customElem'] != null
? CustomElem.fromJson(json['customElem'])
: null;
quoteElem = json['quoteElem'] != null
? QuoteElem.fromJson(json['quoteElem'])
: null;
mergeElem = json['mergeElem'] != null
? MergeElem.fromJson(json['mergeElem'])
: null;
notificationElem = json['notificationElem'] != null
? NotificationElem.fromJson(json['notificationElem'])
: null;
faceElem =
json['faceElem'] != null ? FaceElem.fromJson(json['faceElem']) : null;
attachedInfoElem = json['attachedInfoElem'] != null
? AttachedInfoElem.fromJson(json['attachedInfoElem'])
: null;
hasReadTime = json['hasReadTime'] ?? attachedInfoElem?.hasReadTime; hasReadTime = json['hasReadTime'] ?? attachedInfoElem?.hasReadTime;
isExternalExtensions = json['isExternalExtensions']; isExternalExtensions = json['isExternalExtensions'];
isReact = json['isReact']; isReact = json['isReact'];
textElem = textElem = json['textElem'] != null ? TextElem.fromJson(json['textElem']) : null;
json['textElem'] != null ? TextElem.fromJson(json['textElem']) : null; cardElem = json['cardElem'] != null ? CardElem.fromJson(json['cardElem']) : null;
cardElem = advancedTextElem = json['advancedTextElem'] != null ? AdvancedTextElem.fromJson(json['advancedTextElem']) : null;
json['cardElem'] != null ? CardElem.fromJson(json['cardElem']) : null; typingElem = json['typingElem'] != null ? TypingElem.fromJson(json['typingElem']) : null;
advancedTextElem = json['advancedTextElem'] != null
? AdvancedTextElem.fromJson(json['advancedTextElem'])
: null;
typingElem = json['typingElem'] != null
? TypingElem.fromJson(json['typingElem'])
: null;
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -254,7 +224,7 @@ class Message {
data['senderNickname'] = this.senderNickname; data['senderNickname'] = this.senderNickname;
data['senderFaceUrl'] = this.senderFaceUrl; data['senderFaceUrl'] = this.senderFaceUrl;
data['groupID'] = this.groupID; data['groupID'] = this.groupID;
// data['content'] = this.content; data['localEx'] = this.localEx;
data['seq'] = this.seq; data['seq'] = this.seq;
data['isRead'] = this.isRead; data['isRead'] = this.isRead;
data['hasReadTime'] = this.hasReadTime; data['hasReadTime'] = this.hasReadTime;
@ -287,10 +257,7 @@ class Message {
@override @override
bool operator ==(Object other) => bool operator ==(Object other) =>
identical(this, other) || identical(this, other) || other is Message && runtimeType == other.runtimeType && clientMsgID == other.clientMsgID;
other is Message &&
runtimeType == other.runtimeType &&
clientMsgID == other.clientMsgID;
@override @override
int get hashCode => clientMsgID.hashCode; int get hashCode => clientMsgID.hashCode;
@ -340,9 +307,7 @@ class Message {
bool get isSingleChat => sessionType == ConversationType.single; bool get isSingleChat => sessionType == ConversationType.single;
/// Group chat message /// Group chat message
bool get isGroupChat => bool get isGroupChat => sessionType == ConversationType.group || sessionType == ConversationType.superGroup;
sessionType == ConversationType.group ||
sessionType == ConversationType.superGroup;
} }
/// Image message content /// Image message content
@ -359,23 +324,13 @@ class PictureElem {
/// Thumbnail picture object /// Thumbnail picture object
PictureInfo? snapshotPicture; PictureInfo? snapshotPicture;
PictureElem( PictureElem({this.sourcePath, this.sourcePicture, this.bigPicture, this.snapshotPicture});
{this.sourcePath,
this.sourcePicture,
this.bigPicture,
this.snapshotPicture});
PictureElem.fromJson(Map<String, dynamic> json) { PictureElem.fromJson(Map<String, dynamic> json) {
sourcePath = json['sourcePath']; sourcePath = json['sourcePath'];
sourcePicture = json['sourcePicture'] != null sourcePicture = json['sourcePicture'] != null ? new PictureInfo.fromJson(json['sourcePicture']) : null;
? new PictureInfo.fromJson(json['sourcePicture']) bigPicture = json['bigPicture'] != null ? new PictureInfo.fromJson(json['bigPicture']) : null;
: null; snapshotPicture = json['snapshotPicture'] != null ? new PictureInfo.fromJson(json['snapshotPicture']) : null;
bigPicture = json['bigPicture'] != null
? new PictureInfo.fromJson(json['bigPicture'])
: null;
snapshotPicture = json['snapshotPicture'] != null
? new PictureInfo.fromJson(json['snapshotPicture'])
: null;
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -414,8 +369,7 @@ class PictureInfo {
/// Image URL /// Image URL
String? url; String? url;
PictureInfo( PictureInfo({this.uuid, this.type, this.size, this.width, this.height, this.url});
{this.uuid, this.type, this.size, this.width, this.height, this.url});
PictureInfo.fromJson(Map<String, dynamic> json) { PictureInfo.fromJson(Map<String, dynamic> json) {
uuid = json['uuid']; uuid = json['uuid'];
@ -455,12 +409,7 @@ class SoundElem {
/// Duration in seconds /// Duration in seconds
int? duration; int? duration;
SoundElem( SoundElem({this.uuid, this.soundPath, this.sourceUrl, this.dataSize, this.duration});
{this.uuid,
this.soundPath,
this.sourceUrl,
this.dataSize,
this.duration});
SoundElem.fromJson(Map<String, dynamic> json) { SoundElem.fromJson(Map<String, dynamic> json) {
uuid = json['uuid']; uuid = json['uuid'];
@ -583,8 +532,7 @@ class FileElem {
/// File size /// File size
int? fileSize; int? fileSize;
FileElem( FileElem({this.filePath, this.uuid, this.sourceUrl, this.fileName, this.fileSize});
{this.filePath, this.uuid, this.sourceUrl, this.fileName, this.fileSize});
FileElem.fromJson(Map<String, dynamic> json) { FileElem.fromJson(Map<String, dynamic> json) {
filePath = json['filePath']; filePath = json['filePath'];
@ -637,13 +585,9 @@ class AtTextElem {
} }
isAtSelf = json['isAtSelf']; isAtSelf = json['isAtSelf'];
if (json['atUsersInfo'] is List) { if (json['atUsersInfo'] is List) {
atUsersInfo = (json['atUsersInfo'] as List) atUsersInfo = (json['atUsersInfo'] as List).map((e) => AtUserInfo.fromJson(e)).toList();
.map((e) => AtUserInfo.fromJson(e))
.toList();
} }
quoteMessage = null != json['quoteMessage'] quoteMessage = null != json['quoteMessage'] ? Message.fromJson(json['quoteMessage']) : null;
? Message.fromJson(json['quoteMessage'])
: null;
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -766,9 +710,7 @@ class MergeElem {
abstractList = json['abstractList'].cast<String>(); abstractList = json['abstractList'].cast<String>();
} }
if (json['multiMessage'] is List) { if (json['multiMessage'] is List) {
multiMessage = (json['multiMessage'] as List) multiMessage = (json['multiMessage'] as List).map((e) => Message.fromJson(e)).toList();
.map((e) => Message.fromJson(e))
.toList();
} }
} }
@ -854,9 +796,7 @@ class AttachedInfoElem {
}); });
AttachedInfoElem.fromJson(Map<String, dynamic> json) { AttachedInfoElem.fromJson(Map<String, dynamic> json) {
groupHasReadInfo = json['groupHasReadInfo'] == null groupHasReadInfo = json['groupHasReadInfo'] == null ? null : GroupHasReadInfo.fromJson(json['groupHasReadInfo']);
? null
: GroupHasReadInfo.fromJson(json['groupHasReadInfo']);
isPrivateChat = json['isPrivateChat']; isPrivateChat = json['isPrivateChat'];
hasReadTime = json['hasReadTime']; hasReadTime = json['hasReadTime'];
burnDuration = json['burnDuration']; burnDuration = json['burnDuration'];
@ -939,18 +879,13 @@ class AdvancedTextElem {
AdvancedTextElem.fromJson(Map<String, dynamic> json) { AdvancedTextElem.fromJson(Map<String, dynamic> json) {
text = json['text']; text = json['text'];
messageEntityList = json['messageEntityList'] == null messageEntityList = json['messageEntityList'] == null ? null : (json['messageEntityList'] as List).map((e) => MessageEntity.fromJson(e)).toList();
? null
: (json['messageEntityList'] as List)
.map((e) => MessageEntity.fromJson(e))
.toList();
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final data = Map<String, dynamic>(); final data = Map<String, dynamic>();
data['text'] = text; data['text'] = text;
data['messageEntityList'] = data['messageEntityList'] = messageEntityList?.map((e) => e.toJson()).toList();
messageEntityList?.map((e) => e.toJson()).toList();
return data; return data;
} }
} }
@ -1036,14 +971,7 @@ class ReadReceiptInfo {
/// Conversation type [ConversationType] /// Conversation type [ConversationType]
int? sessionType; int? sessionType;
ReadReceiptInfo( ReadReceiptInfo({this.userID, this.groupID, this.msgIDList, this.readTime, this.msgFrom, this.contentType, this.sessionType});
{this.userID,
this.groupID,
this.msgIDList,
this.readTime,
this.msgFrom,
this.contentType,
this.sessionType});
ReadReceiptInfo.fromJson(Map<String, dynamic> json) { ReadReceiptInfo.fromJson(Map<String, dynamic> json) {
userID = json['uid'] ?? json['userID']; userID = json['uid'] ?? json['userID'];
@ -1086,8 +1014,7 @@ class OfflinePushInfo {
/// iOS-specific /// iOS-specific
bool? iOSBadgeCount; bool? iOSBadgeCount;
OfflinePushInfo( OfflinePushInfo({this.title, this.desc, this.ex, this.iOSPushSound, this.iOSBadgeCount});
{this.title, this.desc, this.ex, this.iOSPushSound, this.iOSBadgeCount});
OfflinePushInfo.fromJson(Map<String, dynamic> json) { OfflinePushInfo.fromJson(Map<String, dynamic> json) {
title = json['title']; title = json['title'];
@ -1215,11 +1142,7 @@ class AdvancedMessage {
}); });
AdvancedMessage.fromJson(Map<String, dynamic> json) { AdvancedMessage.fromJson(Map<String, dynamic> json) {
messageList = json['messageList'] == null messageList = json['messageList'] == null ? null : (json['messageList'] as List).map((e) => Message.fromJson(e)).toList();
? null
: (json['messageList'] as List)
.map((e) => Message.fromJson(e))
.toList();
isEnd = json['isEnd']; isEnd = json['isEnd'];
errCode = json['errCode']; errCode = json['errCode'];
errMsg = json['errMsg']; errMsg = json['errMsg'];

Loading…
Cancel
Save