From ad5f5b7852af27a5eba19ab7e7c7a0328e93e9ba Mon Sep 17 00:00:00 2001 From: FaizHashmiCS22 Date: Tue, 14 Jan 2025 10:49:44 +0300 Subject: [PATCH] counter checks --- lib/constants/app_constants.dart | 2 +- lib/models/global_config_model.dart | 5 +++++ lib/services/text_to_speech_service.dart | 12 ++++++------ lib/view_models/queuing_view_model.dart | 3 +-- lib/view_models/screen_config_view_model.dart | 19 ++++++++++++++----- lib/views/common_widgets/app_header.dart | 2 +- .../main_queue_screen/main_queue_screen.dart | 4 ++-- 7 files changed, 30 insertions(+), 17 deletions(-) diff --git a/lib/constants/app_constants.dart b/lib/constants/app_constants.dart index aa6773c..dcabba5 100644 --- a/lib/constants/app_constants.dart +++ b/lib/constants/app_constants.dart @@ -6,7 +6,7 @@ Logger logger = Logger(printer: PrettyPrinter(printEmojis: false, colors: true, // app globals -bool isNeedToBreakVoiceForArabic = true; +bool isNeedToBreakVoiceForArabic = false; bool isSpeechCompleted = true; class AppStrings { diff --git a/lib/models/global_config_model.dart b/lib/models/global_config_model.dart index 7a58bb5..c14a0ec 100644 --- a/lib/models/global_config_model.dart +++ b/lib/models/global_config_model.dart @@ -178,3 +178,8 @@ class GlobalConfigurationsModel { cityKey = json['cityKey']; } } + +// { +// "latitude": 24.722136, +// "longitude": 46.774303 +// } diff --git a/lib/services/text_to_speech_service.dart b/lib/services/text_to_speech_service.dart index 704b409..83b6bdd 100644 --- a/lib/services/text_to_speech_service.dart +++ b/lib/services/text_to_speech_service.dart @@ -28,9 +28,9 @@ class TextToSpeechServiceImp implements TextToSpeechService { @override Future speechTextTest(String test) async { - await textToSpeechInstance.setLanguage(LanguageEnum.english.enumToString()); - textToSpeechInstance.setSpeechRate(0.37); - textToSpeechInstance.setPitch(0.8); + await textToSpeechInstance.setLanguage(LanguageEnum.arabic.enumToString()); + textToSpeechInstance.setSpeechRate(0.45); + textToSpeechInstance.setPitch(0.9); await textToSpeechInstance.speak(test); } @@ -107,15 +107,15 @@ class TextToSpeechServiceImp implements TextToSpeechService { await textToSpeechInstance.speak("$preVoice "); } textToSpeechInstance.setLanguage(LanguageEnum.english.enumToString()); - await textToSpeechInstance.speak(" $patientAlpha .. $patientNumeric .. "); + await textToSpeechInstance.speak("$patientAlpha .. $patientNumeric .."); textToSpeechInstance.setLanguage(langEnum.enumToString()); - await textToSpeechInstance.speak(" $postVoice "); + await textToSpeechInstance.speak(postVoice); textToSpeechInstance.setLanguage(LanguageEnum.english.enumToString()); await textToSpeechInstance.speak(roomNo).whenComplete(() { isSpeechCompleted = true; }); } else { - await textToSpeechInstance.speak("$preVoice $patientAlpha .. .. $patientNumeric .. .. $postVoice $roomNo"); + await textToSpeechInstance.speak("$patientAlpha .. .. $patientNumeric .. .. $postVoice .. $roomNo"); } } diff --git a/lib/view_models/queuing_view_model.dart b/lib/view_models/queuing_view_model.dart index 358e067..ca6f933 100644 --- a/lib/view_models/queuing_view_model.dart +++ b/lib/view_models/queuing_view_model.dart @@ -146,8 +146,7 @@ class QueuingViewModel extends ChangeNotifier { } Future testSpeech() async { - audioService.playTone(path: AppAssets.callTone); - textToSpeechService.speechTextTest("Hello Qamar?"); + textToSpeechService.speechTextTest("يرجى التوجه .. إلى العداد ..رقم .. 12"); } Future voiceCallTicket({required TicketData? ticketData}) async { diff --git a/lib/view_models/screen_config_view_model.dart b/lib/view_models/screen_config_view_model.dart index 89c63e1..a812953 100644 --- a/lib/view_models/screen_config_view_model.dart +++ b/lib/view_models/screen_config_view_model.dart @@ -126,6 +126,8 @@ class ScreenConfigViewModel extends ChangeNotifier { if (shouldUpdateNextPrayer) { getNextPrayerToShow(); } + + getInfoWidgetsDetailsFromServer(); } Future getInfoWidgetsDetailsFromServer() async { @@ -158,9 +160,11 @@ class ScreenConfigViewModel extends ChangeNotifier { PrayersWidgetModel prayersWidgetModel = PrayersWidgetModel(); Future getPrayerDetailsFromServer() async { + double testLatitude = 24.722136; + double testLongitude = 46.774303; PrayersWidgetModel? response = await screenDetailsRepo.getPrayerDetailsByLatLong( - latitude: globalConfigurationsModel.projectLatitude ?? 0.0, - longitude: globalConfigurationsModel.projectLongitude ?? 0.0, + latitude: globalConfigurationsModel.projectLatitude == 0.0 ? testLatitude : globalConfigurationsModel.projectLatitude ?? testLatitude, + longitude: globalConfigurationsModel.projectLongitude == 0.0 ? testLongitude : globalConfigurationsModel.projectLongitude ?? testLongitude, ); if (response == null) { @@ -175,8 +179,9 @@ class ScreenConfigViewModel extends ChangeNotifier { WeathersWidgetModel weathersWidgetModel = WeathersWidgetModel(); Future getWeatherDetailsFromServer() async { + int testCityKey = 297030; WeathersWidgetModel? response = await screenDetailsRepo.getWeatherDetailsByCity( - cityId: globalConfigurationsModel.cityKey.toString(), + cityId: (globalConfigurationsModel.cityKey == 0 ? testCityKey : globalConfigurationsModel.cityKey).toString(), ); if (response == null) { @@ -188,10 +193,14 @@ class ScreenConfigViewModel extends ChangeNotifier { String nextPrayerToShowWithTime = ''; - void getNextPrayerToShow() { + void getNextPrayerToShow() async { final current = DateTime.now(); log("Checking Namaz time Locally at ${current.toString()} and ${current.timeZoneName} "); + if (globalConfigurationsModel.isPrayerTimeReq && prayersWidgetModel.fajr == null) { + await getPrayerDetailsFromServer(); + } + if (prayersWidgetModel.fajr != null && prayersWidgetModel.fajr!.toDateTimeFromInt().isAfter(current)) { final namazTime = prayersWidgetModel.fajr!.toFormattedDateTimeFromInt(); nextPrayerToShowWithTime = "${globalConfigurationsModel.fajarText} at $namazTime"; @@ -280,7 +289,7 @@ class ScreenConfigViewModel extends ChangeNotifier { } Future createAutoTickets({required int numOfTicketsToCreate}) async { - int startTicket = 123457000; + int startTicket = 123457100; for (int i = 0; i < numOfTicketsToCreate; i++) { GenericRespModel? response = await screenDetailsRepo.createNextTickets(ticketNumber: startTicket); diff --git a/lib/views/common_widgets/app_header.dart b/lib/views/common_widgets/app_header.dart index a06f365..329d566 100644 --- a/lib/views/common_widgets/app_header.dart +++ b/lib/views/common_widgets/app_header.dart @@ -38,7 +38,7 @@ class AppHeader extends StatelessWidget implements PreferredSizeWidget { Row( children: [ AppText( - "SignalR Hub Status :", + "Hub Status :", fontSize: SizeConfig.getWidthMultiplier() * 2.6, ), AppText( diff --git a/lib/views/main_queue_screen/main_queue_screen.dart b/lib/views/main_queue_screen/main_queue_screen.dart index aa76077..a335647 100644 --- a/lib/views/main_queue_screen/main_queue_screen.dart +++ b/lib/views/main_queue_screen/main_queue_screen.dart @@ -119,6 +119,7 @@ class MainQueueScreen extends StatelessWidget { fontFamily: AppStrings.fontNamePoppins, textAlign: TextAlign.center, fontWeight: FontWeight.bold, + color: Colors.transparent, fontSize: SizeConfig.getWidthMultiplier() * 8, ); } @@ -171,7 +172,6 @@ class MainQueueScreen extends StatelessWidget { Widget widget = const SizedBox(); String text = AppStrings.awaitingArrivalEng; String fontFamily = AppStrings.fontNamePoppins; - // queuingViewModel.voiceCallTicket(ticketData: queuingViewModel.currentTickets.first.ticketModel); if (screenConfigViewModel.globalConfigurationsModel.screenLanguageEnum == LanguageEnum.arabic) { text = AppStrings.awaitingArrivalAr; fontFamily = AppStrings.fontNameCairo; @@ -278,7 +278,7 @@ class MainQueueScreen extends StatelessWidget { builder: (BuildContext context, ScreenOrientationEnum screenOrientationEnum, Widget? child) { //TODO: For Testing Only // context.read().createAutoTickets(numOfTicketsToCreate: 20); - // + // context.read().testSpeech(); // context.read().voiceCallTicket(ticketData: context.read().currentTickets.first.ticketModel); return RotatedBox( quarterTurns: screenOrientationEnum.getTurnsByOrientation(),