|
|
|
|
@ -462,30 +462,31 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
|
|
|
|
|
var msg = message.text;
|
|
|
|
|
SingleUserChatModel data = SingleUserChatModel(
|
|
|
|
|
chatEventId: chatEventId,
|
|
|
|
|
chatSource: 1,
|
|
|
|
|
contant: msg,
|
|
|
|
|
contantNo: contentNo,
|
|
|
|
|
conversationId: chatCID,
|
|
|
|
|
createdDate: DateTime.now(),
|
|
|
|
|
currentUserId: AppState().chatDetails!.response!.id,
|
|
|
|
|
currentUserName: AppState().chatDetails!.response!.userName,
|
|
|
|
|
targetUserId: targetUserId,
|
|
|
|
|
targetUserName: targetUserName,
|
|
|
|
|
isReplied: false,
|
|
|
|
|
fileTypeId: fileTypeId,
|
|
|
|
|
userChatReplyResponse: isReply ? UserChatReplyResponse.fromJson(repliedMsg.first.toJson()) : null,
|
|
|
|
|
fileTypeResponse: isAttachment
|
|
|
|
|
? FileTypeResponse(
|
|
|
|
|
fileTypeId: fileTypeId,
|
|
|
|
|
fileTypeName: getFileType(getFileExtension(selectedFile.path).toString()),
|
|
|
|
|
fileKind: getFileExtension(selectedFile.path),
|
|
|
|
|
fileName: selectedFile.path.split("/").last,
|
|
|
|
|
fileTypeDescription: getFileTypeDescription(getFileExtension(selectedFile.path).toString()),
|
|
|
|
|
)
|
|
|
|
|
: null,
|
|
|
|
|
image: image,
|
|
|
|
|
isImageLoaded: isImageLoaded);
|
|
|
|
|
chatEventId: chatEventId,
|
|
|
|
|
chatSource: 1,
|
|
|
|
|
contant: msg,
|
|
|
|
|
contantNo: contentNo,
|
|
|
|
|
conversationId: chatCID,
|
|
|
|
|
createdDate: DateTime.now(),
|
|
|
|
|
currentUserId: AppState().chatDetails!.response!.id,
|
|
|
|
|
currentUserName: AppState().chatDetails!.response!.userName,
|
|
|
|
|
targetUserId: targetUserId,
|
|
|
|
|
targetUserName: targetUserName,
|
|
|
|
|
isReplied: false,
|
|
|
|
|
fileTypeId: fileTypeId,
|
|
|
|
|
userChatReplyResponse: isReply ? UserChatReplyResponse.fromJson(repliedMsg.first.toJson()) : null,
|
|
|
|
|
fileTypeResponse: isAttachment
|
|
|
|
|
? FileTypeResponse(
|
|
|
|
|
fileTypeId: fileTypeId,
|
|
|
|
|
fileTypeName: getFileType(getFileExtension(selectedFile.path).toString()),
|
|
|
|
|
fileKind: getFileExtension(selectedFile.path),
|
|
|
|
|
fileName: selectedFile.path.split("/").last,
|
|
|
|
|
fileTypeDescription: getFileTypeDescription(getFileExtension(selectedFile.path).toString()),
|
|
|
|
|
)
|
|
|
|
|
: null,
|
|
|
|
|
image: image,
|
|
|
|
|
isImageLoaded: isImageLoaded,
|
|
|
|
|
);
|
|
|
|
|
userChatHistory.insert(0, data);
|
|
|
|
|
isFileSelected = false;
|
|
|
|
|
isMsgReply = false;
|
|
|
|
|
@ -502,7 +503,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
dynamic contain = searchedChats!.where((ChatUser element) => element.id == targetUserId);
|
|
|
|
|
if (contain.isEmpty) {
|
|
|
|
|
searchedChats!.add(
|
|
|
|
|
ChatUser(id: targetUserId, userName: targetUserName, unreadMessageCount: 0),
|
|
|
|
|
ChatUser(id: targetUserId, userName: targetUserName, unreadMessageCount: 0, isImageLoading: false, image: null, isImageLoaded: false),
|
|
|
|
|
);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
@ -759,5 +760,4 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
print("Error: $e");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|