|  |  |  | @ -32,6 +32,7 @@ import 'package:mohem_flutter_app/models/chat/get_user_login_token_model.dart' | 
		
	
		
			
				|  |  |  |  |     as userLoginToken; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/models/chat/make_user_favotire_unfavorite_chat_model.dart' | 
		
	
		
			
				|  |  |  |  |     as fav; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/models/chat/target_users.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/models/my_team/get_employee_subordinates_list.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/ui/chat/chat_detailed_screen.dart'; | 
		
	
		
			
				|  |  |  |  | import 'package:mohem_flutter_app/ui/landing/dashboard_screen.dart'; | 
		
	
	
		
			
				
					|  |  |  | @ -89,7 +90,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |   //Chat Home Page Counter | 
		
	
		
			
				|  |  |  |  |   int chatUConvCounter = 0; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   late List<groupchathistory.GetGroupChatHistoryAsync> groupChatHistory; | 
		
	
		
			
				|  |  |  |  |   late List<groupchathistory.GetGroupChatHistoryAsync> groupChatHistory, groupChatReplyData; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   /// Search Provider | 
		
	
		
			
				|  |  |  |  |   List<ChatUser>? chatUsersList = []; | 
		
	
	
		
			
				
					|  |  |  | @ -121,6 +122,10 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnDeliveredChatUserAsync", onMsgReceived); | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnGetChatConversationCount", onNewChatConversion); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     //group On message | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnDeliveredGroupChatHistoryAsync", onGroupMsgReceived); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<HubConnection> getHubConnection() async { | 
		
	
	
		
			
				
					|  |  |  | @ -140,6 +145,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |   void registerEvents() { | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnUpdateUserStatusAsync", changeStatus); | 
		
	
		
			
				|  |  |  |  |     //   chatHubConnection.on("OnDeliveredChatUserAsync", onMsgReceived); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnSubmitChatAsync", OnSubmitChatAsync); | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnUserTypingAsync", onUserTyping); | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnUserCountAsync", userCountAsync); | 
		
	
	
		
			
				
					|  |  |  | @ -148,6 +154,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |         "OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered); | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on( | 
		
	
		
			
				|  |  |  |  |         "OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus); | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on( | 
		
	
		
			
				|  |  |  |  |         "OnGetGroupUserStatusAsync", getGroupUserStatus); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     // | 
		
	
		
			
				|  |  |  |  |     // {"type":1,"target":"","arguments":[[{"id":217869,"userName":"Sultan.Khan","email":"Sultan.Khan@cloudsolutions.com.sa","phone":null,"title":"Sultan.Khan","userStatus":1,"image":null,"unreadMessageCount":0,"userAction":3,"isPin":false,"isFav":false,"isAdmin":false,"rKey":null,"totalCount":0,"isHuaweiDevice":false,"deviceToken":null},{"id":15153,"userName":"Tamer.Fanasheh","email":"Tamer.F@cloudsolutions.com.sa","phone":null,"title":"Tamer Fanasheh","userStatus":2,"image":null,"unreadMessageCount":0,"userAction":3,"isPin":false,"isFav":false,"isAdmin":true,"rKey":null,"totalCount":0,"isHuaweiDevice":false,"deviceToken":null}]]} | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     if (kDebugMode) { | 
		
	
		
			
				|  |  |  |  |       logger.i("All listeners registered"); | 
		
	
	
		
			
				
					|  |  |  | @ -288,6 +299,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |       List<SingleUserChatModel>.from( | 
		
	
		
			
				|  |  |  |  |           json.decode(str).map((x) => SingleUserChatModel.fromJson(x))); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   List<groupchathistory.GetGroupChatHistoryAsync> getGroupChatHistoryAsync(String str) => | 
		
	
		
			
				|  |  |  |  |       List<groupchathistory.GetGroupChatHistoryAsync>.from( | 
		
	
		
			
				|  |  |  |  |           json.decode(str).map((x) => groupchathistory.GetGroupChatHistoryAsync.fromJson(x))); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<dynamic> uploadAttachments(String userId, File file) async { | 
		
	
		
			
				|  |  |  |  |     dynamic result; | 
		
	
		
			
				|  |  |  |  |     try { | 
		
	
	
		
			
				
					|  |  |  | @ -316,6 +332,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     notifyListeners(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void getGroupUserStatus(List<Object?>? args){ | 
		
	
		
			
				|  |  |  |  |   //note: need to implement this function... | 
		
	
		
			
				|  |  |  |  |   print(args); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void onChatSeen(List<Object?>? args) { | 
		
	
		
			
				|  |  |  |  |     dynamic items = args!.toList(); | 
		
	
		
			
				|  |  |  |  |     // for (var user in searchedChats!) { | 
		
	
	
		
			
				
					|  |  |  | @ -495,6 +516,107 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     notifyListeners(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<void> onGroupMsgReceived(List<Object?>? parameters) async { | 
		
	
		
			
				|  |  |  |  |     List<groupchathistory.GetGroupChatHistoryAsync> data = [], temp = []; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     for (dynamic msg in parameters!) { | 
		
	
		
			
				|  |  |  |  |      // groupChatHistory.add(groupchathistory.GetGroupChatHistoryAsync.fromJson(msg)); | 
		
	
		
			
				|  |  |  |  |       data.add(groupchathistory.GetGroupChatHistoryAsync.fromJson(msg)); | 
		
	
		
			
				|  |  |  |  |       temp =data; | 
		
	
		
			
				|  |  |  |  |       // data.first.currentUserId = temp.first.currentUserId; | 
		
	
		
			
				|  |  |  |  |       // data.first.currentUserName = temp.first.currentUserName; | 
		
	
		
			
				|  |  |  |  |       // | 
		
	
		
			
				|  |  |  |  |       // data.first.currentUserId = temp.first.currentUserId; | 
		
	
		
			
				|  |  |  |  |       // data.first.currentUserName = temp.first.currentUserName; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       if (data.first.fileTypeId == 12 || | 
		
	
		
			
				|  |  |  |  |           data.first.fileTypeId == 4 || | 
		
	
		
			
				|  |  |  |  |           data.first.fileTypeId == 3) { | 
		
	
		
			
				|  |  |  |  |         data.first.image = await ChatApiClient().downloadURL( | 
		
	
		
			
				|  |  |  |  |             fileName: data.first.contant!, | 
		
	
		
			
				|  |  |  |  |             fileTypeDescription: | 
		
	
		
			
				|  |  |  |  |             data.first.fileTypeResponse!.fileTypeDescription ?? | 
		
	
		
			
				|  |  |  |  |                 "image/jpg"); | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |       if (data.first.groupChatReplyResponse != null) { | 
		
	
		
			
				|  |  |  |  |         if (data.first.fileTypeResponse != null) { | 
		
	
		
			
				|  |  |  |  |           if (data.first.groupChatReplyResponse!.fileTypeId == 12 || | 
		
	
		
			
				|  |  |  |  |               data.first.groupChatReplyResponse!.fileTypeId == 4 || | 
		
	
		
			
				|  |  |  |  |               data.first.groupChatReplyResponse!.fileTypeId == 3) { | 
		
	
		
			
				|  |  |  |  |             data.first.groupChatReplyResponse!.image = await ChatApiClient() | 
		
	
		
			
				|  |  |  |  |                 .downloadURL( | 
		
	
		
			
				|  |  |  |  |                 fileName: data.first.groupChatReplyResponse!.contant!, | 
		
	
		
			
				|  |  |  |  |                 fileTypeDescription: | 
		
	
		
			
				|  |  |  |  |                 data.first.fileTypeResponse!.fileTypeDescription ?? | 
		
	
		
			
				|  |  |  |  |                     "image/jpg"); | 
		
	
		
			
				|  |  |  |  |             data.first.groupChatReplyResponse!.isImageLoaded = true; | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     // if (searchedChats != null) { | 
		
	
		
			
				|  |  |  |  |     //   dynamic contain = searchedChats! | 
		
	
		
			
				|  |  |  |  |     //       .where((ChatUser element) => element.id == data.first.currentUserId); | 
		
	
		
			
				|  |  |  |  |     //   if (contain.isEmpty) { | 
		
	
		
			
				|  |  |  |  |     //     List<String> emails = []; | 
		
	
		
			
				|  |  |  |  |     //     emails.add(await EmailImageEncryption() | 
		
	
		
			
				|  |  |  |  |     //         .encrypt(val: data.first.currentUserEmail!)); | 
		
	
		
			
				|  |  |  |  |     //     List<ChatUserImageModel> chatImages = | 
		
	
		
			
				|  |  |  |  |     //     await ChatApiClient().getUsersImages(encryptedEmails: emails); | 
		
	
		
			
				|  |  |  |  |     //     searchedChats!.add( | 
		
	
		
			
				|  |  |  |  |     //       ChatUser( | 
		
	
		
			
				|  |  |  |  |     //         id: data.first.currentUserId, | 
		
	
		
			
				|  |  |  |  |     //         userName: data.first.currentUserName, | 
		
	
		
			
				|  |  |  |  |     //         email: data.first.currentUserEmail, | 
		
	
		
			
				|  |  |  |  |     //         unreadMessageCount: 0, | 
		
	
		
			
				|  |  |  |  |     //         isImageLoading: false, | 
		
	
		
			
				|  |  |  |  |     //         image: chatImages!.first.profilePicture ?? "", | 
		
	
		
			
				|  |  |  |  |     //         isImageLoaded: true, | 
		
	
		
			
				|  |  |  |  |     //         userStatus: 1, | 
		
	
		
			
				|  |  |  |  |     //         isTyping: false, | 
		
	
		
			
				|  |  |  |  |     //         userLocalDownlaodedImage: await downloadImageLocal( | 
		
	
		
			
				|  |  |  |  |     //             chatImages.first.profilePicture, | 
		
	
		
			
				|  |  |  |  |     //             data.first.currentUserId.toString()), | 
		
	
		
			
				|  |  |  |  |     //       ), | 
		
	
		
			
				|  |  |  |  |     //     ); | 
		
	
		
			
				|  |  |  |  |     //   } | 
		
	
		
			
				|  |  |  |  |    // } | 
		
	
		
			
				|  |  |  |  |     groupChatHistory.insert(0, data.first); | 
		
	
		
			
				|  |  |  |  |     setMsgTune(); | 
		
	
		
			
				|  |  |  |  |    // if (isChatScreenActive && data.first.currentUserId == receiverID) { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     // } else { | 
		
	
		
			
				|  |  |  |  |     //   if (searchedChats != null) { | 
		
	
		
			
				|  |  |  |  |     //     for (ChatUser user in searchedChats!) { | 
		
	
		
			
				|  |  |  |  |     //       if (user.id == data.first.currentUserId) { | 
		
	
		
			
				|  |  |  |  |     //         int tempCount = user.unreadMessageCount ?? 0; | 
		
	
		
			
				|  |  |  |  |     //         user.unreadMessageCount = tempCount + 1; | 
		
	
		
			
				|  |  |  |  |     //       } | 
		
	
		
			
				|  |  |  |  |     //     } | 
		
	
		
			
				|  |  |  |  |         sort(); | 
		
	
		
			
				|  |  |  |  |       //} | 
		
	
		
			
				|  |  |  |  |     //} | 
		
	
		
			
				|  |  |  |  |     // | 
		
	
		
			
				|  |  |  |  |     // List<Object> list = [ | 
		
	
		
			
				|  |  |  |  |     //   { | 
		
	
		
			
				|  |  |  |  |     //     "userChatHistoryId": data.first.groupId, | 
		
	
		
			
				|  |  |  |  |     //     "TargetUserId": temp.first.currentUserId, | 
		
	
		
			
				|  |  |  |  |     //     "isDelivered": true, | 
		
	
		
			
				|  |  |  |  |     //     "isSeen": isChatScreenActive && data.first.currentUserId == receiverID | 
		
	
		
			
				|  |  |  |  |     //         ? true | 
		
	
		
			
				|  |  |  |  |     //         : false | 
		
	
		
			
				|  |  |  |  |     //   } | 
		
	
		
			
				|  |  |  |  |     // ]; | 
		
	
		
			
				|  |  |  |  |    // updateUserChatHistoryOnMsg(list); | 
		
	
		
			
				|  |  |  |  |    // invokeChatCounter(userId: AppState().chatDetails!.response!.id!); | 
		
	
		
			
				|  |  |  |  |     notifyListeners(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void OnSubmitChatAsync(List<Object?>? parameters) { | 
		
	
		
			
				|  |  |  |  |     print(isChatScreenActive); | 
		
	
		
			
				|  |  |  |  |     print(receiverID); | 
		
	
	
		
			
				
					|  |  |  | @ -711,7 +833,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |       String? userEmail, | 
		
	
		
			
				|  |  |  |  |       int? userStatus, | 
		
	
		
			
				|  |  |  |  |       File? voiceFile, | 
		
	
		
			
				|  |  |  |  |       required bool isVoiceAttached}) async { | 
		
	
		
			
				|  |  |  |  |       required bool isVoiceAttached, | 
		
	
		
			
				|  |  |  |  |       required List<GroupUserList>  userList | 
		
	
		
			
				|  |  |  |  |       }) async { | 
		
	
		
			
				|  |  |  |  |     Uuid uuid = const Uuid(); | 
		
	
		
			
				|  |  |  |  |     String contentNo = uuid.v4(); | 
		
	
		
			
				|  |  |  |  |     String msg; | 
		
	
	
		
			
				
					|  |  |  | @ -736,15 +860,13 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |             groupName: targetUserName, | 
		
	
		
			
				|  |  |  |  |             isReplied: false, | 
		
	
		
			
				|  |  |  |  |             fileTypeId: fileTypeId, | 
		
	
		
			
				|  |  |  |  |             // userChatReplyResponse: isReply ? UserChatReplyResponse.fromJson(repliedMsg.first.toJson()) : null, | 
		
	
		
			
				|  |  |  |  |             // fileTypeResponse: isAttachment | 
		
	
		
			
				|  |  |  |  |             //  ? FileTypeResponse( | 
		
	
		
			
				|  |  |  |  |             // fileTypeId: fileTypeId, | 
		
	
		
			
				|  |  |  |  |             // fileTypeName: isVoiceMsg ? getFileExtension(voiceFile!.path).toString() : getFileExtension(selectedFile.path).toString(), | 
		
	
		
			
				|  |  |  |  |             //  fileKind: "file", | 
		
	
		
			
				|  |  |  |  |             // fileName: isVoiceMsg ? msg : selectedFile.path.split("/").last, | 
		
	
		
			
				|  |  |  |  |             // fileTypeDescription: isVoiceMsg ? getFileTypeDescription(getFileExtension(voiceFile!.path).toString()) : getFileTypeDescription(getFileExtension(selectedFile.path).toString()), | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |             fileTypeResponse: isAttachment | 
		
	
		
			
				|  |  |  |  |              ? groupchathistory.FileTypeResponse( | 
		
	
		
			
				|  |  |  |  |             fileTypeId: fileTypeId, | 
		
	
		
			
				|  |  |  |  |             fileTypeName: isVoiceMsg ? getFileExtension(voiceFile!.path).toString() : getFileExtension(selectedFile.path).toString(), | 
		
	
		
			
				|  |  |  |  |              fileKind: "file", | 
		
	
		
			
				|  |  |  |  |             fileName: isVoiceMsg ? msg : selectedFile.path.split("/").last, | 
		
	
		
			
				|  |  |  |  |             fileTypeDescription: isVoiceMsg ? getFileTypeDescription(getFileExtension(voiceFile!.path).toString()) : getFileTypeDescription(getFileExtension(selectedFile.path).toString())) : null, | 
		
	
		
			
				|  |  |  |  |             image: image, | 
		
	
		
			
				|  |  |  |  |             isImageLoaded: isImageLoaded, | 
		
	
		
			
				|  |  |  |  |             voice: isVoiceMsg ? voiceFile! : null, | 
		
	
	
		
			
				
					|  |  |  | @ -752,7 +874,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     if (kDebugMode) { | 
		
	
		
			
				|  |  |  |  |       logger.i("model data: " + jsonEncode(data)); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     // groupChatHistory.insert(0, data); | 
		
	
		
			
				|  |  |  |  |      groupChatHistory.insert(0, data); | 
		
	
		
			
				|  |  |  |  |     isTextMsg = false; | 
		
	
		
			
				|  |  |  |  |     isReplyMsg = false; | 
		
	
		
			
				|  |  |  |  |     isAttachmentMsg = false; | 
		
	
	
		
			
				
					|  |  |  | @ -761,11 +883,15 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     message.clear(); | 
		
	
		
			
				|  |  |  |  |     notifyListeners(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     String chatData = | 
		
	
		
			
				|  |  |  |  |         '{"contant":"$msg","contantNo":"$contentNo","chatEventId":$chatEventId,"fileTypeId":$fileTypeId,"currentUserId":${AppState().chatDetails!.response!.id},"chatSource":1,"groupId":$targetGroupId,"groupChatHistoryLineRequestList":[{"isSeen":false,"isDelivered":false,"targetUserId":${AppState().chatDetails!.response!.id},"userAction":0,"userStatus":1}],"conversationId":"${uuid.v4()}"}'; | 
		
	
		
			
				|  |  |  |  |     List<TargetUsers> targetUsers =[]; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     for (GroupUserList element in userList) { | 
		
	
		
			
				|  |  |  |  |       targetUsers.add(TargetUsers(isDelivered: false,isSeen: false, targetUserId: element.id, userAction: element.userAction, userStatus: element.userStatus)); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     // String chatData = | 
		
	
		
			
				|  |  |  |  |     //     '{"contant":"$msg","contantNo":"$contentNo","chatEventId":$chatEventId,"fileTypeId": $fileTypeId,"currentUserId":${AppState().chatDetails!.response!.id},"chatSource":1,"userChatHistoryLineRequestList":[{"isSeen":false,"isDelivered":false,"targetUserId":$targetUserId,"targetUserStatus":1}],"chatReplyId":$chatReplyId,"conversationId":"$chatCID"}'; | 
		
	
		
			
				|  |  |  |  |     String chatData = | 
		
	
		
			
				|  |  |  |  |         '{"contant":"$msg","contantNo":"$contentNo","chatEventId":$chatEventId,"fileTypeId":$fileTypeId,"currentUserId":${AppState().chatDetails!.response!.id},"chatSource":1,"groupId":$targetGroupId,"groupChatHistoryLineRequestList":${json.encode(targetUsers)},"chatReplyId": $chatReplyId,"conversationId":"${uuid.v4()}"}'; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     await chatHubConnection.invoke("AddGroupChatHistoryAsync", | 
		
	
		
			
				|  |  |  |  |         args: <Object>[json.decode(chatData)]); | 
		
	
	
		
			
				
					|  |  |  | @ -775,7 +901,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |       {required int targetUserId, | 
		
	
		
			
				|  |  |  |  |       required int userStatus, | 
		
	
		
			
				|  |  |  |  |       required String userEmail, | 
		
	
		
			
				|  |  |  |  |       required String targetUserName}) async { | 
		
	
		
			
				|  |  |  |  |       required String targetUserName, | 
		
	
		
			
				|  |  |  |  |         required List<GroupUserList> userList, | 
		
	
		
			
				|  |  |  |  |       }) async { | 
		
	
		
			
				|  |  |  |  |     if (isTextMsg && !isAttachmentMsg && !isVoiceMsg && !isReplyMsg) { | 
		
	
		
			
				|  |  |  |  |       logger.d("// Normal Text Message"); | 
		
	
		
			
				|  |  |  |  |       if (message.text.isEmpty) { | 
		
	
	
		
			
				
					|  |  |  | @ -793,7 +921,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |           image: null, | 
		
	
		
			
				|  |  |  |  |           isVoiceAttached: false, | 
		
	
		
			
				|  |  |  |  |           userEmail: userEmail, | 
		
	
		
			
				|  |  |  |  |           userStatus: userStatus); | 
		
	
		
			
				|  |  |  |  |           userStatus: userStatus, | 
		
	
		
			
				|  |  |  |  |           userList:userList | 
		
	
		
			
				|  |  |  |  |       ); | 
		
	
		
			
				|  |  |  |  |     } else if (isTextMsg && !isAttachmentMsg && !isVoiceMsg && isReplyMsg) { | 
		
	
		
			
				|  |  |  |  |       logger.d("// Text Message as Reply"); | 
		
	
		
			
				|  |  |  |  |       if (message.text.isEmpty) { | 
		
	
	
		
			
				
					|  |  |  | @ -804,15 +934,17 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |           fileTypeId: null, | 
		
	
		
			
				|  |  |  |  |           targetGroupId: targetUserId, | 
		
	
		
			
				|  |  |  |  |           targetUserName: targetUserName, | 
		
	
		
			
				|  |  |  |  |           chatReplyId: repliedMsg.first.userChatHistoryId, | 
		
	
		
			
				|  |  |  |  |           chatReplyId: groupChatReplyData.first.groupChatHistoryId, | 
		
	
		
			
				|  |  |  |  |           isAttachment: false, | 
		
	
		
			
				|  |  |  |  |           isReply: true, | 
		
	
		
			
				|  |  |  |  |           isImageLoaded: repliedMsg.first.isImageLoaded!, | 
		
	
		
			
				|  |  |  |  |           image: repliedMsg.first.image, | 
		
	
		
			
				|  |  |  |  |           isImageLoaded: groupChatReplyData.first.isImageLoaded!, | 
		
	
		
			
				|  |  |  |  |           image: groupChatReplyData.first.image, | 
		
	
		
			
				|  |  |  |  |           isVoiceAttached: false, | 
		
	
		
			
				|  |  |  |  |           voiceFile: null, | 
		
	
		
			
				|  |  |  |  |           userEmail: userEmail, | 
		
	
		
			
				|  |  |  |  |           userStatus: userStatus); | 
		
	
		
			
				|  |  |  |  |           userStatus: userStatus, | 
		
	
		
			
				|  |  |  |  |           userList:userList | 
		
	
		
			
				|  |  |  |  |       ); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     //  Attachment | 
		
	
		
			
				|  |  |  |  |     else if (!isTextMsg && isAttachmentMsg && !isVoiceMsg && !isReplyMsg) { | 
		
	
	
		
			
				
					|  |  |  | @ -820,12 +952,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |       Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments( | 
		
	
		
			
				|  |  |  |  |           AppState().chatDetails!.response!.id.toString(), selectedFile); | 
		
	
		
			
				|  |  |  |  |       // String? ext = getFileExtension(selectedFile.path); | 
		
	
		
			
				|  |  |  |  |       String? ext = getFileExtension(selectedFile.path); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       sendGroupChatToServer( | 
		
	
		
			
				|  |  |  |  |           chatEventId: 2, | 
		
	
		
			
				|  |  |  |  |           fileTypeId: "jpg", | 
		
	
		
			
				|  |  |  |  |           //getFileType(ext.toString()), | 
		
	
		
			
				|  |  |  |  |           fileTypeId: getFileType(ext.toString()), | 
		
	
		
			
				|  |  |  |  |           targetGroupId: targetUserId, | 
		
	
		
			
				|  |  |  |  |           targetUserName: targetUserName, | 
		
	
		
			
				|  |  |  |  |           isAttachment: true, | 
		
	
	
		
			
				
					|  |  |  | @ -835,18 +966,20 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |           image: selectedFile.readAsBytesSync(), | 
		
	
		
			
				|  |  |  |  |           isVoiceAttached: false, | 
		
	
		
			
				|  |  |  |  |           userEmail: userEmail, | 
		
	
		
			
				|  |  |  |  |           userStatus: userStatus); | 
		
	
		
			
				|  |  |  |  |           userStatus: userStatus, | 
		
	
		
			
				|  |  |  |  |           userList:userList | 
		
	
		
			
				|  |  |  |  |       ); | 
		
	
		
			
				|  |  |  |  |     } else if (!isTextMsg && isAttachmentMsg && !isVoiceMsg && isReplyMsg) { | 
		
	
		
			
				|  |  |  |  |       logger.d("// Image as Reply Msg"); | 
		
	
		
			
				|  |  |  |  |       Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments( | 
		
	
		
			
				|  |  |  |  |           AppState().chatDetails!.response!.id.toString(), selectedFile); | 
		
	
		
			
				|  |  |  |  |       // String? ext = getFileExtension(selectedFile.path); | 
		
	
		
			
				|  |  |  |  |       String? ext = getFileExtension(selectedFile.path); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       sendGroupChatToServer( | 
		
	
		
			
				|  |  |  |  |           chatEventId: 2, | 
		
	
		
			
				|  |  |  |  |           fileTypeId: "jpg", | 
		
	
		
			
				|  |  |  |  |           //getFileType(ext.toString()), | 
		
	
		
			
				|  |  |  |  |           fileTypeId: getFileType(ext.toString()), | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |           targetGroupId: targetUserId, | 
		
	
		
			
				|  |  |  |  |           targetUserName: targetUserName, | 
		
	
		
			
				|  |  |  |  |           isAttachment: true, | 
		
	
	
		
			
				
					|  |  |  | @ -856,7 +989,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |           image: selectedFile.readAsBytesSync(), | 
		
	
		
			
				|  |  |  |  |           isVoiceAttached: false, | 
		
	
		
			
				|  |  |  |  |           userEmail: userEmail, | 
		
	
		
			
				|  |  |  |  |           userStatus: userStatus); | 
		
	
		
			
				|  |  |  |  |           userStatus: userStatus, | 
		
	
		
			
				|  |  |  |  |           userList:userList | 
		
	
		
			
				|  |  |  |  |       ); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     //Voice | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -878,12 +1013,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |       Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments( | 
		
	
		
			
				|  |  |  |  |           AppState().chatDetails!.response!.id.toString(), voiceFile); | 
		
	
		
			
				|  |  |  |  |       // String? ext = getFileExtension(voiceFile.path); | 
		
	
		
			
				|  |  |  |  |        String? ext = getFileExtension(voiceFile.path); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       sendGroupChatToServer( | 
		
	
		
			
				|  |  |  |  |           chatEventId: 2, | 
		
	
		
			
				|  |  |  |  |           fileTypeId: "jpg", | 
		
	
		
			
				|  |  |  |  |           //getFileType(ext.toString()), | 
		
	
		
			
				|  |  |  |  |           fileTypeId: getFileType(ext.toString()), | 
		
	
		
			
				|  |  |  |  |           //, | 
		
	
		
			
				|  |  |  |  |           targetGroupId: targetUserId, | 
		
	
		
			
				|  |  |  |  |           targetUserName: targetUserName, | 
		
	
		
			
				|  |  |  |  |           chatReplyId: null, | 
		
	
	
		
			
				
					|  |  |  | @ -893,7 +1028,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |           voiceFile: voiceFile, | 
		
	
		
			
				|  |  |  |  |           isVoiceAttached: true, | 
		
	
		
			
				|  |  |  |  |           userEmail: userEmail, | 
		
	
		
			
				|  |  |  |  |           userStatus: userStatus); | 
		
	
		
			
				|  |  |  |  |           userStatus: userStatus, | 
		
	
		
			
				|  |  |  |  |           userList:userList | 
		
	
		
			
				|  |  |  |  |       ); | 
		
	
		
			
				|  |  |  |  |       notifyListeners(); | 
		
	
		
			
				|  |  |  |  |     } else if (!isTextMsg && !isAttachmentMsg && isVoiceMsg && isReplyMsg) { | 
		
	
		
			
				|  |  |  |  |       logger.d("// Voice as Reply Msg"); | 
		
	
	
		
			
				
					|  |  |  | @ -914,12 +1051,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |       Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments( | 
		
	
		
			
				|  |  |  |  |           AppState().chatDetails!.response!.id.toString(), voiceFile); | 
		
	
		
			
				|  |  |  |  |       // String? ext = getFileExtension(voiceFile.path); | 
		
	
		
			
				|  |  |  |  |        String? ext = getFileExtension(voiceFile.path); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       sendGroupChatToServer( | 
		
	
		
			
				|  |  |  |  |           chatEventId: 2, | 
		
	
		
			
				|  |  |  |  |           fileTypeId: "jpg", | 
		
	
		
			
				|  |  |  |  |           //getFileType(ext.toString()), | 
		
	
		
			
				|  |  |  |  |           fileTypeId: getFileType(ext.toString()), | 
		
	
		
			
				|  |  |  |  |           targetGroupId: targetUserId, | 
		
	
		
			
				|  |  |  |  |           targetUserName: targetUserName, | 
		
	
		
			
				|  |  |  |  |           chatReplyId: null, | 
		
	
	
		
			
				
					|  |  |  | @ -929,7 +1065,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |           voiceFile: voiceFile, | 
		
	
		
			
				|  |  |  |  |           isVoiceAttached: true, | 
		
	
		
			
				|  |  |  |  |           userEmail: userEmail, | 
		
	
		
			
				|  |  |  |  |           userStatus: userStatus); | 
		
	
		
			
				|  |  |  |  |           userStatus: userStatus, | 
		
	
		
			
				|  |  |  |  |           userList:userList | 
		
	
		
			
				|  |  |  |  |       ); | 
		
	
		
			
				|  |  |  |  |       notifyListeners(); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     if (searchedChats != null) { | 
		
	
	
		
			
				
					|  |  |  | @ -964,7 +1102,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |       {required int targetUserId, | 
		
	
		
			
				|  |  |  |  |       required int userStatus, | 
		
	
		
			
				|  |  |  |  |       required String userEmail, | 
		
	
		
			
				|  |  |  |  |       required String targetUserName}) async { | 
		
	
		
			
				|  |  |  |  |       required String targetUserName, | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       }) async { | 
		
	
		
			
				|  |  |  |  |     if (kDebugMode) { | 
		
	
		
			
				|  |  |  |  |       print("====================== Values ============================"); | 
		
	
		
			
				|  |  |  |  |       print("Is Text " + isTextMsg.toString()); | 
		
	
	
		
			
				
					|  |  |  | @ -1266,7 +1406,13 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     repliedMsg.add(data); | 
		
	
		
			
				|  |  |  |  |     notifyListeners(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void groupChatReply(groupchathistory.GetGroupChatHistoryAsync data) { | 
		
	
		
			
				|  |  |  |  |     groupChatReplyData = []; | 
		
	
		
			
				|  |  |  |  |     data.isReplied = true; | 
		
	
		
			
				|  |  |  |  |     isReplyMsg = true; | 
		
	
		
			
				|  |  |  |  |     groupChatReplyData.add(data); | 
		
	
		
			
				|  |  |  |  |     notifyListeners(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  |   void closeMe() { | 
		
	
		
			
				|  |  |  |  |     repliedMsg = []; | 
		
	
		
			
				|  |  |  |  |     isReplyMsg = false; | 
		
	
	
		
			
				
					|  |  |  | @ -1551,6 +1697,13 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     await chatHubConnection | 
		
	
		
			
				|  |  |  |  |         .invoke("UserTypingAsync", args: [reciptUser, currentUser]); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  |   void groupTypingInvoke( | 
		
	
		
			
				|  |  |  |  |       {required GroupResponse groupDetails, required int groupId}) async { | 
		
	
		
			
				|  |  |  |  |     var data = json.decode(json.encode(groupDetails.groupUserList)); | 
		
	
		
			
				|  |  |  |  |     await chatHubConnection | 
		
	
		
			
				|  |  |  |  |         .invoke("GroupTypingAsync", args: ["${groupDetails.adminUser!.userName}",data, groupId ]); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | //////// Audio Recoding Work //////////////////// | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | 
 |