From 07b337ba7066601abe2525f150ac295c5596286a Mon Sep 17 00:00:00 2001 From: Faiz Hashmi Date: Mon, 25 Mar 2024 11:10:10 +0300 Subject: [PATCH] Till the Khobar Team Demo --- lib/core/config/config.dart | 4 ++-- lib/home/app_provider.dart | 17 ++++++++--------- lib/utils/signalR_utils.dart | 14 ++++++-------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/lib/core/config/config.dart b/lib/core/config/config.dart index de373df..910fd74 100644 --- a/lib/core/config/config.dart +++ b/lib/core/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -// const BASE_URL = 'https://ms.hmg.com/nscapi'; // UAT -const BASE_URL = 'https://qline.hmg.com'; // LIVE +const BASE_URL = 'https://ms.hmg.com/nscapi'; // UAT +//const BASE_URL = 'https://qline.hmg.com'; // LIVE const apiKey = 'EE17D21C7943485D9780223CCE55DCE5'; // UAT // const BASE_URL = 'http://10.200.204.11:2222/Services/Nurses.svc/REST'; // const BASE_URL = 'https://hmgwebservices.com/'; diff --git a/lib/home/app_provider.dart b/lib/home/app_provider.dart index d045e69..08ecc58 100644 --- a/lib/home/app_provider.dart +++ b/lib/home/app_provider.dart @@ -18,6 +18,7 @@ import 'package:queuing_system/utils/call_by_voice.dart'; import 'package:queuing_system/utils/call_type.dart'; import 'package:queuing_system/utils/signalR_utils.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:signalr_core/signalr_core.dart'; bool isVoiceActualCompletedGlobally = false; @@ -87,7 +88,7 @@ class AppProvider extends ChangeNotifier { log("Api call failed with this error: ${error.toString()}"); }); - currentWidgetsConfigModel = widgetsConfigModel; + if (widgetsConfigModel != null) currentWidgetsConfigModel = widgetsConfigModel; notifyListeners(); } @@ -162,8 +163,7 @@ class AppProvider extends ChangeNotifier { RssFeedModel currentRssFeedModel = RssFeedModel(); Future getRssFeedDetailsFromServer() async { - RssFeedModel? rssFeedModel = - await API.getRssFeedDetailsFromServer(languageId: 0, onFailure: (error) => log("Api call failed with this error: ${error.toString()}")); + RssFeedModel? rssFeedModel = await API.getRssFeedDetailsFromServer(languageId: 0, onFailure: (error) => log("Api call failed with this error: ${error.toString()}")); if (rssFeedModel != null) { currentRssFeedModel = rssFeedModel; @@ -173,7 +173,7 @@ class AppProvider extends ChangeNotifier { } Future getInfoWidgetsDetailsFromServer() async { - if (currentWidgetsConfigModel == null) return; + // if (currentWidgetsConfigModel == null) return; await getInfoWidgetsConfigurationsFromServer().whenComplete(() async { if (currentWidgetsConfigModel!.isWeatherReq!) { @@ -471,7 +471,7 @@ class AppProvider extends ChangeNotifier { updatePatientTicket(PatientTicketModel patientTicket) { if (!patientTicket.isQueue) { - API.callUpdateNotIsQueueRecordByIDAsync(currentDeviceIp, ticket: patientTicket, onSuccess: (ticketsUpdated) { + API.callUpdateNotIsQueueRecordByIDAsync(currentDeviceIp, ticket: patientTicket, onSuccess: (ticketsUpdated) { log("[${patientTicket.callNoStr}] Ticket Updated: $ticketsUpdated"); }, onFailure: (e) { log(" Tickets Update ${patientTicket.callNoStr} Failed with Error : ${e.toString()}"); @@ -485,8 +485,7 @@ class AppProvider extends ChangeNotifier { onDisconnect(exception) { log("SignalR: onDisconnect"); - signalRHelper.startSignalRConnection(currentDeviceIp, - onUpdateAvailable: onPingReceived, onConnect: onConnect, onConnecting: onConnecting, onDisconnect: onDisconnect); + signalRHelper.startSignalRConnection(currentDeviceIp, onUpdateAvailable: onPingReceived, onConnect: onConnect, onConnecting: onConnecting, onDisconnect: onDisconnect); } onConnecting() { @@ -499,8 +498,8 @@ class AppProvider extends ChangeNotifier { case ConnectivityResult.wifi: updateInternetConnection(true); await getCurrentIP(); - if (signalRHelper.connection == null || signalRHelper.connection!.state != ConnectionState.active) { - signalRHelper.connection!.start(); + if (signalRHelper.connection != null) { + if (signalRHelper.connection!.state != HubConnectionState.connected) signalRHelper.connection!.start(); } break; case ConnectivityResult.none: diff --git a/lib/utils/signalR_utils.dart b/lib/utils/signalR_utils.dart index 8c58ad3..6ee1d20 100644 --- a/lib/utils/signalR_utils.dart +++ b/lib/utils/signalR_utils.dart @@ -22,8 +22,6 @@ class SignalRHelper { // String hubBaseURL = "https://vcallapi.hmg.com/PatientCallingHub"; String hubBaseURL = "$BASE_URL/PatientCallingHub"; - - // String hubBaseURL = "https://vcallapi.hmg.com/PatientCallingHub?IPAddress=10.10.14.20"; // "https://VCallApi.hmg.com/WebRTCHub?source=mobile&username=2001273"; HubConnection? connection; @@ -72,10 +70,10 @@ class SignalRHelper { } } - startConnection(BuildContext context) async { - if (connection!.state == HubConnectionState.connected || connection!.state == HubConnectionState.connecting) { - connection!.off('addChatMessage'); - await connection!.start(); - } - } +// startConnection(BuildContext context) async { +// if (connection!.state == HubConnectionState.connected || connection!.state == HubConnectionState.connecting) { +// connection!.off('addChatMessage'); +// await connection!.start(); +// } +// } }