From 9ff303d514a5a55059f46221d5e34837cc9f5cd6 Mon Sep 17 00:00:00 2001 From: Sultan khan Date: Tue, 14 Apr 2026 15:37:54 +0300 Subject: [PATCH] fixes and updates. --- lib/core/utils/push_notification_handler.dart | 17 ++++++++++++----- .../widgets/appointment_doctor_card.dart | 2 +- lib/presentation/authentication/login.dart | 3 ++- .../widgets/medical_file_appointment_card.dart | 5 +++-- .../symptoms_checker/triage_screen.dart | 2 +- lib/splashPage.dart | 15 +++++++++++++-- lib/widgets/language_switcher.dart | 6 ++++-- 7 files changed, 36 insertions(+), 14 deletions(-) diff --git a/lib/core/utils/push_notification_handler.dart b/lib/core/utils/push_notification_handler.dart index 6fc248f9..770961de 100644 --- a/lib/core/utils/push_notification_handler.dart +++ b/lib/core/utils/push_notification_handler.dart @@ -51,12 +51,15 @@ _incomingCall(Map data) async { // GetIt.instance().saveString(key: CacheConst.zoomRoomID, value: roomID); // GetIt.instance().saveBool(key: CacheConst.isAppOpenedFromCall, value: true); - Utils.saveStringFromPrefs(CacheConst.zoomRoomID, roomID); - Utils.saveStringFromPrefs(CacheConst.callTypeID, callTypeID); - Utils.saveBoolFromPrefs(CacheConst.isAppOpenedFromCall, true); + await Utils.saveStringFromPrefs(CacheConst.zoomRoomID, roomID); + await Utils.saveStringFromPrefs(CacheConst.callTypeID, callTypeID); + await Utils.saveBoolFromPrefs(CacheConst.isAppOpenedFromCall, true); + WidgetsFlutterBinding.ensureInitialized(); + int callKitType = callTypeID == '2' ? 0 : 1; + var _currentUuid = Uuid().v4(); CallKitParams callKitParams = CallKitParams( id: _currentUuid, @@ -64,7 +67,7 @@ _incomingCall(Map data) async { appName: 'Dr Al Habib', avatar: 'https://play-lh.googleusercontent.com/FBNNpxb7m6eM6wtW7MV1Ffp6OXOGLI38q47zcvP29OCYA1yhYH5mZzl5itZi0TgOyZpG', // handle: LandingPage.incomingCallData.name, - type: 1, + type: callKitType, textAccept: 'Accept', textDecline: 'Decline', missedCallNotification: NotificationParams( @@ -80,7 +83,11 @@ _incomingCall(Map data) async { callbackText: 'Hang Up', ), duration: 30000, - extra: {'userId': '1a2b3c4d'}, + extra: { + 'userId': '1a2b3c4d', + 'callTypeID': callTypeID, // Store actual callTypeID here + 'roomID': roomID, // Store roomID here for backup + }, headers: {'apiKey': 'Abc@123!', 'platform': 'flutter'}, android: const AndroidParams( isImportant: true, diff --git a/lib/presentation/appointments/widgets/appointment_doctor_card.dart b/lib/presentation/appointments/widgets/appointment_doctor_card.dart index 0e4e2aeb..05358243 100644 --- a/lib/presentation/appointments/widgets/appointment_doctor_card.dart +++ b/lib/presentation/appointments/widgets/appointment_doctor_card.dart @@ -151,7 +151,7 @@ class AppointmentDoctorCard extends StatelessWidget { ), ), - patientAppointmentHistoryResponseModel.isLiveCareAppointment! || patientAppointmentHistoryResponseModel.isClinicReBookingAllowed! || patientAppointmentHistoryResponseModel.isActiveDoctor! == false + patientAppointmentHistoryResponseModel.isLiveCareAppointment! || patientAppointmentHistoryResponseModel.isClinicReBookingAllowed! ==false || patientAppointmentHistoryResponseModel.isActiveDoctor! == false ? SizedBox.shrink() : Utils.buildSvgWithAssets(icon: AppAssets.doctor_profile_icon, width: 20.h, height: 20.h, fit: BoxFit.scaleDown).onPress(() async { DoctorsListResponseModel selectedDoctor = DoctorsListResponseModel(); diff --git a/lib/presentation/authentication/login.dart b/lib/presentation/authentication/login.dart index b2979235..e15b62bb 100644 --- a/lib/presentation/authentication/login.dart +++ b/lib/presentation/authentication/login.dart @@ -70,7 +70,8 @@ class LoginScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Utils.showLottie(context: context, assetPath: AppAnimations.login, width: 200.h, height: 200.h, repeat: true, fit: BoxFit.cover), - SizedBox(height: 130.h), // Adjusted to sizer unit + // SizedBox(height: 130.h), + SizedBox(height: MediaQuery.of(context).size.height * 0.12), // based on the screen height Adjusted to sizer unit LocaleKeys.welcomeToDrSulaiman.tr(context: context).toText32(isBold: true, color: AppColors.textColor ), SizedBox(height: 32.h), Localizations.override(context: context, locale: Locale('en', 'US'), child: Container()), // Force English locale for this widget diff --git a/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart b/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart index 2e769609..a67a6765 100644 --- a/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart +++ b/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart @@ -350,7 +350,8 @@ class _MedicalFileAppointmentCardState extends State ), SizedBox(height: 24.h), // Countdown Timer - DD : HH : MM : SS format with labels - Row( + Directionality( + textDirection: ui.TextDirection.ltr, child:Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -378,7 +379,7 @@ class _MedicalFileAppointmentCardState extends State LocaleKeys.seconds.tr(context: context), ), ], - ), + )), SizedBox(height: 24.h), // Green Acknowledge button with checkmark icon CustomButton( diff --git a/lib/presentation/symptoms_checker/triage_screen.dart b/lib/presentation/symptoms_checker/triage_screen.dart index c9291275..58c03db2 100644 --- a/lib/presentation/symptoms_checker/triage_screen.dart +++ b/lib/presentation/symptoms_checker/triage_screen.dart @@ -80,7 +80,7 @@ class _TriagePageState extends State { } // Case 2: Should stop flag is true OR Case 3: Probability >= 70% OR Case 4: 7 or more questions answered - if (viewModel.shouldStopTriage || highestProbability >= 70.0 || viewModel.triageQuestionCount >= 15) { + if (viewModel.shouldStopTriage || highestProbability >= 70.0 || viewModel.triageQuestionCount >= 30) { // Navigate to results/possible conditions screen context.navigateWithName(AppRoutes.possibleConditionsPage); return; diff --git a/lib/splashPage.dart b/lib/splashPage.dart index f17d8bc3..c7be036f 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -79,10 +79,9 @@ class _SplashScreenState extends State { } navigateToTeleConsult() async { + String roomID = await Utils.getStringFromPrefs(CacheConst.zoomRoomID); String callTypeID = await Utils.getStringFromPrefs(CacheConst.callTypeID); - print('RoomID: $roomID'); - print('callTypeID: $callTypeID'); // GetIt.instance().remove(key: CacheConst.isAppOpenedFromCall); Utils.removeFromPrefs(CacheConst.isAppOpenedFromCall); @@ -116,6 +115,18 @@ class _SplashScreenState extends State { print('actionCallAccept Event Received: ------->'); FlutterCallkitIncoming.endAllCalls(); try { + // Get callTypeID and roomID from event's extra data + String? eventCallTypeID = event.body['extra']?['callTypeID']; + String? eventRoomID = event.body['extra']?['roomID']; + + // Re-save to SharedPreferences to ensure they're available + if (eventCallTypeID != null && eventCallTypeID.isNotEmpty) { + await Utils.saveStringFromPrefs(CacheConst.callTypeID, eventCallTypeID); + } + if (eventRoomID != null && eventRoomID.isNotEmpty) { + await Utils.saveStringFromPrefs(CacheConst.zoomRoomID, eventRoomID); + } + navigateToTeleConsult(); // String roomID = await Utils.getStringFromPrefs(SharedPrefsConsts.ZOOM_ROOM_ID); // String roomPass = await Utils.getStringFromPrefs(SharedPrefsConsts.ZOOM_ROOM_PASS); diff --git a/lib/widgets/language_switcher.dart b/lib/widgets/language_switcher.dart index 3ee10df3..15237363 100644 --- a/lib/widgets/language_switcher.dart +++ b/lib/widgets/language_switcher.dart @@ -56,8 +56,7 @@ class _LanguageSelectorState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - Utils.buildSvgWithAssets(icon: AppAssets.language), - SizedBox(width: 6.h), + Text( // currentLangData['name']?.toUpperCase() ?? 'EN', widget.currentLanguage == 'ar' ? "ENGLISH" : "العربية", @@ -69,6 +68,9 @@ class _LanguageSelectorState extends State { isLanguageSwitcher: true, fontFamily: widget.currentLanguage == 'ar' ? "Poppins" : "CairoArabic"), ), + SizedBox(width: 6.h), + Utils.buildSvgWithAssets(icon: AppAssets.language), + ], ), ),