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

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

Loading…
Cancel
Save