|
|
|
|
import 'dart:convert';
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
import 'dart:typed_data';
|
|
|
|
|
|
|
|
|
|
import 'package:just_audio/just_audio.dart';
|
|
|
|
|
|
|
|
|
|
class GetGroupChatHistoryAsync {
|
|
|
|
|
int? groupChatHistoryId;
|
|
|
|
|
String? contant;
|
|
|
|
|
String? contantNo;
|
|
|
|
|
int? chatEventId;
|
|
|
|
|
dynamic? fileTypeId;
|
|
|
|
|
bool? isSeen;
|
|
|
|
|
bool? isDelivered;
|
|
|
|
|
String? createdDate;
|
|
|
|
|
int? chatSource;
|
|
|
|
|
int? currentUserId;
|
|
|
|
|
String? currentUserName;
|
|
|
|
|
int? groupId;
|
|
|
|
|
String? groupName;
|
|
|
|
|
dynamic? encryptedGroupId;
|
|
|
|
|
dynamic? encryptedGroupName;
|
|
|
|
|
dynamic? callStatus;
|
|
|
|
|
String? conversationId;
|
|
|
|
|
List<GroupChatHistoryTargetUserList>? groupChatHistoryTargetUserList;
|
|
|
|
|
FileTypeResponse? fileTypeResponse;
|
|
|
|
|
GroupChatReplyResponse? groupChatReplyResponse;
|
|
|
|
|
bool? isReplied;
|
|
|
|
|
bool? isImageLoaded;
|
|
|
|
|
Uint8List? image;
|
|
|
|
|
File? voice;
|
|
|
|
|
AudioPlayer? voiceController;
|
|
|
|
|
GetGroupChatHistoryAsync(
|
|
|
|
|
{this.groupChatHistoryId,
|
|
|
|
|
this.contant,
|
|
|
|
|
this.contantNo,
|
|
|
|
|
this.chatEventId,
|
|
|
|
|
this.fileTypeId,
|
|
|
|
|
this.isSeen,
|
|
|
|
|
this.isDelivered,
|
|
|
|
|
this.createdDate,
|
|
|
|
|
this.chatSource,
|
|
|
|
|
this.currentUserId,
|
|
|
|
|
this.currentUserName,
|
|
|
|
|
this.groupId,
|
|
|
|
|
this.groupName,
|
|
|
|
|
this.encryptedGroupId,
|
|
|
|
|
this.encryptedGroupName,
|
|
|
|
|
this.callStatus,
|
|
|
|
|
this.conversationId,
|
|
|
|
|
this.groupChatHistoryTargetUserList,
|
|
|
|
|
this.fileTypeResponse,
|
|
|
|
|
this.groupChatReplyResponse,
|
|
|
|
|
this.image,
|
|
|
|
|
this.isImageLoaded,
|
|
|
|
|
this.isReplied,
|
|
|
|
|
this.voice,
|
|
|
|
|
this.voiceController
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
GetGroupChatHistoryAsync.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
groupChatHistoryId = json['groupChatHistoryId'];
|
|
|
|
|
contant = json['contant'];
|
|
|
|
|
contantNo = json['contantNo'];
|
|
|
|
|
chatEventId = json['chatEventId'];
|
|
|
|
|
fileTypeId = json['fileTypeId'];
|
|
|
|
|
isSeen = json['isSeen'];
|
|
|
|
|
isDelivered = json['isDelivered'];
|
|
|
|
|
createdDate = json['createdDate'];
|
|
|
|
|
chatSource = json['chatSource'];
|
|
|
|
|
currentUserId = json['currentUserId'];
|
|
|
|
|
currentUserName = json['currentUserName'];
|
|
|
|
|
groupId = json['groupId'];
|
|
|
|
|
groupName = json['groupName'];
|
|
|
|
|
encryptedGroupId = json['encryptedGroupId'];
|
|
|
|
|
encryptedGroupName = json['encryptedGroupName'];
|
|
|
|
|
callStatus = json['callStatus'];
|
|
|
|
|
conversationId = json['conversationId'];
|
|
|
|
|
if (json['groupChatHistoryTargetUserList'] != null) {
|
|
|
|
|
groupChatHistoryTargetUserList = <GroupChatHistoryTargetUserList>[];
|
|
|
|
|
json['groupChatHistoryTargetUserList'].forEach((v) {
|
|
|
|
|
groupChatHistoryTargetUserList!
|
|
|
|
|
.add(new GroupChatHistoryTargetUserList.fromJson(v));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
fileTypeResponse = json['fileTypeResponse'] != null
|
|
|
|
|
? new FileTypeResponse.fromJson(json['fileTypeResponse'])
|
|
|
|
|
: null;
|
|
|
|
|
groupChatReplyResponse = json["groupChatReplyResponse"] == null ? null : GroupChatReplyResponse.fromJson(json["groupChatReplyResponse"]);
|
|
|
|
|
|
|
|
|
|
isReplied= json['isReplied'];
|
|
|
|
|
isImageLoaded= json['isImageLoaded'] ??false;
|
|
|
|
|
image= json['image'];
|
|
|
|
|
voice= json['voice'];
|
|
|
|
|
voiceController = json["fileTypeId"] == 13 ? AudioPlayer() : null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
Map<String, dynamic> data = new Map<String, dynamic>();
|
|
|
|
|
data['groupChatHistoryId'] = this.groupChatHistoryId;
|
|
|
|
|
data['contant'] = this.contant;
|
|
|
|
|
data['contantNo'] = this.contantNo;
|
|
|
|
|
data['chatEventId'] = this.chatEventId;
|
|
|
|
|
data['fileTypeId'] = this.fileTypeId;
|
|
|
|
|
data['isSeen'] = this.isSeen;
|
|
|
|
|
data['isDelivered'] = this.isDelivered;
|
|
|
|
|
data['createdDate'] = this.createdDate;
|
|
|
|
|
data['chatSource'] = this.chatSource;
|
|
|
|
|
data['currentUserId'] = this.currentUserId;
|
|
|
|
|
data['currentUserName'] = this.currentUserName;
|
|
|
|
|
data['groupId'] = this.groupId;
|
|
|
|
|
data['groupName'] = this.groupName;
|
|
|
|
|
data['encryptedGroupId'] = this.encryptedGroupId;
|
|
|
|
|
data['encryptedGroupName'] = this.encryptedGroupName;
|
|
|
|
|
data['callStatus'] = this.callStatus;
|
|
|
|
|
data['conversationId'] = this.conversationId;
|
|
|
|
|
if (this.groupChatHistoryTargetUserList != null) {
|
|
|
|
|
data['groupChatHistoryTargetUserList'] =
|
|
|
|
|
this.groupChatHistoryTargetUserList!.map((v) => v.toJson()).toList();
|
|
|
|
|
}
|
|
|
|
|
if (this.fileTypeResponse != null) {
|
|
|
|
|
data['fileTypeResponse'] = this.fileTypeResponse!.toJson();
|
|
|
|
|
}
|
|
|
|
|
if(this.groupChatReplyResponse !=null) {
|
|
|
|
|
data['groupChatReplyResponse'] = this.groupChatReplyResponse;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data['isReplied'] =isReplied;
|
|
|
|
|
data['isImageLoaded'] = isImageLoaded ?? false;
|
|
|
|
|
data['image'] = image;
|
|
|
|
|
data['voice'] = voice;
|
|
|
|
|
data["fileTypeId"] == 13 ? AudioPlayer() : null;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class GroupChatHistoryTargetUserList {
|
|
|
|
|
int? groupChatHistoryLineId;
|
|
|
|
|
bool? isSeen;
|
|
|
|
|
bool? isDelivered;
|
|
|
|
|
int? targetUserId;
|
|
|
|
|
String? targetUserName;
|
|
|
|
|
dynamic? userAction;
|
|
|
|
|
|
|
|
|
|
GroupChatHistoryTargetUserList(
|
|
|
|
|
{this.groupChatHistoryLineId,
|
|
|
|
|
this.isSeen,
|
|
|
|
|
this.isDelivered,
|
|
|
|
|
this.targetUserId,
|
|
|
|
|
this.targetUserName,
|
|
|
|
|
this.userAction});
|
|
|
|
|
|
|
|
|
|
GroupChatHistoryTargetUserList.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
groupChatHistoryLineId = json['groupChatHistoryLineId'];
|
|
|
|
|
isSeen = json['isSeen'];
|
|
|
|
|
isDelivered = json['isDelivered'];
|
|
|
|
|
targetUserId = json['targetUserId'];
|
|
|
|
|
targetUserName = json['targetUserName'];
|
|
|
|
|
userAction = json['userAction'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
Map<String, dynamic> data = new Map<String, dynamic>();
|
|
|
|
|
data['groupChatHistoryLineId'] = this.groupChatHistoryLineId;
|
|
|
|
|
data['isSeen'] = this.isSeen;
|
|
|
|
|
data['isDelivered'] = this.isDelivered;
|
|
|
|
|
data['targetUserId'] = this.targetUserId;
|
|
|
|
|
data['targetUserName'] = this.targetUserName;
|
|
|
|
|
data['userAction'] = this.userAction;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class FileTypeResponse {
|
|
|
|
|
int? fileTypeId;
|
|
|
|
|
dynamic? fileTypeName;
|
|
|
|
|
dynamic? fileTypeDescription;
|
|
|
|
|
dynamic? fileKind;
|
|
|
|
|
dynamic? fileName;
|
|
|
|
|
|
|
|
|
|
FileTypeResponse(
|
|
|
|
|
{this.fileTypeId,
|
|
|
|
|
this.fileTypeName,
|
|
|
|
|
this.fileTypeDescription,
|
|
|
|
|
this.fileKind,
|
|
|
|
|
this.fileName});
|
|
|
|
|
|
|
|
|
|
FileTypeResponse.fromJson(Map<String, dynamic> json) {
|
|
|
|
|
fileTypeId = json['fileTypeId'];
|
|
|
|
|
fileTypeName = json['fileTypeName'];
|
|
|
|
|
fileTypeDescription = json['fileTypeDescription'];
|
|
|
|
|
fileKind = json['fileKind'];
|
|
|
|
|
fileName = json['fileName'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
|
Map<String, dynamic> data = new Map<String, dynamic>();
|
|
|
|
|
data['fileTypeId'] = this.fileTypeId;
|
|
|
|
|
data['fileTypeName'] = this.fileTypeName;
|
|
|
|
|
data['fileTypeDescription'] = this.fileTypeDescription;
|
|
|
|
|
data['fileKind'] = this.fileKind;
|
|
|
|
|
data['fileName'] = this.fileName;
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class GroupChatReplyResponse {
|
|
|
|
|
GroupChatReplyResponse(
|
|
|
|
|
{this.userChatHistoryId,
|
|
|
|
|
this.chatEventId,
|
|
|
|
|
this.contant,
|
|
|
|
|
this.contantNo,
|
|
|
|
|
this.fileTypeId,
|
|
|
|
|
this.createdDate,
|
|
|
|
|
this.targetUserId,
|
|
|
|
|
this.targetUserName,
|
|
|
|
|
this.fileTypeResponse,
|
|
|
|
|
this.isImageLoaded,
|
|
|
|
|
this.image,
|
|
|
|
|
this.voice});
|
|
|
|
|
|
|
|
|
|
int? userChatHistoryId;
|
|
|
|
|
int? chatEventId;
|
|
|
|
|
String? contant;
|
|
|
|
|
String? contantNo;
|
|
|
|
|
dynamic? fileTypeId;
|
|
|
|
|
DateTime? createdDate;
|
|
|
|
|
int? targetUserId;
|
|
|
|
|
String? targetUserName;
|
|
|
|
|
FileTypeResponse? fileTypeResponse;
|
|
|
|
|
bool? isImageLoaded;
|
|
|
|
|
Uint8List? image;
|
|
|
|
|
Uint8List? voice;
|
|
|
|
|
|
|
|
|
|
factory GroupChatReplyResponse.fromJson(Map<String, dynamic> json) => GroupChatReplyResponse(
|
|
|
|
|
userChatHistoryId: json["userChatHistoryId"] == null ? null : json["userChatHistoryId"],
|
|
|
|
|
chatEventId: json["chatEventId"] == null ? null : json["chatEventId"],
|
|
|
|
|
contant: json["contant"] == null ? null : json["contant"],
|
|
|
|
|
contantNo: json["contantNo"] == null ? null : json["contantNo"],
|
|
|
|
|
fileTypeId: json["fileTypeId"],
|
|
|
|
|
createdDate: json["createdDate"] == null ? null : DateTime.parse(json["createdDate"]),
|
|
|
|
|
targetUserId: json["targetUserId"] == null ? null : json["targetUserId"],
|
|
|
|
|
targetUserName: json["targetUserName"] == null ? null : json["targetUserName"],
|
|
|
|
|
fileTypeResponse: json["fileTypeResponse"] == null ? null : FileTypeResponse.fromJson(json["fileTypeResponse"]),
|
|
|
|
|
isImageLoaded: false,
|
|
|
|
|
image: null,
|
|
|
|
|
voice: null,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
|
"userChatHistoryId": userChatHistoryId == null ? null : userChatHistoryId,
|
|
|
|
|
"chatEventId": chatEventId == null ? null : chatEventId,
|
|
|
|
|
"contant": contant == null ? null : contant,
|
|
|
|
|
"contantNo": contantNo == null ? null : contantNo,
|
|
|
|
|
"fileTypeId": fileTypeId,
|
|
|
|
|
"createdDate": createdDate == null ? null : createdDate!.toIso8601String(),
|
|
|
|
|
"targetUserId": targetUserId == null ? null : targetUserId,
|
|
|
|
|
"targetUserName": targetUserName == null ? null : targetUserName,
|
|
|
|
|
"fileTypeResponse": fileTypeResponse == null ? null : fileTypeResponse!.toJson(),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|