diff --git a/lib/provider/chat_provider_model.dart b/lib/provider/chat_provider_model.dart index 886951c..b48d845 100644 --- a/lib/provider/chat_provider_model.dart +++ b/lib/provider/chat_provider_model.dart @@ -36,7 +36,7 @@ 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); @@ -119,12 +119,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { for (SingleUserChatModel element in data!) { if (element.isSeen != null) { if (!element.isSeen!) { - print("Found Un Read"); element.isSeen = true; dynamic data = [ - {"userChatHistoryId": element.userChatHistoryId, "TargetUserId": element.targetUserId, "isDelivered": true, "isSeen": true} + {"userChatHistoryId": element.userChatHistoryId, "TargetUserId": element.currentUserId, "isDelivered": true, "isSeen": true} ]; updateUserChatHistoryStatusAsync(data); + notifyListeners(); } } } @@ -288,7 +288,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { } userChatHistory.insert(0, data.first); - if (searchedChats != null) { + + if (searchedChats != null && !isChatScreenActive) { for (ChatUser user in searchedChats!) { if (user.id == data.first.currentUserId) { var tempCount = user.unreadMessageCount ?? 0;