diff --git a/lib/ui/chat/chat_home.dart b/lib/ui/chat/chat_home.dart index 807af1a..330242a 100644 --- a/lib/ui/chat/chat_home.dart +++ b/lib/ui/chat/chat_home.dart @@ -38,23 +38,22 @@ class _ChatHomeState extends State { data.clearAll(); } - // void fetchAgain() { - // print("Fetch Triggered"); - // if (chatHubConnection.state != HubConnectionState.Connected) { - // data.getUserAutoLoginToken().whenComplete(() async { - // await data.buildHubConnection(); - // data.getUserRecentChats(); - // }); - // return; - // } - // if (data.searchedChats == null || data.searchedChats!.isEmpty) { - // data.getUserRecentChats(); - // } - // } + void fetchAgain() { + if (chatHubConnection.state != HubConnectionState.Connected) { + data.getUserAutoLoginToken().whenComplete(() async { + await data.buildHubConnection(); + data.getUserRecentChats(); + }); + return; + } + if (data.searchedChats == null || data.searchedChats!.isEmpty) { + data.getUserRecentChats(); + } + } @override Widget build(BuildContext context) { - // fetchAgain(); + fetchAgain(); return Scaffold( backgroundColor: MyColors.white, appBar: AppBarWidget(context, title: LocaleKeys.chat.tr(), showHomeButton: true), diff --git a/lib/ui/landing/dashboard_screen.dart b/lib/ui/landing/dashboard_screen.dart index 2d7de09..b423ebd 100644 --- a/lib/ui/landing/dashboard_screen.dart +++ b/lib/ui/landing/dashboard_screen.dart @@ -58,7 +58,6 @@ class _DashboardScreenState extends State { data = Provider.of(context, listen: false); marathonProvider = Provider.of(context, listen: false); cProvider = Provider.of(context, listen: false); - _bHubCon(); _onRefresh(); }); } @@ -80,6 +79,7 @@ class _DashboardScreenState extends State { void _onRefresh() async { data.initProvider(); + _bHubCon(); // data.getITGNotification().then((value) { // print("--------------------detail_1-----------------"); // print(value!.result!.data!.notificationMasterId);