From 7a528aff4d65e28984508281a0706bceea8837fe Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 6 Aug 2026 16:56:14 +0300 Subject: [PATCH] updates --- lib/core/api/api_client.dart | 6 +- lib/core/api_consts.dart | 3 +- lib/core/app_state.dart | 2 +- lib/core/utils/push_notification_handler.dart | 29 +++++- .../hmg_services/services_page.dart | 94 ++++++++++--------- pubspec.yaml | 5 +- 6 files changed, 83 insertions(+), 56 deletions(-) diff --git a/lib/core/api/api_client.dart b/lib/core/api/api_client.dart index 4db0cf8b..20bb8ce4 100644 --- a/lib/core/api/api_client.dart +++ b/lib/core/api/api_client.dart @@ -224,9 +224,9 @@ class ApiClientImp implements ApiClient { // body['PatientID'] = 809289; } - if (!url.contains("/paymentApi")) { - body['IsNewFlutterApp'] = true; - } + // if (!url.contains("/paymentApi")) { + // body['IsNewFlutterApp'] = true; + // } body.removeWhere((key, value) => value == null); } diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index 8f1455ad..9fe39f06 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -301,7 +301,8 @@ class ApiConsts { static String googleCloudStorageENTranslationFileBaseURL = "https://storage.googleapis.com/hmg-patientapp-translations"; // ************ static values for Api **************** - static final double appVersionID = 21.7; + // static final double appVersionID = 21.7; + static final double appVersionID = 20.8; // static final double appVersionID = 50.7; static final int appChannelId = 3; diff --git a/lib/core/app_state.dart b/lib/core/app_state.dart index a27b727e..6141db10 100644 --- a/lib/core/app_state.dart +++ b/lib/core/app_state.dart @@ -63,7 +63,7 @@ class AppState { bool isChildLoggedIn = false; bool isGMSAvailable = true; bool isAndroid = true; - bool isRatedVisible =false; + bool isRatedVisible = false; void setAuthenticatedUser(AuthenticatedUser? authenticatedUser, {bool isFamily = false}) { if (isFamily) { _authenticatedChildUser = authenticatedUser; diff --git a/lib/core/utils/push_notification_handler.dart b/lib/core/utils/push_notification_handler.dart index 89f6969a..42d384c0 100644 --- a/lib/core/utils/push_notification_handler.dart +++ b/lib/core/utils/push_notification_handler.dart @@ -27,6 +27,7 @@ import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:uuid/uuid.dart'; +import 'package:huawei_push/huawei_push.dart' as h_push; // Global tracking variables for call state bool _isCallInProgress = false; @@ -425,10 +426,30 @@ class PushNotificationHandler { if (Platform.isAndroid) { try { - final fcmToken = await FirebaseMessaging.instance.getToken().catchError((err) { - log(err); - }); - if (fcmToken != null) onToken(fcmToken); + if (!(await Utils.isGoogleServicesAvailable())) { + h_push.Push.enableLogger(); + final result = await h_push.Push.setAutoInitEnabled(true); + + h_push.Push.onNotificationOpenedApp.listen((message) { + // newMessage(toFirebaseRemoteMessage(message)); + }, onError: (e) => print(e.toString())); + + h_push.Push.onMessageReceivedStream.listen((message) { + // newMessage(toFirebaseRemoteMessage(message)); + }, onError: (e) => print(e.toString())); + + h_push.Push.getTokenStream.listen((token) { + onToken(token); + }, onError: (e) => print(e.toString())); + h_push.Push.getToken(''); + + h_push.Push.registerBackgroundMessageHandler(backgroundMessageHandler); + } else { + final fcmToken = await FirebaseMessaging.instance.getToken().catchError((err) { + log(err); + }); + if (fcmToken != null) onToken(fcmToken); + } // } } catch (ex) { log("Notification Exception: $ex"); diff --git a/lib/presentation/hmg_services/services_page.dart b/lib/presentation/hmg_services/services_page.dart index 75144cf7..582fd6fc 100644 --- a/lib/presentation/hmg_services/services_page.dart +++ b/lib/presentation/hmg_services/services_page.dart @@ -1,6 +1,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; +import 'package:get_it/get_it.dart'; import 'package:hmg_patient_app_new/core/api_consts.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; @@ -13,8 +14,10 @@ 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/features/blood_donation/blood_donation_view_model.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; +import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart'; import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/ui_models/hmg_services_component_model.dart'; +import 'package:hmg_patient_app_new/features/hospital/hospital_selection_view_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart'; import 'package:hmg_patient_app_new/features/weather/weather_view_model.dart'; @@ -45,6 +48,7 @@ import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; import '../../core/dependencies.dart'; +import '../emergency_services/call_ambulance/widgets/HospitalBottomSheetBody.dart'; class ServicesPage extends StatefulWidget { final bool showBackIcon; @@ -116,51 +120,51 @@ class _ServicesPageState extends State { ); } }), - // HmgServicesComponentModel( - // 11, - // LocaleKeys.indoorNavigation.tr(), - // "", - // AppAssets.indoor_nav_icon, - // bgColor: Color(0xff45A2F8), - // true, - // route: null, - // onTap: () { - // showCommonBottomSheetWithoutHeight( - // title: LocaleKeys.selectHospital.tr(), - // GetIt.instance().navigatorKey.currentContext!, - // child: ChangeNotifierProvider( - // create: (context) => HospitalSelectionBottomSheetViewModel(getIt()), - // child: Consumer( - // builder: (_, vm, __) => HospitalBottomSheetBody( - // searchText: vm.searchController, - // displayList: vm.displayList, - // onFacilityClicked: (value) { - // vm.setSelectedFacility(value); - // vm.getDisplayList(); - // }, - // onHospitalClicked: (hospital) { - // Navigator.pop(GetIt.instance().navigatorKey.currentContext!); - // vm.openPenguin(hospital); - // }, - // onHospitalSearch: (value) { - // vm.searchHospitals(value ?? ""); - // }, - // selectedFacility: vm.selectedFacility, - // hmcCount: vm.hmcCount, - // hmgCount: vm.hmgCount, - // ), - // ), - // ), - // isFullScreen: false, - // isCloseButtonVisible: true, - // hasBottomPadding: false, - // backgroundColor: AppColors.bottomSheetBgColor, - // callBackFunc: () { - // GetIt.instance().navigatorKey.currentContext!.read().clearSearchText(); - // }, - // ); - // }, - // ), + HmgServicesComponentModel( + 11, + LocaleKeys.indoorNavigation.tr(), + "", + AppAssets.indoor_nav_icon, + bgColor: Color(0xff45A2F8), + true, + route: null, + onTap: () { + showCommonBottomSheetWithoutHeight( + title: LocaleKeys.selectHospital.tr(), + GetIt.instance().navigatorKey.currentContext!, + child: ChangeNotifierProvider( + create: (context) => HospitalSelectionBottomSheetViewModel(getIt()), + child: Consumer( + builder: (_, vm, __) => HospitalBottomSheetBody( + searchText: vm.searchController, + displayList: vm.displayList, + onFacilityClicked: (value) { + vm.setSelectedFacility(value); + vm.getDisplayList(); + }, + onHospitalClicked: (hospital) { + Navigator.pop(GetIt.instance().navigatorKey.currentContext!); + vm.openPenguin(hospital); + }, + onHospitalSearch: (value) { + vm.searchHospitals(value ?? ""); + }, + selectedFacility: vm.selectedFacility, + hmcCount: vm.hmcCount, + hmgCount: vm.hmgCount, + ), + ), + ), + isFullScreen: false, + isCloseButtonVisible: true, + hasBottomPadding: false, + backgroundColor: AppColors.bottomSheetBgColor, + callBackFunc: () { + GetIt.instance().navigatorKey.currentContext!.read().clearSearchText(); + }, + ); + }, + ), HmgServicesComponentModel( 11, LocaleKeys.eReferralServices.tr(), "", AppAssets.eReferral, bgColor: AppColors.eReferralCardColor, true, route: null, onTap: () async { if (getIt.get().isAuthenticated) { diff --git a/pubspec.yaml b/pubspec.yaml index 006aca7f..201290ab 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.39+38 -#version: 0.0.8+1 +#version: 4.6.037+1 +version: 4.6.0992+40500992 environment: sdk: ">=3.6.0 <4.0.0" @@ -100,6 +100,7 @@ dependencies: intl: ^0.20.2 flutter_widget_from_html: ^0.17.1 huawei_map: ^6.12.0+301 + huawei_push: ^6.15.0+300 flutter_image_compress: ^2.3.0 scrollable_positioned_list: ^0.3.8 in_app_review: ^2.0.11