|
|
|
|
@ -79,7 +79,6 @@ class AppProvider extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
if (widgetsConfigModel != null) {
|
|
|
|
|
currentWidgetsConfigModel = widgetsConfigModel;
|
|
|
|
|
log("I got this data: ${widgetsConfigModel.toString()}");
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -87,7 +86,6 @@ class AppProvider extends ChangeNotifier {
|
|
|
|
|
WeathersWidgetModel currentWeathersWidgetModel = WeathersWidgetModel();
|
|
|
|
|
|
|
|
|
|
Future<void> getWeatherDetailsFromServer() async {
|
|
|
|
|
log("I got this data from Weather: ");
|
|
|
|
|
|
|
|
|
|
WeathersWidgetModel? weathersWidgetModel = await API.getWeatherDetailsFromServer(
|
|
|
|
|
(currentWidgetsConfigModel!.cityKey ?? "").toString(),
|
|
|
|
|
@ -96,7 +94,6 @@ class AppProvider extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
if (weathersWidgetModel != null) {
|
|
|
|
|
currentWeathersWidgetModel = weathersWidgetModel;
|
|
|
|
|
log("I got this data from Weather: ${weathersWidgetModel.toString()}");
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -308,9 +305,16 @@ class AppProvider extends ChangeNotifier {
|
|
|
|
|
await audioPlayer.play();
|
|
|
|
|
await Future.delayed(const Duration(seconds: 3));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (patientTicket.isVoiceReq && voiceCaller == null && !patientTicket.isQueue) {
|
|
|
|
|
final postVoice = getCallTypeText(patientTicket, patientCallConfigurations);
|
|
|
|
|
voiceCaller = CallByVoice(preVoice: "Ticket Number", ticketNo: patientTicket.queueNo.trim().toString(), postVoice: postVoice, lang: 'en', flutterTts: flutterTts);
|
|
|
|
|
voiceCaller = CallByVoice(
|
|
|
|
|
preVoice: patientCallConfigurations.preVoiceText,
|
|
|
|
|
ticketNo: patientTicket.queueNo.trim().toString(),
|
|
|
|
|
postVoice: postVoice,
|
|
|
|
|
lang: patientCallConfigurations.voiceLanguage == 1 ? "en-US" : "ar",
|
|
|
|
|
flutterTts: flutterTts,
|
|
|
|
|
);
|
|
|
|
|
await voiceCaller!.startCalling(patientTicket.queueNo.trim().toString() != patientTicket.callNoStr.trim().toString());
|
|
|
|
|
voiceCaller = null;
|
|
|
|
|
if (isQueuePatients.isNotEmpty) {
|
|
|
|
|
@ -318,13 +322,10 @@ class AppProvider extends ChangeNotifier {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
isCallingInProgress = false;
|
|
|
|
|
log("Setting isCallingInProgress : $isCallingInProgress");
|
|
|
|
|
|
|
|
|
|
if (isApiCallNeeded) {
|
|
|
|
|
log("I will start waiting!!");
|
|
|
|
|
Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async {
|
|
|
|
|
await callPatientsAPI();
|
|
|
|
|
log("Called the API after waiting!");
|
|
|
|
|
isApiCallNeeded = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -339,7 +340,6 @@ class AppProvider extends ChangeNotifier {
|
|
|
|
|
if (currentPatient.isVoiceReq) return;
|
|
|
|
|
|
|
|
|
|
if (isQueuePatients.isNotEmpty) {
|
|
|
|
|
log("isQueuePatients length : ${isQueuePatients.length}");
|
|
|
|
|
final length = isQueuePatients.length;
|
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
|
await Future.delayed(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec)).whenComplete(() async {
|
|
|
|
|
@ -358,12 +358,9 @@ class AppProvider extends ChangeNotifier {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
isCallingInProgress = false;
|
|
|
|
|
log("Setting isCallingInProgress : $isCallingInProgress");
|
|
|
|
|
if (isApiCallNeeded) {
|
|
|
|
|
log("I will start waiting!!");
|
|
|
|
|
Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async {
|
|
|
|
|
await callPatientsAPI();
|
|
|
|
|
log("Called the API after waiting!");
|
|
|
|
|
isApiCallNeeded = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@ -376,7 +373,6 @@ class AppProvider extends ChangeNotifier {
|
|
|
|
|
|
|
|
|
|
flutterTts.setCompletionHandler(() async {
|
|
|
|
|
if (isQueuePatients.isNotEmpty) {
|
|
|
|
|
log("isQueuePatients length : ${isQueuePatients.length}");
|
|
|
|
|
final length = isQueuePatients.length;
|
|
|
|
|
for (int i = 0; i < length; i++) {
|
|
|
|
|
await Future.delayed(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec)).whenComplete(() async {
|
|
|
|
|
@ -395,12 +391,9 @@ class AppProvider extends ChangeNotifier {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
isCallingInProgress = false;
|
|
|
|
|
log("Setting isCallingInProgress : $isCallingInProgress");
|
|
|
|
|
if (isApiCallNeeded) {
|
|
|
|
|
log("I will start waiting!!");
|
|
|
|
|
Timer(Duration(seconds: patientCallConfigurations.concurrentCallDelaySec), () async {
|
|
|
|
|
await callPatientsAPI();
|
|
|
|
|
log("Called the API after waiting!");
|
|
|
|
|
isApiCallNeeded = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|