diff --git a/lib/constants/app_constants.dart b/lib/constants/app_constants.dart index b48427a..8d083a2 100644 --- a/lib/constants/app_constants.dart +++ b/lib/constants/app_constants.dart @@ -107,7 +107,7 @@ class AppConstants { static String testIP = '12.4.5.1'; // projectID.QlineType.ScreenType.AnyNumber (1 to 10) static int thresholdForListUI = 3; - static double currentBuildVersion = 8.7; + static double currentBuildVersion = 8.8; static double clearLogsHoursThreshold = 48; } @@ -185,9 +185,9 @@ class MockJsonRepo { mobileNo: '0598544522', patientEmail: 'munira.ali@hotmail.com', preferredLang: 2, - voiceLanguageEnum: LanguageEnum.arabic, - ticketNoText: 'رقم التذكرة', - postVoiceText: 'التوجه الى غرفة قياس العلامات الحيوية', + voiceLanguageEnum: LanguageEnum.english, + ticketNoText: 'Ticket Number', + postVoiceText: 'Call for Vital Signs', patientGender: 2, roomNo: 'D 12', isActive: null, diff --git a/lib/main.dart b/lib/main.dart index 10ee392..69a0ba5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -13,53 +13,6 @@ void main() async { WidgetsFlutterBinding.ensureInitialized(); await AppDependencies.addDependencies(); await WakelockPlus.enable(); - - // The following foreground task logic is now handled natively in Android. Commented out for clarity. - /* - void _initializeForegroundTask() { - FlutterForegroundTask.init( - androidNotificationOptions: AndroidNotificationOptions( - channelId: 'foreground_service', - channelName: AppStrings.appName, - channelDescription: '', - onlyAlertOnce: true, - ), - iosNotificationOptions: const IOSNotificationOptions( - showNotification: false, - playSound: false, - ), - foregroundTaskOptions: ForegroundTaskOptions( - eventAction: ForegroundTaskEventAction.repeat(5000), - autoRunOnBoot: true, - autoRunOnMyPackageReplaced: true, - allowWakeLock: true, - allowWifiLock: true, - ), - ); - } - - Future _startForegroundService() async { - await FlutterForegroundTask.startService( - notificationTitle: AppStrings.appName, - notificationText: 'App is running in foreground', - callback: startCallback, - ); - } - - // Initialize foreground task first - _initializeForegroundTask(); - - // Register lifecycle callback (e.g., reopen app on detach) - LifecycleHandler( - onDetached: () { - getIt().reopenApp(); - }, - ).register(); - - // Start foreground service AFTER initialization - await _startForegroundService(); - */ - runApp(const MyApp()); } @@ -73,6 +26,9 @@ class MyApp extends StatelessWidget { return OrientationBuilder(builder: (context, orientation) { SizeConfig().init(constraints, orientation); SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); + SystemChrome.setPreferredOrientations([ + DeviceOrientation.portraitUp, + ]); return MultiProvider( providers: [ ChangeNotifierProvider(create: (context) => getIt.get()), diff --git a/lib/services/text_to_speech_service.dart b/lib/services/text_to_speech_service.dart index b24e149..fb26420 100644 --- a/lib/services/text_to_speech_service.dart +++ b/lib/services/text_to_speech_service.dart @@ -28,7 +28,7 @@ class TextToSpeechServiceImp implements TextToSpeechService { double volume = 1.0; double pitch = 0.6; - double speech = 0.4; + Map arabicVoice = {"name": "ar-xa-x-ard-local", "locale": "ar"}; @override Future speechTextTest(TicketData ticket) async { @@ -39,8 +39,11 @@ class TextToSpeechServiceImp implements TextToSpeechService { await textToSpeechInstance.setEngine(ttsGoogleEngine); } textToSpeechInstance.setVolume(1.0); - textToSpeechInstance.setSpeechRate(speech); + // final voices = await textToSpeechInstance.getVoices; + // log ("voices:: $voices"); + + await textToSpeechInstance.setVoice(arabicVoice); if (langEnum == LanguageEnum.arabic) { try { @@ -62,7 +65,7 @@ class TextToSpeechServiceImp implements TextToSpeechService { } String ticketNo = ticket.queueNo!.trim().toString(); - log("areLanguagesInstalled: ${await textToSpeechInstance.areLanguagesInstalled(["en-US", "ar-SA"])}"); + log("areLanguagesInstalled: ${await textToSpeechInstance.areLanguagesInstalled(["en", "ar"])}"); log("lang: $langEnum"); log("preVoice: $preVoice"); @@ -156,6 +159,8 @@ class TextToSpeechServiceImp implements TextToSpeechService { await textToSpeechInstance.setEngine(ttsGoogleEngine); } + await textToSpeechInstance.setVoice(arabicVoice); + if (isMute) { textToSpeechInstance.setVolume(0.0); } else { diff --git a/lib/utilities/extensions.dart b/lib/utilities/extensions.dart index de4e94a..307c365 100644 --- a/lib/utilities/extensions.dart +++ b/lib/utilities/extensions.dart @@ -38,11 +38,9 @@ extension NavigationExt on BuildContext { navigateReplaceTo(String route) { Navigator.pushReplacementNamed(this, route); } - navigateTo(String route) { Navigator.pushNamed(this, route); } - popScreen() => Navigator.of(this).pop(); } @@ -50,18 +48,18 @@ extension ScreenOrientationExt on ScreenOrientationEnum { int getTurnsByOrientation() { switch (this) { case ScreenOrientationEnum.portraitUp: - return 0; + return 1; case ScreenOrientationEnum.portraitDown: - return 2; + return 3; case ScreenOrientationEnum.landscapeRight: - return 1; + return 2; case ScreenOrientationEnum.landscapeLeft: - return 3; + return 4; default: return 0; } } -} +} extension QTypeEnumExtension on int { QTypeEnum toQTypeEnum() { diff --git a/lib/views/main_queue_screen/main_queue_screen.dart b/lib/views/main_queue_screen/main_queue_screen.dart index cdc50b4..74e3264 100644 --- a/lib/views/main_queue_screen/main_queue_screen.dart +++ b/lib/views/main_queue_screen/main_queue_screen.dart @@ -1,12 +1,9 @@ -import 'dart:developer'; import 'package:flutter/material.dart'; -import 'package:hmg_qline/config/dependency_injection.dart'; import 'package:hmg_qline/constants/app_constants.dart'; import 'package:hmg_qline/utilities/enums.dart'; import 'package:hmg_qline/utilities/extensions.dart'; import 'package:hmg_qline/utilities/lifecycle_handler.dart'; -import 'package:hmg_qline/utilities/native_method_handler.dart'; import 'package:hmg_qline/view_models/queuing_view_model.dart'; import 'package:hmg_qline/view_models/screen_config_view_model.dart'; import 'package:hmg_qline/views/common_widgets/app_footer.dart'; @@ -174,7 +171,6 @@ class _MainQueueScreenState extends State { //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(), child: AppScaffold( diff --git a/pubspec.lock b/pubspec.lock index 8bd602b..7348769 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -61,10 +61,10 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.19.0" connectivity_plus: dependency: "direct main" description: @@ -268,18 +268,18 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.7" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "3.0.8" leak_tracker_testing: dependency: transitive description: @@ -564,7 +564,7 @@ packages: dependency: transitive description: flutter source: sdk - version: "0.0.99" + version: "0.0.0" source_span: dependency: transitive description: @@ -593,10 +593,10 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.12.0" stream_channel: dependency: transitive description: @@ -609,10 +609,10 @@ packages: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.0" synchronized: dependency: transitive description: @@ -633,10 +633,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.7.3" tuple: dependency: transitive description: @@ -697,10 +697,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b url: "https://pub.dev" source: hosted - version: "14.2.5" + version: "14.3.0" wakelock_plus: dependency: "direct main" description: