merge-requests/188/head
Aamir Muhammad 3 years ago
parent 5a338199b9
commit 55cf39a364

@ -84,19 +84,22 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
bool disbaleChatForThisUser = false; bool disbaleChatForThisUser = false;
bool isCall = false; bool isCall = false;
userLoginToken.UserAutoLoginModel userLoginData = userLoginToken.UserAutoLoginModel(); userLoginToken.UserAutoLoginModel userLoginData = userLoginToken.UserAutoLoginModel();
Future<void> getUserAutoLoginToken() async { Future<void> getUserAutoLoginToken() async {
userLoginToken.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken(); try {
if (userLoginResponse.response != null) { userLoginToken.UserAutoLoginModel userLoginResponse = await ChatApiClient().getUserLoginToken();
AppState().setchatUserDetails = userLoginResponse; if (userLoginResponse.response != null) {
} else { AppState().setchatUserDetails = userLoginResponse;
AppState().setchatUserDetails = userLoginResponse; } else {
Utils.showToast( AppState().setchatUserDetails = userLoginResponse;
userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr", Utils.showToast(
); userLoginResponse.errorResponses!.first.fieldName.toString() + " Erorr",
);
disbaleChatForThisUser = true;
notifyListeners();
}
} catch (e) {
disbaleChatForThisUser = true; disbaleChatForThisUser = true;
notifyListeners(); notifyListeners();
} }
@ -105,7 +108,7 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
Future<void> buildHubConnection({required BuildContext context, required ChatCallProvider ccProvider}) async { Future<void> buildHubConnection({required BuildContext context, required ChatCallProvider ccProvider}) async {
try { try {
chatHubConnection = await getHubConnection(); chatHubConnection = await getHubConnection();
}catch(e){ } catch (e) {
Utils.showToast(e.toString()); Utils.showToast(e.toString());
} }
await chatHubConnection.start(); await chatHubConnection.start();

@ -127,6 +127,7 @@ class _DashboardScreenState extends State<DashboardScreen> with WidgetsBindingOb
if (chatHubConnection.state == HubConnectionState.Connected) { if (chatHubConnection.state == HubConnectionState.Connected) {
Utils.hideLoading(context); Utils.hideLoading(context);
Navigator.pushNamed(context, AppRoutes.chat); Navigator.pushNamed(context, AppRoutes.chat);
Utils.saveStringFromPrefs("isAppOpendByChat", "false");
} }
} }

Loading…
Cancel
Save