Chat Fixes & User Chat Counter

merge-requests/81/head
Aamir Muhammad 3 years ago
parent 00f3d268ed
commit a08f1c6d77

@ -36,7 +36,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
void registerEvents() { void registerEvents() {
hubConnection.on("OnUpdateUserStatusAsync", changeStatus); hubConnection.on("OnUpdateUserStatusAsync", changeStatus);
hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived); hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived);
// hubConnection.on("OnSeenChatUserAsync", onChatSeen); hubConnection.on("OnSeenChatUserAsync", onChatSeen);
//hubConnection.on("OnUserTypingAsync", onUserTyping); //hubConnection.on("OnUserTypingAsync", onUserTyping);
hubConnection.on("OnUserCountAsync", userCountAsync); hubConnection.on("OnUserCountAsync", userCountAsync);
hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow); hubConnection.on("OnUpdateUserChatHistoryWindowsAsync", updateChatHistoryWindow);
@ -119,12 +119,12 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
for (SingleUserChatModel element in data!) { for (SingleUserChatModel element in data!) {
if (element.isSeen != null) { if (element.isSeen != null) {
if (!element.isSeen!) { if (!element.isSeen!) {
print("Found Un Read");
element.isSeen = true; element.isSeen = true;
dynamic data = [ dynamic data = [
{"userChatHistoryId": element.userChatHistoryId, "TargetUserId": element.targetUserId, "isDelivered": true, "isSeen": true} {"userChatHistoryId": element.userChatHistoryId, "TargetUserId": element.currentUserId, "isDelivered": true, "isSeen": true}
]; ];
updateUserChatHistoryStatusAsync(data); updateUserChatHistoryStatusAsync(data);
notifyListeners();
} }
} }
} }
@ -288,7 +288,8 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
} }
userChatHistory.insert(0, data.first); userChatHistory.insert(0, data.first);
if (searchedChats != null) {
if (searchedChats != null && !isChatScreenActive) {
for (ChatUser user in searchedChats!) { for (ChatUser user in searchedChats!) {
if (user.id == data.first.currentUserId) { if (user.id == data.first.currentUserId) {
var tempCount = user.unreadMessageCount ?? 0; var tempCount = user.unreadMessageCount ?? 0;

Loading…
Cancel
Save