chat flow improvement and connect to SignalR.

design_3.0_cx_module
Sikander Saleem 2 months ago
parent 781e61814a
commit 186987c5ce

@ -17,6 +17,7 @@ class URLs {
// static final String _baseUrl = "$_host/v5/mobile"; // v5 for data segregation
static const String chatHubUrl = "https://apiderichat.hmg.com/chathub";
static const String chatHubUrlApi = "$chatHubUrl/api"; // new V2 apis
static const String chatHubUrlChat = "$chatHubUrl/hubs/chat"; // new V2 apis
static const String chatApiKey = "f53a98286f82798d588f67a7f0db19f7aebc839e"; // new V2 apis

@ -7,17 +7,17 @@ extension StringExtensions on String {
void get showToast => Fluttertoast.showToast(msg: this);
String get chatMsgTime {
DateTime dateTime = DateTime.parse(this);
DateTime dateTime = DateTime.parse(this).toLocal();
return DateFormat('hh:mm a').format(dateTime);
}
String get chatMsgDate {
DateTime dateTime = DateTime.parse(this);
DateTime dateTime = DateTime.parse(this).toLocal();
return DateFormat('EEE dd MMM').format(dateTime);
}
String get chatMsgDateWithYear {
DateTime dateTime = DateTime.parse(this);
DateTime dateTime = DateTime.parse(this).toLocal();
return DateFormat('EEE dd MMM, yyyy').format(dateTime);
}

@ -79,13 +79,15 @@ extension WidgetExtensions on Widget {
: this;
}
Widget toShimmer({bool isShow = true, double radius = 20, required BuildContext context}) => isShow
Widget toShimmer({bool isShow = true, double radius = 20, double? width, double? height, required BuildContext context}) => isShow
? Shimmer.fromColors(
baseColor: context.isDark ? AppColor.backgroundDark : const Color(0xffe8eff0),
highlightColor: AppColor.background(context),
child: ClipRRect(
borderRadius: BorderRadius.circular(radius),
child: Container(
width: width,
height: height,
color: AppColor.background(context),
child: this,
),

@ -12,6 +12,7 @@ import 'package:test_sa/models/helper_data_models/workorder/work_order_helper_mo
import 'package:test_sa/modules/cm_module/service_request_detail_provider.dart';
import 'package:test_sa/modules/cm_module/views/components/bottom_sheets/service_request_bottomsheet.dart';
import 'package:test_sa/modules/cx_module/chat/chat_page.dart';
import 'package:test_sa/modules/cx_module/chat/chat_provider.dart';
import 'package:test_sa/modules/cx_module/survey/survey_page.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
@ -90,13 +91,35 @@ class _ServiceRequestDetailMainState extends State<ServiceRequestDetailMain> {
Navigator.push(context, CupertinoPageRoute(builder: (context) => SurveyPage(moduleId: 1, requestId: widget.requestId, surveyId: 5)));
},
),
IconButton(
icon: const Icon(Icons.chat_bubble),
onPressed: () {
Navigator.push(
context, CupertinoPageRoute(builder: (context) => ChatPage(moduleId: 1, requestId: widget.requestId, title: _requestProvider.currentWorkOrder?.data?.workOrderNo ?? "")));
},
),
Selector<ServiceRequestDetailProvider, bool>(
selector: (_, myModel) => myModel.isLoading, // Selects only the userName
builder: (_, isLoading, __) {
if (isLoading) {
return const SizedBox();
} else {
ServiceRequestDetailProvider provider = Provider.of<ServiceRequestDetailProvider>(context, listen: false);
if (provider.currentWorkOrder?.data?.status?.value == 2) {
getChatToken(1, provider.currentWorkOrder?.data?.workOrderNo ?? "");
return Consumer<ChatProvider>(builder: (pContext, requestProvider, _) {
return IconButton(
icon: const Icon(Icons.chat_bubble),
onPressed: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => ChatPage(
moduleId: 1,
requestId: widget.requestId,
title: _requestProvider.currentWorkOrder?.data?.workOrderNo ?? "",
readOnly: _requestProvider.isReadOnlyRequest,
)));
},
).toShimmer(context: context, isShow: requestProvider.chatLoginTokenLoading, radius: 30, height: 30, width: 30);
});
}
return const SizedBox();
}
}),
isNurse
? IconButton(
icon: 'qr'.toSvgAsset(
@ -156,4 +179,21 @@ class _ServiceRequestDetailMainState extends State<ServiceRequestDetailMain> {
)),
);
}
void getChatToken(int moduleId, String title) {
ChatProvider cProvider = Provider.of<ChatProvider>(context, listen: false);
if (cProvider.chatLoginResponse != null) return;
String assigneeEmployeeNumber = Provider.of<ServiceRequestDetailProvider>(context, listen: false).currentWorkOrder?.data?.assignedEmployee?.employeeId ?? "";
String myEmployeeId = context.userProvider.user!.username!;
// String sender = context.settingProvider.username;
String receiver = context.userProvider.isNurse
? assigneeEmployeeNumber
: (context.userProvider.isEngineer ? Provider.of<ServiceRequestDetailProvider>(context, listen: false).currentWorkOrder!.data!.workOrderContactPerson.first.employeeId! : "");
// assigneeEmployeeNumber
// ChatProvider cProvider = Provider.of<ChatProvider>(context, listen: false);
// Provider.of<ChatProvider>(context, listen: false).getUserAutoLoginToken(widget.moduleId, widget.requestId, widget.title, myEmployeeId, assigneeEmployeeNumber);
cProvider.getUserAutoLoginTokenSilent(moduleId, widget.requestId, title, myEmployeeId, receiver);
}
}

