|  |  |  | @ -86,15 +86,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |   /// Search Provider | 
		
	
		
			
				|  |  |  |  |   List<ChatUser>? chatUsersList = []; | 
		
	
		
			
				|  |  |  |  |   int pageNo = 1; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   bool disbaleChatForThisUser = false; | 
		
	
		
			
				|  |  |  |  |   List<groups.GroupResponse>? uGroups = [], searchGroups = []; | 
		
	
		
			
				|  |  |  |  |   bool disbaleChatForThisUser = false; | 
		
	
		
			
				|  |  |  |  |   bool disableChatForThisUser = false; | 
		
	
		
			
				|  |  |  |  |   bool isUserOnline = false; | 
		
	
		
			
				|  |  |  |  |   bool isCall = false; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   userLoginToken.UserAutoLoginModel userLoginData = userLoginToken.UserAutoLoginModel(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<void> getUserAutoLoginToken() async { | 
		
	
		
			
				|  |  |  |  |     try { | 
		
	
		
			
				|  |  |  |  |       userLoginToken.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken(); | 
		
	
	
		
			
				
					|  |  |  | @ -111,7 +108,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |         Utils.showToast( | 
		
	
		
			
				|  |  |  |  |           userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr", | 
		
	
		
			
				|  |  |  |  |         ); | 
		
	
		
			
				|  |  |  |  |         disableChatForThisUser = true; | 
		
	
		
			
				|  |  |  |  |         disableChatForThisUser = false; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         isUserOnline = false; | 
		
	
		
			
				|  |  |  |  |         if (Platform.isIOS) { | 
		
	
		
			
				|  |  |  |  |           AppState().setisUserOnline = false; | 
		
	
	
		
			
				
					|  |  |  | @ -140,11 +139,11 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnDeliveredChatUserAsync", onMsgReceived); | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnGetChatConversationCount", onNewChatConversion); | 
		
	
		
			
				|  |  |  |  |     ccProvider.initCallListeners(context: context); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     //group On message | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnDeliveredGroupChatHistoryAsync", onGroupMsgReceived); | 
		
	
		
			
				|  |  |  |  |     ccProvider.initCallListeners(context: context); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<HubConnection> getHubConnection() async { | 
		
	
	
		
			
				
					|  |  |  | @ -164,10 +163,14 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnUserTypingAsync", onUserTyping); | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnUserCountAsync", userCountAsync); | 
		
	
		
			
				|  |  |  |  |     //  chatHubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow); | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered); | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus); | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on("OnGetGroupUserStatusAsync", getGroupUserStatus); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on( | 
		
	
		
			
				|  |  |  |  |         "OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered); | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on( | 
		
	
		
			
				|  |  |  |  |         "OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus); | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on( | 
		
	
		
			
				|  |  |  |  |         "OnGetGroupUserStatusAsync", getGroupUserStatus); | 
		
	
		
			
				|  |  |  |  |     chatHubConnection.on( | 
		
	
		
			
				|  |  |  |  |         "OnAddGroupChatHistoryAsync", groupChatHistoryAsync); | 
		
	
		
			
				|  |  |  |  |     // | 
		
	
		
			
				|  |  |  |  |     // {"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}]]} | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -179,7 +182,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |   Future<void> getUserRecentChats() async { | 
		
	
		
			
				|  |  |  |  |     ChatUserModel recentChat = await ChatApiClient().getRecentChats(); | 
		
	
		
			
				|  |  |  |  |     ChatUserModel favUList = await ChatApiClient().getFavUsers(); | 
		
	
		
			
				|  |  |  |  |     // userGroups = await ChatApiClient().getGroupsByUserId(); | 
		
	
		
			
				|  |  |  |  |      userGroups = await ChatApiClient().getGroupsByUserId(); | 
		
	
		
			
				|  |  |  |  |     if (favUList.response != null && recentChat.response != null) { | 
		
	
		
			
				|  |  |  |  |       favUsersList = favUList.response!; | 
		
	
		
			
				|  |  |  |  |       favUsersList.sort((ChatUser a, ChatUser b) => a.userName!.toLowerCase().compareTo(b.userName!.toLowerCase())); | 
		
	
	
		
			
				
					|  |  |  | @ -293,10 +296,10 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |   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 { | 
		
	
		
			
				|  |  |  |  |   Future<dynamic> uploadAttachments(String userId, File file, String fileSource) async { | 
		
	
		
			
				|  |  |  |  |     dynamic result; | 
		
	
		
			
				|  |  |  |  |     try { | 
		
	
		
			
				|  |  |  |  |       Object? response = await ChatApiClient().uploadMedia(userId, file); | 
		
	
		
			
				|  |  |  |  |       Object? response = await ChatApiClient().uploadMedia(userId, file, fileSource); | 
		
	
		
			
				|  |  |  |  |       if (response != null) { | 
		
	
		
			
				|  |  |  |  |         result = response; | 
		
	
		
			
				|  |  |  |  |       } else { | 
		
	
	
		
			
				
					|  |  |  | @ -321,8 +324,13 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     notifyListeners(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   void getGroupUserStatus(List<Object?>? args) { | 
		
	
		
			
				|  |  |  |  |     //note: need to implement this function... | 
		
	
		
			
				|  |  |  |  |   void getGroupUserStatus(List<Object?>? args){ | 
		
	
		
			
				|  |  |  |  |   //note: need to implement this function when group user status | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   print(args); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  |   void groupChatHistoryAsync(List<Object?>? args){ | 
		
	
		
			
				|  |  |  |  |     //need to imlement this event when any group details updated. | 
		
	
		
			
				|  |  |  |  |     print(args); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -421,15 +429,22 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |       data.first.currentUserId = temp.first.targetUserId; | 
		
	
		
			
				|  |  |  |  |       data.first.currentUserName = temp.first.targetUserName; | 
		
	
		
			
				|  |  |  |  |       data.first.currentUserEmail = temp.first.targetUserEmail; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       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"); | 
		
	
		
			
				|  |  |  |  |         data.first.image = await ChatApiClient().downloadURL(fileName: data.first.contant!, fileTypeDescription: data.first.fileTypeResponse!.fileTypeDescription ?? "image/jpg",fileSource: 1); | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |       if (data.first.userChatReplyResponse != null) { | 
		
	
		
			
				|  |  |  |  |         if (data.first.fileTypeResponse != null) { | 
		
	
		
			
				|  |  |  |  |           if (data.first.userChatReplyResponse!.fileTypeId == 12 || data.first.userChatReplyResponse!.fileTypeId == 4 || data.first.userChatReplyResponse!.fileTypeId == 3) { | 
		
	
		
			
				|  |  |  |  |             data.first.userChatReplyResponse!.image = | 
		
	
		
			
				|  |  |  |  |                 await ChatApiClient().downloadURL(fileName: data.first.userChatReplyResponse!.contant!, fileTypeDescription: data.first.fileTypeResponse!.fileTypeDescription ?? "image/jpg"); | 
		
	
		
			
				|  |  |  |  |           if (data.first.userChatReplyResponse!.fileTypeId == 12 || | 
		
	
		
			
				|  |  |  |  |               data.first.userChatReplyResponse!.fileTypeId == 4 || | 
		
	
		
			
				|  |  |  |  |               data.first.userChatReplyResponse!.fileTypeId == 3) { | 
		
	
		
			
				|  |  |  |  |             data.first.userChatReplyResponse!.image = await ChatApiClient() | 
		
	
		
			
				|  |  |  |  |                 .downloadURL( | 
		
	
		
			
				|  |  |  |  |                     fileName: data.first.userChatReplyResponse!.contant!, | 
		
	
		
			
				|  |  |  |  |                     fileTypeDescription: | 
		
	
		
			
				|  |  |  |  |                         data.first.fileTypeResponse!.fileTypeDescription ?? | 
		
	
		
			
				|  |  |  |  |                             "image/jpg", | 
		
	
		
			
				|  |  |  |  |                 fileSource:1 | 
		
	
		
			
				|  |  |  |  |             ); | 
		
	
		
			
				|  |  |  |  |             data.first.userChatReplyResponse!.isImageLoaded = true; | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
	
		
			
				
					|  |  |  | @ -501,14 +516,30 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |       // 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.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", | 
		
	
		
			
				|  |  |  |  |             fileSource:2 | 
		
	
		
			
				|  |  |  |  |         ); | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |       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"); | 
		
	
		
			
				|  |  |  |  |           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", | 
		
	
		
			
				|  |  |  |  |                 fileSource:2); | 
		
	
		
			
				|  |  |  |  |             data.first.groupChatReplyResponse!.isImageLoaded = true; | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
	
		
			
				
					|  |  |  | @ -587,8 +618,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |     if (isChatScreenActive && data.first.currentUserId == receiverID) { | 
		
	
		
			
				|  |  |  |  |       int index = userChatHistory.indexWhere((SingleUserChatModel element) => element.userChatHistoryId == 0); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       logger.d(index); | 
		
	
		
			
				|  |  |  |  |       userChatHistory[index] = data.first; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -649,6 +678,14 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |         return 13; | 
		
	
		
			
				|  |  |  |  |       case ".mp3": | 
		
	
		
			
				|  |  |  |  |         return 14; | 
		
	
		
			
				|  |  |  |  |       case ".mp4": | 
		
	
		
			
				|  |  |  |  |         return 16; | 
		
	
		
			
				|  |  |  |  |       case ".mov": | 
		
	
		
			
				|  |  |  |  |         return 16; | 
		
	
		
			
				|  |  |  |  |       case ".avi": | 
		
	
		
			
				|  |  |  |  |         return 16; | 
		
	
		
			
				|  |  |  |  |       case ".flv": | 
		
	
		
			
				|  |  |  |  |         return 16; | 
		
	
		
			
				|  |  |  |  |       default: | 
		
	
		
			
				|  |  |  |  |         return 0; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
	
		
			
				
					|  |  |  | @ -686,6 +723,14 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |         return "audio/aac"; | 
		
	
		
			
				|  |  |  |  |       case ".mp3": | 
		
	
		
			
				|  |  |  |  |         return "audio/mp3"; | 
		
	
		
			
				|  |  |  |  |       case ".mp4": | 
		
	
		
			
				|  |  |  |  |         return "video/mp4"; | 
		
	
		
			
				|  |  |  |  |       case ".avi": | 
		
	
		
			
				|  |  |  |  |         return "video/avi"; | 
		
	
		
			
				|  |  |  |  |       case ".flv": | 
		
	
		
			
				|  |  |  |  |         return "video/flv"; | 
		
	
		
			
				|  |  |  |  |       case ".mov": | 
		
	
		
			
				|  |  |  |  |         return "video/mov"; | 
		
	
		
			
				|  |  |  |  |       default: | 
		
	
		
			
				|  |  |  |  |         return ""; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
	
		
			
				
					|  |  |  | @ -814,7 +859,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; | 
		
	
	
		
			
				
					|  |  |  | @ -887,7 +932,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     else if (!isTextMsg && isAttachmentMsg && !isVoiceMsg && !isReplyMsg) { | 
		
	
		
			
				|  |  |  |  |       logger.d("// Normal Image Message"); | 
		
	
		
			
				|  |  |  |  |       Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments(AppState().chatDetails!.response!.id.toString(), selectedFile); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments( | 
		
	
		
			
				|  |  |  |  |           AppState().chatDetails!.response!.id.toString(), selectedFile,'2'); | 
		
	
		
			
				|  |  |  |  |       String? ext = getFileExtension(selectedFile.path); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       sendGroupChatToServer( | 
		
	
	
		
			
				
					|  |  |  | @ -907,7 +953,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     } 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); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments( | 
		
	
		
			
				|  |  |  |  |           AppState().chatDetails!.response!.id.toString(), selectedFile,'2'); | 
		
	
		
			
				|  |  |  |  |       String? ext = getFileExtension(selectedFile.path); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       sendGroupChatToServer( | 
		
	
	
		
			
				
					|  |  |  | @ -943,8 +990,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |       isPlaying = false; | 
		
	
		
			
				|  |  |  |  |       isRecoding = false; | 
		
	
		
			
				|  |  |  |  |       Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments(AppState().chatDetails!.response!.id.toString(), voiceFile); | 
		
	
		
			
				|  |  |  |  |       String? ext = getFileExtension(voiceFile.path); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments( | 
		
	
		
			
				|  |  |  |  |           AppState().chatDetails!.response!.id.toString(), voiceFile,'2'); | 
		
	
		
			
				|  |  |  |  |        String? ext = getFileExtension(voiceFile.path); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       sendGroupChatToServer( | 
		
	
		
			
				|  |  |  |  |           chatEventId: 2, | 
		
	
	
		
			
				
					|  |  |  | @ -979,8 +1027,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |       isRecoding = false; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments(AppState().chatDetails!.response!.id.toString(), voiceFile); | 
		
	
		
			
				|  |  |  |  |       String? ext = getFileExtension(voiceFile.path); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments( | 
		
	
		
			
				|  |  |  |  |           AppState().chatDetails!.response!.id.toString(), voiceFile,'2'); | 
		
	
		
			
				|  |  |  |  |        String? ext = getFileExtension(voiceFile.path); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       sendGroupChatToServer( | 
		
	
		
			
				|  |  |  |  |           chatEventId: 2, | 
		
	
	
		
			
				
					|  |  |  | @ -1081,7 +1130,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     else if (!isTextMsg && isAttachmentMsg && !isVoiceMsg && !isReplyMsg) { | 
		
	
		
			
				|  |  |  |  |       logger.d("// Normal Image Message"); | 
		
	
		
			
				|  |  |  |  |       Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments(AppState().chatDetails!.response!.id.toString(), selectedFile); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments( | 
		
	
		
			
				|  |  |  |  |           AppState().chatDetails!.response!.id.toString(), selectedFile,'1'); | 
		
	
		
			
				|  |  |  |  |       String? ext = getFileExtension(selectedFile.path); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       sendChatToServer( | 
		
	
	
		
			
				
					|  |  |  | @ -1100,7 +1150,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     } 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); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments( | 
		
	
		
			
				|  |  |  |  |           AppState().chatDetails!.response!.id.toString(), selectedFile,'1'); | 
		
	
		
			
				|  |  |  |  |       String? ext = getFileExtension(selectedFile.path); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       sendChatToServer( | 
		
	
	
		
			
				
					|  |  |  | @ -1135,7 +1186,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |       isPlaying = false; | 
		
	
		
			
				|  |  |  |  |       isRecoding = false; | 
		
	
		
			
				|  |  |  |  |       Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments(AppState().chatDetails!.response!.id.toString(), voiceFile); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments( | 
		
	
		
			
				|  |  |  |  |           AppState().chatDetails!.response!.id.toString(), voiceFile, '1'); | 
		
	
		
			
				|  |  |  |  |       String? ext = getFileExtension(voiceFile.path); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       sendChatToServer( | 
		
	
	
		
			
				
					|  |  |  | @ -1169,7 +1221,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |       isRecoding = false; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments(AppState().chatDetails!.response!.id.toString(), voiceFile); | 
		
	
		
			
				|  |  |  |  |       dynamic value = await uploadAttachments( | 
		
	
		
			
				|  |  |  |  |           AppState().chatDetails!.response!.id.toString(), voiceFile, '1'); | 
		
	
		
			
				|  |  |  |  |       String? ext = getFileExtension(voiceFile.path); | 
		
	
		
			
				|  |  |  |  |       Utils.hideLoading(context); | 
		
	
		
			
				|  |  |  |  |       sendChatToServer( | 
		
	
	
		
			
				
					|  |  |  | @ -1271,8 +1324,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |   bool checkFileSize(String path) { | 
		
	
		
			
				|  |  |  |  |     int fileSizeLimit = 1024; | 
		
	
		
			
				|  |  |  |  |     File f = File(path); | 
		
	
		
			
				|  |  |  |  |     double fileSizeInKB = f.lengthSync() / 1024; | 
		
	
		
			
				|  |  |  |  |     double fileSizeInMB = fileSizeInKB / 1024; | 
		
	
		
			
				|  |  |  |  |     double fileSizeInKB = f.lengthSync() / 5000; | 
		
	
		
			
				|  |  |  |  |     double fileSizeInMB = fileSizeInKB / 5000; | 
		
	
		
			
				|  |  |  |  |     if (fileSizeInKB > fileSizeLimit) { | 
		
	
		
			
				|  |  |  |  |       return false; | 
		
	
		
			
				|  |  |  |  |     } else { | 
		
	
	
		
			
				
					|  |  |  | @ -1453,6 +1506,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |       pChatHistory?.clear(); | 
		
	
		
			
				|  |  |  |  |       uGroups?.clear(); | 
		
	
		
			
				|  |  |  |  |       searchGroup?.clear(); | 
		
	
		
			
				|  |  |  |  |       //  callP.stopListeners(); | 
		
	
		
			
				|  |  |  |  |       chatHubConnection.stop(); | 
		
	
		
			
				|  |  |  |  |       AppState().chatDetails = null; | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
	
		
			
				
					|  |  |  | @ -1564,10 +1618,23 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<void> getChatMedia(BuildContext context, {required String fileName, required String fileTypeName, required int fileTypeID}) async { | 
		
	
		
			
				|  |  |  |  |   Future<void> getChatMedia(BuildContext context, | 
		
	
		
			
				|  |  |  |  |       {required String fileName, | 
		
	
		
			
				|  |  |  |  |       required String fileTypeName, | 
		
	
		
			
				|  |  |  |  |       required int fileTypeID, | 
		
	
		
			
				|  |  |  |  |       required int  fileSource}) async { | 
		
	
		
			
				|  |  |  |  |     Utils.showLoading(context); | 
		
	
		
			
				|  |  |  |  |     if (fileTypeID == 1 || fileTypeID == 5 || fileTypeID == 7 || fileTypeID == 6 || fileTypeID == 8 || fileTypeID == 2) { | 
		
	
		
			
				|  |  |  |  |       Uint8List encodedString = await ChatApiClient().downloadURL(fileName: fileName, fileTypeDescription: getFileTypeDescription(fileTypeName)); | 
		
	
		
			
				|  |  |  |  |     if (fileTypeID == 1 || | 
		
	
		
			
				|  |  |  |  |         fileTypeID == 5 || | 
		
	
		
			
				|  |  |  |  |         fileTypeID == 7 || | 
		
	
		
			
				|  |  |  |  |         fileTypeID == 6 || | 
		
	
		
			
				|  |  |  |  |         fileTypeID == 8 || | 
		
	
		
			
				|  |  |  |  |         fileTypeID == 2 || fileTypeID ==16) { | 
		
	
		
			
				|  |  |  |  |       Uint8List encodedString = await ChatApiClient().downloadURL( | 
		
	
		
			
				|  |  |  |  |           fileName: fileName, | 
		
	
		
			
				|  |  |  |  |           fileTypeDescription: getFileTypeDescription(fileTypeName), | 
		
	
		
			
				|  |  |  |  |           fileSource: fileSource | 
		
	
		
			
				|  |  |  |  |       ); | 
		
	
		
			
				|  |  |  |  |       try { | 
		
	
		
			
				|  |  |  |  |         String path = await downChatMedia(encodedString, fileTypeName ?? ""); | 
		
	
		
			
				|  |  |  |  |         Utils.hideLoading(context); | 
		
	
	
		
			
				
					|  |  |  | 
 |