diff --git a/lib/provider/chat_provider_model.dart b/lib/provider/chat_provider_model.dart index 535dc2e..fd908a1 100644 --- a/lib/provider/chat_provider_model.dart +++ b/lib/provider/chat_provider_model.dart @@ -38,10 +38,10 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { void registerEvents() { hubConnection.on("OnUpdateUserStatusAsync", changeStatus); hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived); - hubConnection.on("OnSeenChatUserAsync", onChatSeen); + // hubConnection.on("OnSeenChatUserAsync", onChatSeen); //hubConnection.on("OnUserTypingAsync", onUserTyping); hubConnection.on("OnUserCountAsync", userCountAsync); - hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow); + // hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow); hubConnection.on("OnGetUserChatHistoryNotDeliveredAsync", chatNotDelivered); hubConnection.on("OnUpdateUserChatHistoryStatusAsync", updateUserChatStatus); } @@ -108,7 +108,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } isLoading = false; notifyListeners(); - // markRead(userChatHistory, receiverUID); + markRead(userChatHistory, receiverUID); generateConvId(); } @@ -124,7 +124,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { if (!element.isSeen!) { element.isSeen = true; dynamic data = [ - {"userChatHistoryId": element.userChatHistoryId, "TargetUserId": element.currentUserId, "isDelivered": true, "isSeen": true} + { + "userChatHistoryId": element.userChatHistoryId, + "TargetUserId": element.currentUserId == receiverID ? element.currentUserId : element.targetUserId, + "isDelivered": true, + "isSeen": true, + } ]; updateUserChatHistoryStatusAsync(data); notifyListeners(); @@ -190,8 +195,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { void onChatSeen(List? args) { dynamic items = args!.toList(); - logger.d("---------------------------------Chat Seen -------------------------------------"); - logger.d(items); // for (var user in searchedChats!) { // if (user.id == items.first["id"]) { // user.userStatus = items.first["userStatus"]; diff --git a/lib/ui/chat/chat_home_screen.dart b/lib/ui/chat/chat_home_screen.dart index 5ccc6ad..73c084a 100644 --- a/lib/ui/chat/chat_home_screen.dart +++ b/lib/ui/chat/chat_home_screen.dart @@ -84,6 +84,7 @@ class _ChatHomeScreenState extends State { itemCount: m.searchedChats!.length, shrinkWrap: true, physics: const ClampingScrollPhysics(), + padding: EdgeInsets.only(bottom: 80.0), itemBuilder: (BuildContext context, int index) { return SizedBox( height: 55, @@ -189,14 +190,13 @@ class _ChatHomeScreenState extends State { AppRoutes.chatDetailed, arguments: {"targetUser": m.searchedChats![index], "isNewChat": false}, ).then((Object? value) { - // m.GetUserChatHistoryNotDeliveredAsync(userId: int.parse(AppState().chatDetails!.response!.id.toString())); m.clearSelections(); m.notifyListeners(); }); }); }, separatorBuilder: (BuildContext context, int index) => const Divider(color: MyColors.lightGreyE5Color).paddingOnly(left: 59), - ).paddingOnly(bottom: 70).expanded, + ).expanded, ], ).paddingOnly(left: 21, right: 21); },