App update page implemented

haroon_dev
haroon amjad 4 days ago
parent c6ee3c453f
commit 8309f311e6

@ -1575,5 +1575,6 @@
"loadingAIAnalysis": "جارٍ تحليل نتائج المختبر، يرجى التحلي بالصبر والسماح للذكاء الاصطناعي بالقيام بالمهمة، قد يستغرق هذا بعض الوقت.",
"symptoms": "أعراض",
"insuranceInActive": "التأمين غير نشط",
"insuranceInActiveContactSupport": "لديك تأمين ساري المفعول، ولكنه غير مُفعّل حاليًا في مجموعة حبيب الطبية. يُرجى التواصل مع خدمة عملاء مجموعة حبيب الطبية."
"insuranceInActiveContactSupport": "لديك تأمين ساري المفعول، ولكنه غير مُفعّل حاليًا في مجموعة حبيب الطبية. يُرجى التواصل مع خدمة عملاء مجموعة حبيب الطبية.",
"updateAppNow": "تحديث التطبيق الآن"
}

@ -1566,5 +1566,6 @@
"loadingAIAnalysis": "Analysing your lab results, Please be patient and let the AI do the magic, This might take some time.",
"symptoms": "Symptoms",
"insuranceInActive": "Insurance Inactive",
"insuranceInActiveContactSupport": "You have a valid insurance but it is currently inactive in HMG. Please contact HMG customer support to activate it."
"insuranceInActiveContactSupport": "You have a valid insurance but it is currently inactive in HMG. Please contact HMG customer support to activate it.",
"updateAppNow": "Update App Now"
}

@ -7,9 +7,11 @@ import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
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/presentation/home/app_update_page.dart';
import 'package:hmg_patient_app_new/routes/app_routes.dart';
import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:http/http.dart' as http;
import '../exceptions/api_failure.dart';
@ -198,9 +200,9 @@ class ApiClientImp implements ApiClient {
// body['PatientOutSA'] = 0;
// body['SessionID'] = "45786230487560q";
body['IdentificationNo'] = "2235558844";
body['MobileNo'] = "966533147722";
body['PatientID'] = 809289;
// body['IdentificationNo'] = "2235558844";
// body['MobileNo'] = "966533147722";
// body['PatientID'] = 809289;
}
if(!url.contains("/paymentApi")) {
@ -251,8 +253,16 @@ class ApiClientImp implements ApiClient {
} else {
if (parsed['ErrorType'] == 4) {
//TODO : handle app update
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode,
failureType: AppUpdateFailure("parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']"));
// onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode,
// failureType: AppUpdateFailure("parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']"));
ApiClient._navigationService.pushAndRemoveUntil(
CustomPageRoute(
page: AppUpdatePage(
appUpdateMessage: parsed['ErrorEndUserMessage'],
)),
ModalRoute.withName("/appUpdate")
);
logApiEndpointError(endPoint, parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
}
if (parsed['ErrorType'] == 2) {

@ -4,7 +4,7 @@ import 'package:hmg_patient_app_new/core/enums.dart';
class ApiConsts {
static const maxSmallScreen = 660;
static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.preProd;
static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT

@ -1064,7 +1064,10 @@ class AuthenticationViewModel extends ChangeNotifier {
List<ProjectDetailListModel> projectDetailListModel = [];
resultEither.fold(
(failure) async => await _errorHandlerService.handleError(failure: failure),
// (failure) async => await _errorHandlerService.handleError(failure: failure),
(failure) async {
print(failure.message);
},
(apiResponse) async {
if (apiResponse.messageStatus == 2) {
await _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage ?? "ErrorEmpty");

@ -1567,5 +1567,6 @@ abstract class LocaleKeys {
static const symptoms = 'symptoms';
static const insuranceInActive = 'insuranceInActive';
static const insuranceInActiveContactSupport = 'insuranceInActiveContactSupport';
static const updateAppNow = 'updateAppNow';
}

@ -0,0 +1,96 @@
import 'dart:io';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
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/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:in_app_update/in_app_update.dart';
import 'package:lottie/lottie.dart';
class AppUpdatePage extends StatelessWidget {
AppUpdatePage({super.key, required this.appUpdateMessage});
String appUpdateMessage;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.whiteColor,
body: Column(
children: [
Expanded(
child: Padding(
padding: EdgeInsets.all(24.h),
child: Column(
children: [
SizedBox(height: 120.h),
Align(
alignment: Alignment.topCenter,
child: Transform.flip(
flipX: getIt.get<AppState>().isArabic() ? true : false,
child: Lottie.asset(AppAnimations.onboarding_1,
repeat: true, reverse: false, frameRate: FrameRate(60), width: MediaQuery.sizeOf(context).width - 50.w, height: MediaQuery.sizeOf(context).width - 50.w),
),
),
SizedBox(height: 50.h),
appUpdateMessage.toText16(weight: FontWeight.w500),
],
),
),
),
Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 24.r,
hasShadow: true,
),
child: CustomButton(
text: LocaleKeys.updateAppNow.tr(context: context),
onPressed: () {
openAppUpdateLink();
},
backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedColor,
textColor: AppColors.whiteColor,
borderRadius: 12.r,
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
height: 56.h,
),
).paddingAll(24.h),
],
),
);
}
openAppUpdateLink() {
if (Platform.isAndroid) {
// _launchURL("https://play.google.com/store/apps/details?id=com.ejada.hmg");
InAppUpdate.checkForUpdate().then((info) {
print("checkForUpdate!!!");
print(info.toString());
if (info.immediateUpdateAllowed) {
print("Immediate Allowed!!!");
InAppUpdate.performImmediateUpdate().then((value) {}).catchError((e) => print(e.toString()));
}
}).catchError((e) {
print(e.toString());
Utils.openWebView(
url: "https://play.google.com/store/apps/details?id=com.ejada.hmg",
);
});
}
if (Platform.isIOS) {
Utils.openWebView(
url: "https://itunes.apple.com/app/id733503978",
);
}
}
}

@ -14,6 +14,7 @@ import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts
import 'package:hmg_patient_app_new/presentation/health_trackers/add_health_tracker_entry_page.dart';
import 'package:hmg_patient_app_new/presentation/health_trackers/health_tracker_detail_page.dart';
import 'package:hmg_patient_app_new/presentation/health_trackers/health_trackers_page.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/home_health_care/hhc_procedures_page.dart';
import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart';
@ -61,6 +62,7 @@ class AppRoutes {
static const String huaweiHealthExample = '/huaweiHealthExample';
static const String covid19Test = '/covid19Test';
static const String vitalSign = '/vitalSign';
static const String appUpdate = '/appUpdate';
//appointments
static const String bookAppointmentPage = '/bookAppointmentPage';
@ -123,6 +125,9 @@ class AppRoutes {
healthConvertersPage: (context) => HealthCalculatorsPage(type: HealthCalConEnum.converter),
healthTrackersPage: (context) => HealthTrackersPage(),
vitalSign: (context) => VitalSignPage(),
appUpdate: (context) => AppUpdatePage(
appUpdateMessage: '',
),
emergencyServicesPage: (context) => EmergencyServicesPage(),
servicesPriceListPage: (context) => ServicesPriceListPage(),
addHealthTrackerEntryPage: (context) {

@ -83,6 +83,7 @@ dependencies:
open_filex: ^4.7.0
flutter_swiper_view: ^1.1.8
flutter_callkit_incoming: ^3.0.0
in_app_update: ^4.2.5
# device_preview: ^1.3.1
location: ^8.0.1

Loading…
Cancel
Save