From 3982491386206e137d9ab8617b748e073b61c8ae Mon Sep 17 00:00:00 2001 From: faizatflutter Date: Wed, 20 Mar 2024 22:38:01 +0500 Subject: [PATCH] Fixed Repeating issue --- lib/core/config/config.dart | 2 +- lib/home/app_provider.dart | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/core/config/config.dart b/lib/core/config/config.dart index 90e43ec..de373df 100644 --- a/lib/core/config/config.dart +++ b/lib/core/config/config.dart @@ -5,7 +5,7 @@ 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/api/PatientCall'; // UAT +// 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'; diff --git a/lib/home/app_provider.dart b/lib/home/app_provider.dart index c925381..d045e69 100644 --- a/lib/home/app_provider.dart +++ b/lib/home/app_provider.dart @@ -80,17 +80,15 @@ class AppProvider extends ChangeNotifier { } } - WidgetsConfigModel? currentWidgetsConfigModel = WidgetsConfigModel(); + WidgetsConfigModel? currentWidgetsConfigModel; Future getInfoWidgetsConfigurationsFromServer() async { WidgetsConfigModel? widgetsConfigModel = await API.getWidgetConfigsFromServer(currentDeviceIp, onFailure: (error) { log("Api call failed with this error: ${error.toString()}"); }); - if (widgetsConfigModel != null) { - currentWidgetsConfigModel = widgetsConfigModel; - notifyListeners(); - } + currentWidgetsConfigModel = widgetsConfigModel; + notifyListeners(); } WeathersWidgetModel currentWeathersWidgetModel = WeathersWidgetModel(); @@ -352,7 +350,7 @@ class AppProvider extends ChangeNotifier { lang: patientTicket.voiceLanguage == 1 ? "en" : "ar", flutterTts: flutterTts, ); - voiceCaller!.startCalling(patientTicket.queueNo.trim().toString() != patientTicket.callNoStr.trim().toString()).whenComplete(() { + await voiceCaller!.startCalling(patientTicket.queueNo.trim().toString() != patientTicket.callNoStr.trim().toString()).whenComplete(() { voiceCaller = null; // if (isQueuePatients.isNotEmpty) { // isQueuePatients.removeAt(0); @@ -381,7 +379,6 @@ class AppProvider extends ChangeNotifier { if (isQueuePatients.isNotEmpty) { log("i am here on line 375"); - final length = isQueuePatients.length; // for (int i = 0; i < length; i++) { await Future.delayed(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec)).whenComplete(() async { PatientTicketModel temp = PatientTicketModel(); @@ -438,12 +435,16 @@ class AppProvider extends ChangeNotifier { patientTickets.add(temp); } notifyListeners(); - await voiceCallPatientTicket(patientTickets.first, "setCompletionHandler"); - updatePatientTicket(patientTickets.first); + if (isQueuePatients.isNotEmpty) { + await voiceCallPatientTicket(patientTickets.first, "setCompletionHandler"); + updatePatientTicket(patientTickets.first); + } }); // } } + log("here logg: ${isQueuePatients.length}"); + if (isQueuePatients.isEmpty) { isCallingInProgress = false; }