diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 4f51f820..c33e3713 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -87,7 +87,7 @@
NSMicrophoneUsageDescription
This app requires microphone access to enable virtual consultation between patient & doctor
NSMotionUsageDescription
- This app requires motion detection access to function properly.
+ This app uses motion data to count your daily steps.
NSPhotoLibraryAddUsageDescription
This app requires photo library access to upload profile picture and documents.
NSPhotoLibraryUsageDescription
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..3a63703d 100644
--- a/lib/core/api_consts.dart
+++ b/lib/core/api_consts.dart
@@ -5,7 +5,7 @@ import 'package:hmg_patient_app_new/core/enums.dart';
class ApiConsts {
static const maxSmallScreen = 660;
- static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod;
+ static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.preProd;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT
@@ -48,6 +48,7 @@ class ApiConsts {
switch (appEnvironmentType) {
case AppEnvironmentTypeEnum.prod:
baseUrl = "https://hmgwebservices.com/";
+ // baseUrl = "http://10.200.204.42/";
payFortEnvironment = FortEnvironment.production;
payFortEnvironmentType = EnvironmentType.production;
applePayMerchantId = "merchant.com.hmgwebservices";
@@ -301,7 +302,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.8;
+ 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/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart
index fdc16943..7688cfa4 100644
--- a/lib/features/authentication/authentication_view_model.dart
+++ b/lib/features/authentication/authentication_view_model.dart
@@ -980,15 +980,15 @@ class AuthenticationViewModel extends ChangeNotifier {
// TODO: GET APP SMS SIGNATURE HERE
request.sMSSignature = await getSignature();
- if(!kDebugMode) {
- // Get Turnstile token if configured
- final turnstileToken = await _turnstileService.getTurnstileToken();
- if (turnstileToken != null) {
- request.turnstileToken = turnstileToken;
- } else {
- request.turnstileToken = "";
- }
- }
+ // if(!kDebugMode) {
+ // // Get Turnstile token if configured
+ // final turnstileToken = await _turnstileService.getTurnstileToken();
+ // if (turnstileToken != null) {
+ // request.turnstileToken = turnstileToken;
+ // } else {
+ // request.turnstileToken = "";
+ // }
+ // }
if (isNeedLoading) {
LoaderBottomSheet.showLoader();
diff --git a/lib/main.dart b/lib/main.dart
index 6dea911a..413cb89f 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -371,6 +371,7 @@ class MyApp extends StatelessWidget {
darkTheme: AppTheme.getDarkTheme(isArabic),
themeMode: profileVm.isDarkMode ? ThemeMode.dark : ThemeMode.light,
navigatorKey: getIt.get().navigatorKey,
+ navigatorObservers: [getIt.get().routeObserver],
);
},
);
diff --git a/lib/presentation/appointments/widgets/appointment_card.dart b/lib/presentation/appointments/widgets/appointment_card.dart
index e98eda82..91ebaa14 100644
--- a/lib/presentation/appointments/widgets/appointment_card.dart
+++ b/lib/presentation/appointments/widgets/appointment_card.dart
@@ -14,6 +14,7 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart';
import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctors_list_response_model.dart';
+import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/get_clinic_list_response_model.dart';
import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
@@ -677,7 +678,15 @@ class _AppointmentCardState extends State {
projectName: widget.patientAppointmentHistoryResponseModel.projectName,
);
+ final clinic = GetClinicsListResponseModel(
+ clinicID: widget.patientAppointmentHistoryResponseModel.clinicID,
+ clinicDescription: widget.patientAppointmentHistoryResponseModel.clinicName,
+ clinicDescriptionN: widget.patientAppointmentHistoryResponseModel.clinicName,
+ );
+
widget.bookAppointmentsViewModel.setSelectedDoctor(doctor);
+ widget.bookAppointmentsViewModel.setSelectedClinic(clinic);
+
LoaderBottomSheet.showLoader();
await widget.bookAppointmentsViewModel.getDoctorFreeSlots(
diff --git a/lib/presentation/authentication/saved_login_screen.dart b/lib/presentation/authentication/saved_login_screen.dart
index 19080ae8..bea93d36 100644
--- a/lib/presentation/authentication/saved_login_screen.dart
+++ b/lib/presentation/authentication/saved_login_screen.dart
@@ -16,6 +16,7 @@ import 'package:hmg_patient_app_new/features/authentication/authentication_view_
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/authentication/login.dart';
import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart';
+import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/appbar/app_bar_widget.dart';
import 'package:hmg_patient_app_new/widgets/bottomsheet/generic_bottom_sheet.dart';
@@ -30,11 +31,24 @@ class SavedLogin extends StatefulWidget {
_SavedLogin createState() => _SavedLogin();
}
-class _SavedLogin extends State {
+class _SavedLogin extends State with RouteAware {
LoginTypeEnum loginType = LoginTypeEnum.sms;
late AuthenticationViewModel authVm;
late AppState appState;
bool? isOther;
+ PageRoute? _pageRoute;
+
+ void _assignSavedLoginData() {
+ authVm.phoneNumberController.text = appState.getSelectDeviceByImeiRespModelElement!.mobile!.startsWith("0")
+ ? appState.getSelectDeviceByImeiRespModelElement!.mobile!.replaceFirst("0", "")
+ : appState.getSelectDeviceByImeiRespModelElement!.mobile!;
+ authVm.nationalIdController.text = appState.getSelectDeviceByImeiRespModelElement!.identificationNo!;
+
+ if (isOther == true) {
+ authVm.phoneNumberController.text = appState.getSelectDeviceByImeiRespModelElement!.mobile!;
+ authVm.selectedCountrySignup = CountryEnum.others;
+ }
+ }
@override
void initState() {
@@ -43,19 +57,10 @@ class _SavedLogin extends State {
appState = getIt.get();
loginType = LoginTypeExtension.fromValue(appState.getSelectDeviceByImeiRespModelElement!.logInType!)!;
- authVm.phoneNumberController.text = appState.getSelectDeviceByImeiRespModelElement!.mobile!.startsWith("0")
- ? appState.getSelectDeviceByImeiRespModelElement!.mobile!.replaceFirst("0", "")
- : appState.getSelectDeviceByImeiRespModelElement!.mobile!;
- authVm.nationalIdController.text = appState.getSelectDeviceByImeiRespModelElement!.identificationNo!;
-
// Check if this is an "Others" country user
isOther = appState.getSelectDeviceByImeiRespModelElement!.isOther == true;
- // Set country to Others if isOther flag is true - this ensures _Others APIs are called
- if (isOther!) {
- authVm.phoneNumberController.text = appState.getSelectDeviceByImeiRespModelElement!.mobile!;
- authVm.selectedCountrySignup = CountryEnum.others;
- }
+ _assignSavedLoginData();
if (loginType == LoginTypeEnum.fingerprint || loginType == LoginTypeEnum.face) {
authVm.loginWithFingerPrintFace(() {});
@@ -63,6 +68,30 @@ class _SavedLogin extends State {
super.initState();
}
+ @override
+ void didChangeDependencies() {
+ super.didChangeDependencies();
+ final route = ModalRoute.of(context);
+ if (route is PageRoute && route != _pageRoute) {
+ if (_pageRoute != null) {
+ getIt.get().routeObserver.unsubscribe(this);
+ }
+ _pageRoute = route;
+ getIt.get().routeObserver.subscribe(this, route);
+ }
+ }
+
+ @override
+ void didPopNext() {
+ _assignSavedLoginData();
+ }
+
+ @override
+ void dispose() {
+ getIt.get().routeObserver.unsubscribe(this);
+ super.dispose();
+ }
+
@override
Widget build(BuildContext context) {
return Scaffold(
diff --git a/lib/presentation/book_appointment/doctor_profile_page.dart b/lib/presentation/book_appointment/doctor_profile_page.dart
index 6be110ec..a3b4aa48 100644
--- a/lib/presentation/book_appointment/doctor_profile_page.dart
+++ b/lib/presentation/book_appointment/doctor_profile_page.dart
@@ -8,6 +8,7 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart';
+import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/get_clinic_list_response_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appointment_calendar.dart';
@@ -240,6 +241,14 @@ class DoctorProfilePage extends StatelessWidget {
bookAppointmentsViewModel.selectedDoctor.clinicName = bookAppointmentsViewModel.doctorsProfileResponseModel.clinicDescription;
bookAppointmentsViewModel.selectedDoctor.projectName = bookAppointmentsViewModel.doctorsProfileResponseModel.projectName;
+ final clinic = GetClinicsListResponseModel(
+ clinicID: bookAppointmentsViewModel.doctorsProfileResponseModel.clinicID,
+ clinicDescription: bookAppointmentsViewModel.doctorsProfileResponseModel.clinicDescription,
+ clinicDescriptionN: bookAppointmentsViewModel.doctorsProfileResponseModel.clinicDescription,
+ );
+
+ bookAppointmentsViewModel.setSelectedClinic(clinic);
+
LoaderBottomSheet.showLoader();
bookAppointmentsViewModel.isLiveCareSchedule
? await bookAppointmentsViewModel.getLiveCareDoctorFreeSlots(
diff --git a/lib/presentation/book_appointment/widgets/appointment_calendar.dart b/lib/presentation/book_appointment/widgets/appointment_calendar.dart
index 11092c79..bc6e214c 100644
--- a/lib/presentation/book_appointment/widgets/appointment_calendar.dart
+++ b/lib/presentation/book_appointment/widgets/appointment_calendar.dart
@@ -268,7 +268,7 @@ class _AppointmentCalendarState extends State {
),
);
} else {
- if (bookAppointmentsViewModel.selectedClinic.clinicID! == 17 && bookAppointmentsViewModel.selectedChiefComplaintID == 0) {
+ if (bookAppointmentsViewModel.selectedClinic.clinicID == 17 && bookAppointmentsViewModel.selectedChiefComplaintID == 0) {
GetClinicsListResponseModel selectedClinic = GetClinicsListResponseModel(
clinicID: bookAppointmentsViewModel.selectedClinic.clinicID,
clinicDescription: bookAppointmentsViewModel.selectedClinic.clinicDescription,
diff --git a/lib/presentation/hmg_services/services_page.dart b/lib/presentation/hmg_services/services_page.dart
index d931e189..bdc69300 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/lib/services/navigation_service.dart b/lib/services/navigation_service.dart
index a83d4e3d..018e46b6 100644
--- a/lib/services/navigation_service.dart
+++ b/lib/services/navigation_service.dart
@@ -6,6 +6,7 @@ import 'package:hmg_patient_app_new/routes/app_routes.dart';
class NavigationService {
final GlobalKey navigatorKey = GlobalKey();
+ final RouteObserver> routeObserver = RouteObserver>();
BuildContext? get context => navigatorKey.currentContext;
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