Chat Fixes

merge-requests/55/head
Sikander Saleem 3 years ago
parent 3e5ce90c9a
commit 027b6ca7b6

@ -148,7 +148,9 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
({String? connectionId}) {}, ({String? connectionId}) {},
); );
if (hubConnection.state != HubConnectionState.Connected) { if (hubConnection.state != HubConnectionState.Connected) {
print("================= Connection Established =========================="); if (kDebugMode) {
print("================= Connection Established ==========================");
}
await hubConnection.start(); await hubConnection.start();
hubConnection.on("OnUpdateUserStatusAsync", changeStatus); hubConnection.on("OnUpdateUserStatusAsync", changeStatus);
hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived); hubConnection.on("OnDeliveredChatUserAsync", onMsgReceived);
@ -176,7 +178,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
} }
void userCountAsync(List<Object?>? args) { void userCountAsync(List<Object?>? args) {
List items = args!.toList(); dynamic items = args!.toList();
//logger.d("---------------------------------User Count Async -------------------------------------"); //logger.d("---------------------------------User Count Async -------------------------------------");
//logger.d(items); //logger.d(items);
// for (var user in searchedChats!) { // for (var user in searchedChats!) {
@ -188,8 +190,10 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
} }
void updateChatHistoryWindow(List<Object?>? args) { void updateChatHistoryWindow(List<Object?>? args) {
List items = args!.toList(); dynamic items = args!.toList();
print("---------------------------------Update Chat History Windows Async -------------------------------------"); if (kDebugMode) {
print("---------------------------------Update Chat History Windows Async -------------------------------------");
}
logger.d(items); logger.d(items);
// for (var user in searchedChats!) { // for (var user in searchedChats!) {
// if (user.id == items.first["id"]) { // if (user.id == items.first["id"]) {
@ -200,21 +204,25 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
} }
void chatNotDelivered(List<Object?>? args) { void chatNotDelivered(List<Object?>? args) {
List items = args!.toList(); dynamic items = args!.toList();
print("--------------------------------- Chat Not Delivered Windows Async -------------------------------------"); if (kDebugMode) {
print("--------------------------------- Chat Not Delivered Windows Async -------------------------------------");
}
logger.d(items); logger.d(items);
// for (var user in searchedChats!) { // for (var user in searchedChats!) {
// if (user.id == items.first["id"]) { // if (user.id == items.first["id"]) {
// user.userStatus = items.first["userStatus"]; // user.userStatus = items.first["userStatus"];
// } // }
// } // }
// notifyListeners(); // notifyListeners();2
} }
void changeStatus(List<Object?>? args) { void changeStatus(List<Object?>? args) {
// print("================= Status Online // Offline ===================="); if (kDebugMode) {
List items = args!.toList(); print("================= Status Online // Offline ====================");
// logger.d(items); }
dynamic items = args!.toList();
logger.d(items);
for (ChatUser user in searchedChats!) { for (ChatUser user in searchedChats!) {
if (user.id == items.first["id"]) { if (user.id == items.first["id"]) {
user.userStatus = items.first["userStatus"]; user.userStatus = items.first["userStatus"];
@ -348,7 +356,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
// } // }
Future<void> sendChatToServer( Future<void> sendChatToServer(
{required int chatEventId, required fileTypeId, required int targetUserId, required String targetUserName, required chatReplyId, required bool isAttachment, required bool isReply}) async { {required int chatEventId, required fileTypeId, required int targetUserId, required String targetUserName, required chatReplyId, required bool isAttachment, required bool isReply}) async {
Uuid uuid = const Uuid(); Uuid uuid = const Uuid();
SingleUserChatModel data = SingleUserChatModel( SingleUserChatModel data = SingleUserChatModel(
chatEventId: chatEventId, chatEventId: chatEventId,

Loading…
Cancel
Save