chat flow improvement and connect to SignalR.

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

@ -17,6 +17,7 @@ class URLs {
// static final String _baseUrl = "$_host/v5/mobile"; // v5 for data segregation // static final String _baseUrl = "$_host/v5/mobile"; // v5 for data segregation
static const String chatHubUrl = "https://apiderichat.hmg.com/chathub"; static const String chatHubUrl = "https://apiderichat.hmg.com/chathub";
static const String chatHubUrlApi = "$chatHubUrl/api"; // new V2 apis static const String chatHubUrlApi = "$chatHubUrl/api"; // new V2 apis
static const String chatHubUrlChat = "$chatHubUrl/hubs/chat"; // new V2 apis static const String chatHubUrlChat = "$chatHubUrl/hubs/chat"; // new V2 apis
static const String chatApiKey = "f53a98286f82798d588f67a7f0db19f7aebc839e"; // 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); void get showToast => Fluttertoast.showToast(msg: this);
String get chatMsgTime { String get chatMsgTime {
DateTime dateTime = DateTime.parse(this); DateTime dateTime = DateTime.parse(this).toLocal();
return DateFormat('hh:mm a').format(dateTime); return DateFormat('hh:mm a').format(dateTime);
} }
String get chatMsgDate { String get chatMsgDate {
DateTime dateTime = DateTime.parse(this); DateTime dateTime = DateTime.parse(this).toLocal();
return DateFormat('EEE dd MMM').format(dateTime); return DateFormat('EEE dd MMM').format(dateTime);
} }
String get chatMsgDateWithYear { String get chatMsgDateWithYear {
DateTime dateTime = DateTime.parse(this); DateTime dateTime = DateTime.parse(this).toLocal();
return DateFormat('EEE dd MMM, yyyy').format(dateTime); return DateFormat('EEE dd MMM, yyyy').format(dateTime);
} }

@ -79,13 +79,15 @@ extension WidgetExtensions on Widget {
: this; : 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( ? Shimmer.fromColors(
baseColor: context.isDark ? AppColor.backgroundDark : const Color(0xffe8eff0), baseColor: context.isDark ? AppColor.backgroundDark : const Color(0xffe8eff0),
highlightColor: AppColor.background(context), highlightColor: AppColor.background(context),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(radius), borderRadius: BorderRadius.circular(radius),
child: Container( child: Container(
width: width,
height: height,
color: AppColor.background(context), color: AppColor.background(context),
child: this, 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/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/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_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/modules/cx_module/survey/survey_page.dart';
import 'package:test_sa/new_views/app_style/app_color.dart'; import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/new_views/common_widgets/default_app_bar.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))); Navigator.push(context, CupertinoPageRoute(builder: (context) => SurveyPage(moduleId: 1, requestId: widget.requestId, surveyId: 5)));
}, },
), ),
IconButton( Selector<ServiceRequestDetailProvider, bool>(
icon: const Icon(Icons.chat_bubble), selector: (_, myModel) => myModel.isLoading, // Selects only the userName
onPressed: () { builder: (_, isLoading, __) {
Navigator.push( if (isLoading) {
context, CupertinoPageRoute(builder: (context) => ChatPage(moduleId: 1, requestId: widget.requestId, title: _requestProvider.currentWorkOrder?.data?.workOrderNo ?? ""))); 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 isNurse
? IconButton( ? IconButton(
icon: 'qr'.toSvgAsset( 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_login_response_model.dart';
import 'model/chat_participant_model.dart'; import 'model/chat_participant_model.dart';
import 'model/get_search_user_chat_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/get_user_login_token_model.dart' as userLoginTokenModel;
import 'model/user_chat_history_model.dart'; 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( Response response = await ApiClient().postJsonForResponse(
"${URLs.chatHubUrlApi}/UserChatHistory/GetUserChatHistory/$myId/$otherId/0", {"moduleCode": moduleId.toString(), "referenceId": referenceId.toString()}, "${URLs.chatHubUrlApi}/UserChatHistory/GetUserChatHistory/$myId/$otherId/0", {"moduleCode": moduleId.toString(), "referenceId": referenceId.toString()},
token: chatLoginResponse!.token); token: chatLoginResponse!.token);
// try { // try {
if (response.statusCode == 200) { if (response.statusCode == 200) {
List data = jsonDecode(response.body); 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)); // return UserChatHistoryModel.fromJson(jsonDecode(response.body));
} else { } else {
@ -92,7 +93,7 @@ class ChatApiClient {
// } // }
} }
Future<ChatResponse?> sendTextMessage(String message, int conversationId) async { /* Future<ChatResponse?> sendTextMessage(String message, int conversationId) async {
try { try {
Response response = Response response =
await ApiClient().postJsonForResponse("${URLs.chatHubUrlApi}/chat/conversations/$conversationId/messages", {"content": message, "messageType": "Text"}, token: chatLoginResponse!.token); await ApiClient().postJsonForResponse("${URLs.chatHubUrlApi}/chat/conversations/$conversationId/messages", {"content": message, "messageType": "Text"}, token: chatLoginResponse!.token);
@ -106,7 +107,7 @@ class ChatApiClient {
print(ex); print(ex);
return null; return null;
} }
} }*/
// Future<ChatUserModel> getChatMemberFromSearch(String searchParam, int cUserId, int pageNo) async { // Future<ChatUserModel> getChatMemberFromSearch(String searchParam, int cUserId, int pageNo) async {
// ChatUserModel chatUserModel; // ChatUserModel chatUserModel;

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

File diff suppressed because it is too large Load Diff

@ -41,10 +41,10 @@ class SingleUserChatModel {
int? userChatHistoryLineId; int? userChatHistoryLineId;
String? contant; String? contant;
String? contantNo; String? contantNo;
int? currentUserId; String? currentUserId;
String? currentUserName; String? currentUserName;
String? currentUserEmail; String? currentUserEmail;
int? targetUserId; String? targetUserId;
String? targetUserName; String? targetUserName;
String? targetUserEmail; String? targetUserEmail;
String? encryptedTargetUserId; String? encryptedTargetUserId;
@ -69,9 +69,9 @@ class SingleUserChatModel {
userChatHistoryLineId: json["userChatHistoryLineId"] == null ? null : json["userChatHistoryLineId"], userChatHistoryLineId: json["userChatHistoryLineId"] == null ? null : json["userChatHistoryLineId"],
contant: json["contant"] == null ? null : json["contant"], contant: json["contant"] == null ? null : json["contant"],
contantNo: json["contantNo"] == null ? null : json["contantNo"], 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"], 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"], targetUserName: json["targetUserName"] == null ? null : json["targetUserName"],
targetUserEmail: json["targetUserEmail"] == null ? null : json["targetUserEmail"], targetUserEmail: json["targetUserEmail"] == null ? null : json["targetUserEmail"],
currentUserEmail: json["currentUserEmail"] == null ? null : json["currentUserEmail"], currentUserEmail: json["currentUserEmail"] == null ? null : json["currentUserEmail"],

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

Loading…
Cancel
Save