From fb97319164d030fee3b52146e9fc315a1f4f1d30 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" Date: Mon, 5 Dec 2022 14:36:57 +0300 Subject: [PATCH] Chat Fixes & User Chat Counter --- lib/provider/chat_provider_model.dart | 46 +-------------------------- lib/ui/landing/dashboard_screen.dart | 4 +-- 2 files changed, 3 insertions(+), 47 deletions(-) diff --git a/lib/provider/chat_provider_model.dart b/lib/provider/chat_provider_model.dart index fd908a1..385c64a 100644 --- a/lib/provider/chat_provider_model.dart +++ b/lib/provider/chat_provider_model.dart @@ -660,48 +660,6 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { sFileType = ""; } - // void scrollListener() { - // _firstAutoscrollExecuted = true; - // if (scrollController.hasClients && scrollController.position.pixels == scrollController.position.maxScrollExtent) { - // _shouldAutoscroll = true; - // } else { - // _shouldAutoscroll = false; - // } - // } - // - // void scrollToBottom() { - // scrollController.animateTo( - // scrollController.position.maxScrollExtent + 100, - // duration: const Duration(milliseconds: 500), - // curve: Curves.easeIn, - // ); - // } - - void msgScroll() { - // scrollController.animateTo( - // // index: 150, - // duration: Duration(seconds: 2), - // curve: Curves.easeInOutCubic); - // scrollController.animateTo( - // scrollController.position.minScrollExtent - 100, - // duration: const Duration(milliseconds: 500), - // curve: Curves.easeIn, - // ); - } - -// Future getDownLoadFile(String fileName) async { -// var data = await ChatApiClient().downloadURL(fileName: "data"); -// Image.memory(data); -// } - -// void getUserChatHistoryNotDeliveredAsync({required int userId}) async { -// try { -// await hubConnection.invoke("GetUserChatHistoryNotDeliveredAsync", args: [userId]); -// } finally { -// hubConnection.off("GetUserChatHistoryNotDeliveredAsync", method: chatNotDelivered); -// } -// } - void getUserImages() async { List emails = []; for (ChatUser element in searchedChats!) { @@ -714,20 +672,18 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin { user.image = uImage.profilePicture ?? ""; user.isImageLoading = false; user.isImageLoaded = true; - notifyListeners(); } } } - for (ChatUser favUser in favUsersList) { for (ChatUserImageModel uImage in chatImages) { if (favUser.email == uImage.email) { favUser.image = uImage.profilePicture ?? ""; favUser.isImageLoading = false; favUser.isImageLoaded = true; - notifyListeners(); } } } + notifyListeners(); } } diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index b449bd1..954b647 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -66,11 +66,11 @@ class _DashboardScreenState extends State { await hubConnection.start(); hubConnection.onreconnecting(({Exception? error}) { print("============== Reconnecting ======================"); - if (hubConnection.state != HubConnectionState.Connected) { + //if (hubConnection.state != HubConnectionState.Connected) { data.getUserAutoLoginToken().whenComplete(() { buildHubConnection(); }); - } + //} }); }