From 814b0ccd58c69d14eed415fa2a610808116fdcec Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 13 Aug 2026 10:45:33 +0300 Subject: [PATCH] Updates --- lib/core/utils/utils.dart | 39 +++++++++++++++++-- .../my_appointments_view_model.dart | 6 ++- .../medical_file/medical_file_page.dart | 2 +- lib/services/livecare_permission_service.dart | 6 +-- lib/splashPage.dart | 5 ++- pubspec.yaml | 7 ++-- 6 files changed, 52 insertions(+), 13 deletions(-) diff --git a/lib/core/utils/utils.dart b/lib/core/utils/utils.dart index 320bd1cf..6d04fbc9 100644 --- a/lib/core/utils/utils.dart +++ b/lib/core/utils/utils.dart @@ -1057,9 +1057,42 @@ class Utils { return isHavePrivilege; } - static void openWebView({required String url}) { - Uri uri = Uri.parse(url); - launchUrl(uri, mode: LaunchMode.inAppBrowserView); + static Future openWebView({required String url}) async { + try { + Uri uri = Uri.parse(url); + + // Validate URL scheme for in-app browser + if (!uri.hasScheme || (!uri.scheme.startsWith('http'))) { + throw 'Invalid URL scheme. In-app browser only supports HTTP/HTTPS URLs'; + } + + // Check if URL can be launched + if (await canLaunchUrl(uri)) { + final launched = await launchUrl( + uri, + mode: LaunchMode.externalApplication, + ); + + if (!launched) { + // Fallback to external browser + await launchUrl(uri, mode: LaunchMode.externalApplication); + } + } else { + // Fallback to external browser + await launchUrl(uri, mode: LaunchMode.externalApplication); + } + } catch (e) { + debugPrint('❌ Failed to open URL: $url - Error: $e'); + + // Try external browser as last resort + try { + final uri = Uri.parse(url); + await launchUrl(uri, mode: LaunchMode.externalApplication); + } catch (e2) { + debugPrint('❌ Failed to open URL in external browser: $e2'); + // Optionally show user-friendly error message + } + } } static Color getCardBorderColor(int currentQueueStatus) { diff --git a/lib/features/my_appointments/my_appointments_view_model.dart b/lib/features/my_appointments/my_appointments_view_model.dart index 832d94fe..b153c556 100644 --- a/lib/features/my_appointments/my_appointments_view_model.dart +++ b/lib/features/my_appointments/my_appointments_view_model.dart @@ -771,7 +771,11 @@ class MyAppointmentsViewModel extends ChangeNotifier { } else if (apiResponse.messageStatus == 1) { patientMyDoctorsList = apiResponse.data!; isPatientMyDoctorsLoading = false; - isMyDoctorsDataToBeLoaded = false; + + if (!isTop8) { + isMyDoctorsDataToBeLoaded = false; + } + notifyListeners(); if (onSuccess != null) { onSuccess(apiResponse); diff --git a/lib/presentation/medical_file/medical_file_page.dart b/lib/presentation/medical_file/medical_file_page.dart index cdee10db..cb3f7072 100644 --- a/lib/presentation/medical_file/medical_file_page.dart +++ b/lib/presentation/medical_file/medical_file_page.dart @@ -1063,7 +1063,7 @@ class _MedicalFilePageState extends State { ], ).onPress(() { // myAppointmentsViewModel.getPatientMyDoctors(); - myAppointmentsViewModel.setIsMyDoctorsDataToBeLoaded(true); + // myAppointmentsViewModel.setIsMyDoctorsDataToBeLoaded(true); Navigator.of(context).push( CustomPageRoute( page: MyDoctorsPage(), diff --git a/lib/services/livecare_permission_service.dart b/lib/services/livecare_permission_service.dart index bc5f2eef..52a4cc24 100644 --- a/lib/services/livecare_permission_service.dart +++ b/lib/services/livecare_permission_service.dart @@ -31,14 +31,14 @@ class LiveCarePermissionService { Permission.camera, Permission.microphone, Permission.notification, - if (Platform.isAndroid) Permission.systemAlertWindow, + // if (Platform.isAndroid) Permission.systemAlertWindow, ] : [ // Permission.camera, // Permission.microphone, Permission.notification, - if (Platform.isAndroid) Permission.systemAlertWindow, - ]; + // if (Platform.isAndroid) Permission.systemAlertWindow, + ]; try { final statuses = await permissions.request(); diff --git a/lib/splashPage.dart b/lib/splashPage.dart index dc49428a..7407ffec 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -16,6 +16,7 @@ import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart'; +import 'package:hmg_patient_app_new/presentation/home/app_update_page.dart'; import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/presentation/onboarding/onboarding_screen.dart'; import 'package:hmg_patient_app_new/presentation/onboarding/splash_animation_screen.dart'; @@ -71,10 +72,10 @@ class _SplashScreenState extends State { } else { if (await Utils.getBoolFromPrefs(CacheConst.firstLaunch)) { // Navigator.of(context).pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: OnboardingScreen()))); - Navigator.of(context).pushReplacement(FadePage(page: OnboardingScreen())); + Navigator.of(getIt.get().navigatorKey.currentContext!).pushReplacement(FadePage(page: OnboardingScreen())); } else { // Navigator.of(context).pushReplacement(FadePage(page: SplashAnimationScreen(routeWidget: LandingNavigation()))); - Navigator.of(context).pushReplacement(FadePage(page: LandingNavigation())); + Navigator.of(getIt.get().navigatorKey.currentContext!).pushReplacement(FadePage(page: LandingNavigation())); } } }); diff --git a/pubspec.yaml b/pubspec.yaml index 9a05eb01..6ca96768 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,8 +2,8 @@ name: hmg_patient_app_new description: "New HMG Patient App" publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 0.0.44+45 -#version: 0.0.14+1 +#version: 0.0.45+46 +version: 0.0.14+3 environment: sdk: ">=3.6.0 <4.0.0" @@ -63,7 +63,8 @@ dependencies: geolocator: ^14.0.2 dropdown_search: ^6.0.2 google_maps_flutter: ^2.13.1 - flutter_zoom_videosdk: 2.1.10 + # flutter_zoom_videosdk: 2.1.10 + flutter_zoom_videosdk: ^2.5.10 dart_jsonwebtoken: ^3.2.0 dartz: ^0.10.1 equatable: ^2.0.7