sent updated release to screens

appointment_merge
Faiz Hashmi 4 months ago
parent d9813561bc
commit 6660a43aa8

@ -33,11 +33,11 @@ class TextToSpeechServiceImp implements TextToSpeechService {
log("getDefaultEngine: ${await textToSpeechInstance.getDefaultEngine}");
log("getEngines: ${await textToSpeechInstance.getEngines}");
// await textToSpeechInstance.setLanguage(LanguageEnum.arabic.enumToString());
// textToSpeechInstance.setSpeechRate(0.45);
// textToSpeechInstance.setPitch(0.9);
try {
await textToSpeechInstance.setLanguage(LanguageEnum.english.enumToString());
} catch (e) {
log("error setting language english: ${e.toString()}");
}
textToSpeechInstance.setSpeechRate(0.37);
textToSpeechInstance.setPitch(0.85);
@ -63,13 +63,19 @@ class TextToSpeechServiceImp implements TextToSpeechService {
textToSpeechInstance.setVolume(1.0);
}
if (langEnum == LanguageEnum.arabic) {
try {
await textToSpeechInstance.setLanguage(LanguageEnum.arabic.enumToString());
textToSpeechInstance.setSpeechRate(0.45);
textToSpeechInstance.setPitch(0.9);
} catch (e) {
log("error setting language english: ${e.toString()}");
} // textToSpeechInstance.setSpeechRate(0.45);
// textToSpeechInstance.setPitch(0.9);
} else if (langEnum == LanguageEnum.english) {
try {
await textToSpeechInstance.setLanguage(LanguageEnum.english.enumToString());
textToSpeechInstance.setSpeechRate(0.37);
textToSpeechInstance.setPitch(0.85);
} catch (e) {
log("error setting language english: ${e.toString()}");
} // textToSpeechInstance.setSpeechRate(0.37);
// textToSpeechInstance.setPitch(0.85);
}
String preVoice = ticket.ticketModel!.ticketNoText;
String postVoice = '';
@ -89,9 +95,8 @@ class TextToSpeechServiceImp implements TextToSpeechService {
String ticketNo = ticket.ticketModel!.queueNo!.trim().toString();
// log("lang: ${await textToSpeechInstance.areLanguagesInstalled(["en", "ar"])}");
// log("getDefaultEngine: ${await textToSpeechInstance.getDefaultEngine}");
// log("getEngines: ${await textToSpeechInstance.getEngines}");
log("lang: ${await textToSpeechInstance.areLanguagesInstalled(["en-US", "ar-SA"])}");
log("lang: $langEnum");
log("preVoice: $preVoice");
log("postVoice: $postVoice");
@ -134,6 +139,8 @@ class TextToSpeechServiceImp implements TextToSpeechService {
patientAlpha = patientAlpha.split('').join(' .. ');
log("I will now all this:{ $preVoice .. $clinicName .. $patientAlpha .. $patientNumeric .. $postVoice $roomNo } ");
if (langEnum == LanguageEnum.english) {
await textToSpeechInstance.speak("$preVoice .. $clinicName .. $patientAlpha .. $patientNumeric .. $postVoice $roomNo");
return;
@ -146,11 +153,19 @@ class TextToSpeechServiceImp implements TextToSpeechService {
if (preVoice.isNotEmpty) {
await textToSpeechInstance.speak("$preVoice ");
}
textToSpeechInstance.setLanguage(LanguageEnum.english.enumToString());
try {
await textToSpeechInstance.setLanguage(LanguageEnum.english.enumToString());
} catch (e) {
log("error setting language english: ${e.toString()}");
}
await textToSpeechInstance.speak("$patientAlpha .. $patientNumeric");
textToSpeechInstance.setLanguage(langEnum.enumToString());
// await textToSpeechInstance.speak(postVoice);
// textToSpeechInstance.setLanguage(LanguageEnum.english.enumToString());
try {
await textToSpeechInstance.setLanguage(langEnum.enumToString());
} catch (e) {
log("error setting language langEnum: ${e.toString()}");
}
await textToSpeechInstance.speak("$postVoice $roomNo").whenComplete(() {
isSpeechCompleted = true;
});
@ -162,5 +177,19 @@ class TextToSpeechServiceImp implements TextToSpeechService {
@override
void listenToTextToSpeechEvents({required Function() onVoiceCompleted}) {
textToSpeechInstance.setCompletionHandler(onVoiceCompleted);
textToSpeechInstance.setErrorHandler((message) {
logger.e("setErrorHandler: $message\nCompleting the voice for now");
isSpeechCompleted = true;
onVoiceCompleted();
});
textToSpeechInstance.setPauseHandler(() {
logger.e("setPauseHandler");
});
textToSpeechInstance.setCancelHandler(() {
logger.e("setCancelHandler");
});
}
}

@ -145,11 +145,11 @@ extension LanguageEnumToString on LanguageEnum {
String enumToString() {
switch (this) {
case LanguageEnum.english:
return "en";
return "en-US";
case LanguageEnum.arabic:
return "ar";
return "ar-SA";
default:
return "en";
return "en-US";
}
}
}

@ -125,7 +125,7 @@ class QueuingViewModel extends ChangeNotifier {
}
Future<void> onHubTicketCall(List<Object?>? response) async {
logger.i("onHubTicketCall: $response");
log("onHubTicketCall: $response");
log("isCallingInProgress: $isCallingInProgress");
if (response != null && response.isNotEmpty) {
TicketDetailsModel ticketDetailsModel = TicketDetailsModel.fromJson(response.first as Map<String, dynamic>);

Loading…
Cancel
Save