@ -13,6 +13,7 @@ import 'api_client.dart';
import 'model/chat_login_response_model.dart';
import 'model/chat_participant_model.dart';
import 'model/get_search_user_chat_model.dart';
import 'model/get_single_user_chat_list_model.dart';
import 'model/get_user_login_token_model.dart' as userLoginTokenModel;
import 'model/user_chat_history_model.dart';
@ -74,14 +75,14 @@ class ChatApiClient {
}
}
Future<List<ChatHistoryResponse>> loadChatHistory(int moduleId, int referenceId, String myId, String otherId) async {
Future<List<SingleUserChatModel>> loadChatHistory(int moduleId, int referenceId, String myId, String otherId) async {
Response response = await ApiClient().postJsonForResponse(
"${URLs.chatHubUrlApi}/UserChatHistory/GetUserChatHistory/$myId/$otherId/0", {"moduleCode": moduleId.toString(), "referenceId": referenceId.toString()},
token: chatLoginResponse!.token);
// try {
if (response.statusCode == 200) {
List data = jsonDecode(response.body);
return data.map((elemet) => ChatHistoryResponse.fromJson(elemet)).toList();
return data.map((elemet) => SingleUserChatModel.fromJson(elemet)).toList();
// return UserChatHistoryModel.fromJson(jsonDecode(response.body));
} else {
@ -92,7 +93,7 @@ class ChatApiClient {
// }
}
Future<ChatResponse?> sendTextMessage(String message, int conversationId) async {
/* Future<ChatResponse?> sendTextMessage(String message, int conversationId) async {
try {
Response response =
await ApiClient().postJsonForResponse("${URLs.chatHubUrlApi}/chat/conversations/$conversationId/messages", {"content": message, "messageType": "Text"}, token: chatLoginResponse!.token);
@ -106,7 +107,7 @@ class ChatApiClient {
print(ex);
return null;
}
}
}*/
// Future<ChatUserModel> getChatMemberFromSearch(String searchParam, int cUserId, int pageNo) async {
// ChatUserModel chatUserModel;

@ -1,3 +1,5 @@
import 'dart:convert';
import 'package:audio_waveforms/audio_waveforms.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@ -15,6 +17,7 @@ import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
import 'model/get_single_user_chat_list_model.dart';
import 'model/user_chat_history_model.dart';
enum ChatState { idle, voiceRecordingStarted, voiceRecordingCompleted }
@ -45,10 +48,12 @@ class _ChatPageState extends State<ChatPage> {
ChatState chatState = ChatState.idle;
late String receiver;
@override
void initState() {
super.initState();
getChatToken();
loadChatHistory();
playerController.addListener(() async {
// if (playerController.playerState == PlayerState.playing && playerController.maxDuration == await playerController.getDuration()) {
// await playerController.stopPlayer();
@ -57,19 +62,14 @@ class _ChatPageState extends State<ChatPage> {
});
}
void getChatToken() {
void loadChatHistory() {
String assigneeEmployeeNumber = Provider.of<ServiceRequestDetailProvider>(context, listen: false).currentWorkOrder?.data?.assignedEmployee?.employeeId ?? "";
String myEmployeeId = context.userProvider.user!.username!;
// String sender = context.settingProvider.username;
String receiver = context.userProvider.isNurse
receiver = context.userProvider.isNurse
? assigneeEmployeeNumber
: (context.userProvider.isEngineer ? Provider.of<ServiceRequestDetailProvider>(context, listen: false).currentWorkOrder!.data!.workOrderContactPerson.first.employeeId! : "");
// assigneeEmployeeNumber
// Provider.of<ChatProvider>(context, listen: false).getUserAutoLoginToken(widget.moduleId, widget.requestId, widget.title, myEmployeeId, assigneeEmployeeNumber);
Provider.of<ChatProvider>(context, listen: false).getUserAutoLoginToken(widget.moduleId, widget.requestId, widget.title, myEmployeeId, receiver);
Provider.of<ChatProvider>(context, listen: false).connectToHub(widget.moduleId, widget.requestId, myEmployeeId, receiver);
}
@override
@ -100,12 +100,10 @@ class _ChatPageState extends State<ChatPage> {
),
24.height,
AppFilledButton(
label: "Retry",
label: "Go Back",
maxWidth: true,
buttonColor: AppColor.primary10,
onPressed: () async {
getChatToken();
},
onPressed: () => Navigator.pop(context),
).paddingOnly(start: 48, end: 48)
],
).center;
@ -169,14 +167,14 @@ class _ChatPageState extends State<ChatPage> {
showDateHeader = true;
} else {
final nextMessage = chatProvider.chatResponseList[index + 1];
final currentDate = DateUtils.dateOnly(DateTime.parse(currentMessage.createdDate!));
final nextDate = DateUtils.dateOnly(DateTime.parse(nextMessage.createdDate!));
final currentDate = DateUtils.dateOnly(currentMessage.createdDate!);
final nextDate = DateUtils.dateOnly(nextMessage.createdDate!);
if (!currentDate.isAtSameMomentAs(nextDate)) {
showDateHeader = true;
}
}
return Column(mainAxisSize: MainAxisSize.min, children: [
if (showDateHeader) dateCard(currentMessage.createdDate?.chatMsgDateWithYear ?? ""),
if (showDateHeader) dateCard(currentMessage.createdDate?.toString().chatMsgDateWithYear ?? ""),
isSender ? senderMsgCard(showSenderName, chatProvider.chatResponseList[index]) : recipientMsgCard(showSenderName, chatProvider.chatResponseList[index])
]);
},
@ -198,6 +196,9 @@ class _ChatPageState extends State<ChatPage> {
maxLines: 3,
textInputAction: TextInputAction.none,
keyboardType: TextInputType.multiline,
onChanged: (text) {
chatHubConnection.invoke("SendTypingAsync", args: [context.userProvider.user!.username!]);
},
decoration: InputDecoration(
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
@ -458,7 +459,19 @@ class _ChatPageState extends State<ChatPage> {
highlightColor: Colors.transparent,
hoverColor: Colors.transparent,
onPressed: () {
chatProvider.sendTextMessage(textEditingController.text).then((success) {
chatProvider.invokeSendMessage({
"Contant": textEditingController.text,
// "ContantNo": "0cc8b126-6180-4f91-a64d-2f62443b3f3f",
// "CreatedDate": "2025-11-09T18:58:12.502Z",
"CurrentEmployeeNumber": context.userProvider.user!.username!,
"ChatEventId": 1,
"ConversationId": chatProvider.chatParticipantModel!.id!.toString(),
"ModuleCode": widget.moduleId.toString(),
"ReferenceNumber": widget.requestId.toString(),
"UserChatHistoryLineRequestList": [
{"TargetEmployeeNumber": receiver, "TargetUserStatus": 1, "IsSeen": false, "IsDelivered": true, "SeenOn": null, "DeliveredOn": null}
]
}).then((success) {
if (success) {
textEditingController.clear();
}
@ -499,7 +512,7 @@ class _ChatPageState extends State<ChatPage> {
.center;
}
Widget senderMsgCard(bool showHeader, ChatHistoryResponse? chatResponse, {bool loading = false, String msg = ""}) {
Widget senderMsgCard(bool showHeader, SingleUserChatModel? chatResponse, {bool loading = false, String msg = ""}) {
Widget senderHeader = Row(
mainAxisSize: MainAxisSize.min,
children: [
@ -548,7 +561,7 @@ class _ChatPageState extends State<ChatPage> {
).toShimmer(context: context, isShow: loading),
if (loading) 4.height,
Text(
chatResponse?.createdDate?.chatMsgTime ?? "2:00 PM",
chatResponse?.createdDate?.toString().chatMsgTime ?? "2:00 PM",
style: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.neutral50.withOpacity(0.5)),
).toShimmer(context: context, isShow: loading),
],
@ -569,7 +582,7 @@ class _ChatPageState extends State<ChatPage> {
);
}
Widget recipientMsgCard(bool showHeader, ChatHistoryResponse? chatResponse, {bool loading = false, String msg = ""}) {
Widget recipientMsgCard(bool showHeader, SingleUserChatModel? chatResponse, {bool loading = false, String msg = ""}) {
String extraSpaces = "";
int length = 0;
if ((chatResponse?.contant ?? "").isNotEmpty) {
@ -624,7 +637,7 @@ class _ChatPageState extends State<ChatPage> {
alignment: Alignment.centerRight,
widthFactor: 1,
child: Text(
chatResponse?.createdDate?.chatMsgTime ?? "2:00 PM",
chatResponse?.createdDate?.toString().chatMsgTime ?? "2:00 PM",
style: AppTextStyles.textFieldLabelStyle.copyWith(color: AppColor.white10),
),
).toShimmer(context: context, isShow: loading),

File diff suppressed because it is too large Load Diff

@ -41,10 +41,10 @@ class SingleUserChatModel {
int? userChatHistoryLineId;
String? contant;
String? contantNo;
int? currentUserId;
String? currentUserId;
String? currentUserName;
String? currentUserEmail;
int? targetUserId;
String? targetUserId;
String? targetUserName;
String? targetUserEmail;
String? encryptedTargetUserId;
@ -69,9 +69,9 @@ class SingleUserChatModel {
userChatHistoryLineId: json["userChatHistoryLineId"] == null ? null : json["userChatHistoryLineId"],
contant: json["contant"] == null ? null : json["contant"],
contantNo: json["contantNo"] == null ? null : json["contantNo"],
currentUserId: json["currentUserId"] == null ? null : json["currentUserId"],
currentUserId: json["currentUserId"] == null ? null : json["currentUserId"].toString(),
currentUserName: json["currentUserName"] == null ? null : json["currentUserName"],
targetUserId: json["targetUserId"] == null ? null : json["targetUserId"],
targetUserId: json["targetUserId"] == null ? null : json["targetUserId"].toString(),
targetUserName: json["targetUserName"] == null ? null : json["targetUserName"],
targetUserEmail: json["targetUserEmail"] == null ? null : json["targetUserEmail"],
currentUserEmail: json["currentUserEmail"] == null ? null : json["currentUserEmail"],

@ -1,224 +1,224 @@
class UserChatHistoryModel {
List<ChatResponse>? response;
bool? isSuccess;
List<String>? onlineUserConnId;
UserChatHistoryModel({this.response, this.isSuccess, this.onlineUserConnId});
UserChatHistoryModel.fromJson(Map<String, dynamic> json) {
if (json['response'] != null) {
response = <ChatResponse>[];
json['response'].forEach((v) {
response!.add(new ChatResponse.fromJson(v));
});
}
isSuccess = json['isSuccess'];
onlineUserConnId = json['onlineUserConnId'].cast<String>();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.response != null) {
data['response'] = this.response!.map((v) => v.toJson()).toList();
}
data['isSuccess'] = this.isSuccess;
data['onlineUserConnId'] = this.onlineUserConnId;
return data;
}
}
class ChatResponse {
int? id;
int? conversationId;
String? userId;
int? userIdInt;
String? userName;
String? content;
String? messageType;
String? createdAt;
ChatResponse({this.id, this.conversationId, this.userId, this.userIdInt, this.userName, this.content, this.messageType, this.createdAt});
ChatResponse.fromJson(Map<String, dynamic> json) {
id = json['id'];
conversationId = json['conversationId'];
userId = json['userId'];
userIdInt = json['userIdInt'];
userName = json['userName'];
content = json['content'];
messageType = json['messageType'];
createdAt = json['createdAt'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['conversationId'] = this.conversationId;
data['userId'] = this.userId;
data['userIdInt'] = this.userIdInt;
data['userName'] = this.userName;
data['content'] = this.content;
data['messageType'] = this.messageType;
data['createdAt'] = this.createdAt;
return data;
}
}
class ChatHistoryResponse {
int? userChatHistoryId;
int? userChatHistoryLineId;
String? contant;
String? contantNo;
String? currentUserId;
String? currentEmployeeNumber;
String? currentUserName;
String? currentUserEmail;
String? currentFullName;
String? targetUserId;
String? targetEmployeeNumber;
String? targetUserName;
String? targetUserEmail;
String? targetFullName;
String? encryptedTargetUserId;
String? encryptedTargetUserName;
int? chatEventId;
String? fileTypeId;
bool? isSeen;
bool? isDelivered;
String? createdDate;
int? chatSource;
String? conversationId;
FileTypeResponse? fileTypeResponse;
String? userChatReplyResponse;
String? deviceToken;
bool? isHuaweiDevice;
String? platform;
String? voipToken;
ChatHistoryResponse(
{this.userChatHistoryId,
this.userChatHistoryLineId,
this.contant,
this.contantNo,
this.currentUserId,
this.currentEmployeeNumber,
this.currentUserName,
this.currentUserEmail,
this.currentFullName,
this.targetUserId,
this.targetEmployeeNumber,
this.targetUserName,
this.targetUserEmail,
this.targetFullName,
this.encryptedTargetUserId,
this.encryptedTargetUserName,
this.chatEventId,
this.fileTypeId,
this.isSeen,
this.isDelivered,
this.createdDate,
this.chatSource,
this.conversationId,
this.fileTypeResponse,
this.userChatReplyResponse,
this.deviceToken,
this.isHuaweiDevice,
this.platform,
this.voipToken});
ChatHistoryResponse.fromJson(Map<String, dynamic> json) {
userChatHistoryId = json['userChatHistoryId'];
userChatHistoryLineId = json['userChatHistoryLineId'];
contant = json['contant'];
contantNo = json['contantNo'];
currentUserId = json['currentUserId'];
currentEmployeeNumber = json['currentEmployeeNumber'];
currentUserName = json['currentUserName'];
currentUserEmail = json['currentUserEmail'];
currentFullName = json['currentFullName'];
targetUserId = json['targetUserId'];
targetEmployeeNumber = json['targetEmployeeNumber'];
targetUserName = json['targetUserName'];
targetUserEmail = json['targetUserEmail'];
targetFullName = json['targetFullName'];
encryptedTargetUserId = json['encryptedTargetUserId'];
encryptedTargetUserName = json['encryptedTargetUserName'];
chatEventId = json['chatEventId'];
fileTypeId = json['fileTypeId'];
isSeen = json['isSeen'];
isDelivered = json['isDelivered'];
createdDate = json['createdDate'];
chatSource = json['chatSource'];
conversationId = json['conversationId'];
fileTypeResponse = json['fileTypeResponse'] != null ? new FileTypeResponse.fromJson(json['fileTypeResponse']) : null;
userChatReplyResponse = json['userChatReplyResponse'];
deviceToken = json['deviceToken'];
isHuaweiDevice = json['isHuaweiDevice'];
platform = json['platform'];
voipToken = json['voipToken'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['userChatHistoryId'] = this.userChatHistoryId;
data['userChatHistoryLineId'] = this.userChatHistoryLineId;
data['contant'] = this.contant;
data['contantNo'] = this.contantNo;
data['currentUserId'] = this.currentUserId;
data['currentEmployeeNumber'] = this.currentEmployeeNumber;
data['currentUserName'] = this.currentUserName;
data['currentUserEmail'] = this.currentUserEmail;
data['currentFullName'] = this.currentFullName;
data['targetUserId'] = this.targetUserId;
data['targetEmployeeNumber'] = this.targetEmployeeNumber;
data['targetUserName'] = this.targetUserName;
data['targetUserEmail'] = this.targetUserEmail;
data['targetFullName'] = this.targetFullName;
data['encryptedTargetUserId'] = this.encryptedTargetUserId;
data['encryptedTargetUserName'] = this.encryptedTargetUserName;
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['conversationId'] = this.conversationId;
if (this.fileTypeResponse != null) {
data['fileTypeResponse'] = this.fileTypeResponse!.toJson();
}
data['userChatReplyResponse'] = this.userChatReplyResponse;
data['deviceToken'] = this.deviceToken;
data['isHuaweiDevice'] = this.isHuaweiDevice;
data['platform'] = this.platform;
data['voipToken'] = this.voipToken;
return data;
}
}
class FileTypeResponse {
int? fileTypeId;
String? fileTypeName;
String? fileTypeDescription;
String? fileKind;
String? 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() {
final 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 UserChatHistoryModel {
// List<ChatResponse>? response;
// bool? isSuccess;
// List<String>? onlineUserConnId;
//
// UserChatHistoryModel({this.response, this.isSuccess, this.onlineUserConnId});
//
// UserChatHistoryModel.fromJson(Map<String, dynamic> json) {
// if (json['response'] != null) {
// response = <ChatResponse>[];
// json['response'].forEach((v) {
// response!.add(new ChatResponse.fromJson(v));
// });
// }
// isSuccess = json['isSuccess'];
// onlineUserConnId = json['onlineUserConnId'].cast<String>();
// }
//
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = new Map<String, dynamic>();
// if (this.response != null) {
// data['response'] = this.response!.map((v) => v.toJson()).toList();
// }
// data['isSuccess'] = this.isSuccess;
// data['onlineUserConnId'] = this.onlineUserConnId;
// return data;
// }
// }
//
// class ChatResponse {
// int? id;
// int? conversationId;
// String? userId;
// int? userIdInt;
// String? userName;
// String? content;
// String? messageType;
// String? createdAt;
//
// ChatResponse({this.id, this.conversationId, this.userId, this.userIdInt, this.userName, this.content, this.messageType, this.createdAt});
//
// ChatResponse.fromJson(Map<String, dynamic> json) {
// id = json['id'];
// conversationId = json['conversationId'];
// userId = json['userId'];
// userIdInt = json['userIdInt'];
// userName = json['userName'];
// content = json['content'];
// messageType = json['messageType'];
// createdAt = json['createdAt'];
// }
//
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = new Map<String, dynamic>();
// data['id'] = this.id;
// data['conversationId'] = this.conversationId;
// data['userId'] = this.userId;
// data['userIdInt'] = this.userIdInt;
// data['userName'] = this.userName;
// data['content'] = this.content;
// data['messageType'] = this.messageType;
// data['createdAt'] = this.createdAt;
// return data;
// }
// }
//
// class ChatHistoryResponse {
// int? userChatHistoryId;
// int? userChatHistoryLineId;
// String? contant;
// String? contantNo;
// String? currentUserId;
// String? currentEmployeeNumber;
// String? currentUserName;
// String? currentUserEmail;
// String? currentFullName;
// String? targetUserId;
// String? targetEmployeeNumber;
// String? targetUserName;
// String? targetUserEmail;
// String? targetFullName;
// String? encryptedTargetUserId;
// String? encryptedTargetUserName;
// int? chatEventId;
// String? fileTypeId;
// bool? isSeen;
// bool? isDelivered;
// String? createdDate;
// int? chatSource;
// String? conversationId;
// FileTypeResponse? fileTypeResponse;
// String? userChatReplyResponse;
// String? deviceToken;
// bool? isHuaweiDevice;
// String? platform;
// String? voipToken;
//
// ChatHistoryResponse(
// {this.userChatHistoryId,
// this.userChatHistoryLineId,
// this.contant,
// this.contantNo,
// this.currentUserId,
// this.currentEmployeeNumber,
// this.currentUserName,
// this.currentUserEmail,
// this.currentFullName,
// this.targetUserId,
// this.targetEmployeeNumber,
// this.targetUserName,
// this.targetUserEmail,
// this.targetFullName,
// this.encryptedTargetUserId,
// this.encryptedTargetUserName,
// this.chatEventId,
// this.fileTypeId,
// this.isSeen,
// this.isDelivered,
// this.createdDate,
// this.chatSource,
// this.conversationId,
// this.fileTypeResponse,
// this.userChatReplyResponse,
// this.deviceToken,
// this.isHuaweiDevice,
// this.platform,
// this.voipToken});
//
// ChatHistoryResponse.fromJson(Map<String, dynamic> json) {
// userChatHistoryId = json['userChatHistoryId'];
// userChatHistoryLineId = json['userChatHistoryLineId'];
// contant = json['contant'];
// contantNo = json['contantNo'];
// currentUserId = json['currentUserId'];
// currentEmployeeNumber = json['currentEmployeeNumber'];
// currentUserName = json['currentUserName'];
// currentUserEmail = json['currentUserEmail'];
// currentFullName = json['currentFullName'];
// targetUserId = json['targetUserId'];
// targetEmployeeNumber = json['targetEmployeeNumber'];
// targetUserName = json['targetUserName'];
// targetUserEmail = json['targetUserEmail'];
// targetFullName = json['targetFullName'];
// encryptedTargetUserId = json['encryptedTargetUserId'];
// encryptedTargetUserName = json['encryptedTargetUserName'];
// chatEventId = json['chatEventId'];
// fileTypeId = json['fileTypeId'];
// isSeen = json['isSeen'];
// isDelivered = json['isDelivered'];
// createdDate = json['createdDate'];
// chatSource = json['chatSource'];
// conversationId = json['conversationId'];
// fileTypeResponse = json['fileTypeResponse'] != null ? new FileTypeResponse.fromJson(json['fileTypeResponse']) : null;
// userChatReplyResponse = json['userChatReplyResponse'];
// deviceToken = json['deviceToken'];
// isHuaweiDevice = json['isHuaweiDevice'];
// platform = json['platform'];
// voipToken = json['voipToken'];
// }
//
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = new Map<String, dynamic>();
// data['userChatHistoryId'] = this.userChatHistoryId;
// data['userChatHistoryLineId'] = this.userChatHistoryLineId;
// data['contant'] = this.contant;
// data['contantNo'] = this.contantNo;
// data['currentUserId'] = this.currentUserId;
// data['currentEmployeeNumber'] = this.currentEmployeeNumber;
// data['currentUserName'] = this.currentUserName;
// data['currentUserEmail'] = this.currentUserEmail;
// data['currentFullName'] = this.currentFullName;
// data['targetUserId'] = this.targetUserId;
// data['targetEmployeeNumber'] = this.targetEmployeeNumber;
// data['targetUserName'] = this.targetUserName;
// data['targetUserEmail'] = this.targetUserEmail;
// data['targetFullName'] = this.targetFullName;
// data['encryptedTargetUserId'] = this.encryptedTargetUserId;
// data['encryptedTargetUserName'] = this.encryptedTargetUserName;
// 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['conversationId'] = this.conversationId;
// if (this.fileTypeResponse != null) {
// data['fileTypeResponse'] = this.fileTypeResponse!.toJson();
// }
// data['userChatReplyResponse'] = this.userChatReplyResponse;
// data['deviceToken'] = this.deviceToken;
// data['isHuaweiDevice'] = this.isHuaweiDevice;
// data['platform'] = this.platform;
// data['voipToken'] = this.voipToken;
// return data;
// }
// }
//
// class FileTypeResponse {
// int? fileTypeId;
// String? fileTypeName;
// String? fileTypeDescription;
// String? fileKind;
// String? 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() {
// final 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;
// }
// }

Loading…
Cancel
Save