updates & fixes

updare-to-3.32.sultan
haroon amjad 4 months ago
parent 1aab92b50a
commit 4b5a3af4cd

@ -45,3 +45,4 @@ const IS_COVID_CONSENT_SHOWN = 'IS_COVID_CONSENT_SHOWN';
const REGISTER_INFO_DUBAI ='register-info-dubai'; const REGISTER_INFO_DUBAI ='register-info-dubai';
const IS_LAST_APPOINTMENT_RATE_SHOWN ='is-last-appointment-rate-shown'; const IS_LAST_APPOINTMENT_RATE_SHOWN ='is-last-appointment-rate-shown';
const PATIENT_OCCUPATION_LIST ='patient-occupation-list'; const PATIENT_OCCUPATION_LIST ='patient-occupation-list';
const HAS_ENABLED_QUICK_LOGIN ='has-enabled-quick-login';

@ -23,8 +23,7 @@ import 'package:hmg_patient_app/pages/login/welcome.dart';
import 'package:hmg_patient_app/pages/medical/medical_profile_page_new.dart'; import 'package:hmg_patient_app/pages/medical/medical_profile_page_new.dart';
import 'package:hmg_patient_app/services/authentication/auth_provider.dart'; import 'package:hmg_patient_app/services/authentication/auth_provider.dart';
import 'package:hmg_patient_app/services/clinic_services/get_clinic_service.dart'; import 'package:hmg_patient_app/services/clinic_services/get_clinic_service.dart';
import 'package:hmg_patient_app/services/family_files/family_files_provider.dart' import 'package:hmg_patient_app/services/family_files/family_files_provider.dart' as family;
as family;
import 'package:hmg_patient_app/services/livecare_services/livecare_provider.dart'; import 'package:hmg_patient_app/services/livecare_services/livecare_provider.dart';
import 'package:hmg_patient_app/services/payfort_services/payfort_view_model.dart'; import 'package:hmg_patient_app/services/payfort_services/payfort_view_model.dart';
import 'package:hmg_patient_app/services/robo_search/event_provider.dart'; import 'package:hmg_patient_app/services/robo_search/event_provider.dart';
@ -43,6 +42,7 @@ import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart';
import 'package:hmg_patient_app/widgets/others/not_auh_page.dart'; import 'package:hmg_patient_app/widgets/others/not_auh_page.dart';
import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// import 'package:flutter_app_icon_badge/flutter_app_icon_badge.dart'; // import 'package:flutter_app_icon_badge/flutter_app_icon_badge.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
@ -87,6 +87,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
var themeNotifier; var themeNotifier;
DateTime? currentBackPressTime; DateTime? currentBackPressTime;
bool authenticated = false; bool authenticated = false;
// SignalRUtil signalRUtil; // SignalRUtil signalRUtil;
// bool isDoneQuickLogin =false; // bool isDoneQuickLogin =false;
late ToDoCountProviderModel toDoProvider; late ToDoCountProviderModel toDoProvider;
@ -109,6 +110,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
bool isTalking = false; bool isTalking = false;
var sharedPref = new AppSharedPreferences(); var sharedPref = new AppSharedPreferences();
// //
// var data = { // var data = {
// "AppointmentNo": "2016059247", // "AppointmentNo": "2016059247",
@ -209,29 +211,29 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
// Future.delayed(Duration(seconds: 0), () { // Future.delayed(Duration(seconds: 0), () {
// setState(() { // setState(() {
if (tab == 5) { if (tab == 5) {
IS_VOICE_COMMAND_CLOSED = false; IS_VOICE_COMMAND_CLOSED = false;
triggerRobot(); triggerRobot();
// pageController.jumpToPage(tab); // pageController.jumpToPage(tab);
} else { } else {
if (currentTab > 0 && tab == 2) { if (currentTab > 0 && tab == 2) {
pageController.jumpToPage(0); pageController.jumpToPage(0);
currentTab = tab; currentTab = tab;
} else if (tab != 0) { } else if (tab != 0) {
// if (tab == 4 && projectViewModel.isLogin && model.count == 0) { // if (tab == 4 && projectViewModel.isLogin && model.count == 0) {
// AppToast.showErrorToast(message: TranslationBase.of(context).noBookedAppo); // AppToast.showErrorToast(message: TranslationBase.of(context).noBookedAppo);
// } else { // } else {
pageController.jumpToPage(tab); pageController.jumpToPage(tab);
currentTab = tab; currentTab = tab;
// } // }
} else { } else {
pageController.jumpToPage(tab); pageController.jumpToPage(tab);
currentTab = tab; currentTab = tab;
} }
setState(() {}); setState(() {});
// currentTab = tab; // currentTab = tab;
} }
// }); // });
// }); // });
@ -380,11 +382,9 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
SelectDeviceIMEIRES savedData = SelectDeviceIMEIRES.fromJson(data); SelectDeviceIMEIRES savedData = SelectDeviceIMEIRES.fromJson(data);
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => SavedLogin(savedData), builder: (BuildContext context) => SavedLogin(savedData),
), ),
); );
} else { } else {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
authService.selectDeviceImei(DEVICE_TOKEN).then((value) async { authService.selectDeviceImei(DEVICE_TOKEN).then((value) async {
@ -395,7 +395,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
setUserValues(value); setUserValues(value);
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => SavedLogin(savedData), builder: (BuildContext context) => SavedLogin(savedData),
), ),
); );
} else { } else {
@ -481,7 +481,6 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
authService.getDashboard().then((value) => { authService.getDashboard().then((value) => {
if (value != null) if (value != null)
{ {
setState(() { setState(() {
notificationCount = notificationCount =
value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString();
@ -684,11 +683,9 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
authService.getDashboard().then((value) async { authService.getDashboard().then((value) async {
setState(() { setState(() {
if (value != null) { if (value != null) {
notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString();
model.setState(model.count, model.ancillaryCount, true, notificationCount); model.setState(model.count, model.ancillaryCount, true, notificationCount);
sharedPref.setString(NOTIFICATION_COUNT, notificationCount); sharedPref.setString(NOTIFICATION_COUNT, notificationCount);
} }
}); });
// if (await AppSharedPreferences().getBool(IS_LAST_APPOINTMENT_RATE_SHOWN) == null || !await AppSharedPreferences().getBool(IS_LAST_APPOINTMENT_RATE_SHOWN)) { // if (await AppSharedPreferences().getBool(IS_LAST_APPOINTMENT_RATE_SHOWN) == null || !await AppSharedPreferences().getBool(IS_LAST_APPOINTMENT_RATE_SHOWN)) {
@ -735,13 +732,16 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
sharedPref.setString(IS_COVID_CONSENT_SHOWN, "true"); sharedPref.setString(IS_COVID_CONSENT_SHOWN, "true");
} }
checkLastLoginStatus(AuthenticatedUser user, String deviceToken) async{ checkLastLoginStatus(AuthenticatedUser user, String deviceToken) async {
int lastLoginStatus = await sharedPref.getInt(LAST_LOGIN) != null ? await sharedPref.getInt(LAST_LOGIN) : 1; int lastLoginStatus = await sharedPref.getInt(LAST_LOGIN) != null ? await sharedPref.getInt(LAST_LOGIN) : 1;
if(lastLoginStatus == 1 || lastLoginStatus == 4){ if (lastLoginStatus == 1 || lastLoginStatus == 4) {
showQuickLoginBottomSheet(context, user, deviceToken,false); if (await sharedPref.getBool(HAS_ENABLED_QUICK_LOGIN) == null || !await sharedPref.getBool(HAS_ENABLED_QUICK_LOGIN)) {
} showQuickLoginBottomSheet(context, user, deviceToken, false);
}
// showQuickLoginBottomSheet(context, user, deviceToken, false);
}
} }
void showQuickLoginBottomSheet(BuildContext context, AuthenticatedUser user, String deviceToken, bool isDone) { void showQuickLoginBottomSheet(BuildContext context, AuthenticatedUser user, String deviceToken, bool isDone) {
@ -750,63 +750,68 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
isScrollControlled: true, isScrollControlled: true,
useSafeArea: true, useSafeArea: true,
builder: (context) => SafeArea( builder: (context) => SafeArea(
child: Padding( child: Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child: QuickLoginBottomSheet( child: QuickLoginBottomSheet(
isDone:isDone, isDone: isDone,
onPressed: (){ onPressed: () {
loginWithFingerPrintFace(3, 1, user, deviceToken); sharedPref.setBool(HAS_ENABLED_QUICK_LOGIN, true);
},), loginWithFingerPrintFace(3, 1, user, deviceToken);
},
),
), ),
), ),
); ).then((value) {
sharedPref.setBool(HAS_ENABLED_QUICK_LOGIN, value);
});
} }
loginWithFingerPrintFace(type, int isActive, AuthenticatedUser user, String deviceToken ) async {
try {
authenticated = await auth.authenticate(
localizedReason: 'Scan your fingerprint to authenticate',
options: AuthenticationOptions(
useErrorDialogs: true,
stickyAuth: true,
),
authMessages: [
// IOSAuthMessages(
// cancelButton: 'cancel',
// goToSettingsButton: 'settings',
// goToSettingsDescription: 'Please set up your Touch ID.',
// lockOut: 'Please reenable your Touch ID'),
],
);
} on PlatformException catch (e) {
GifLoaderDialogUtils.hideDialog(context);
context.showBottomSheet(
child: ExceptionBottomSheet(
message: "Please enable your Touch or Face ID",
onOkPressed: () {
Navigator.of(context).pop();
// Don't resume timer here, let it continue naturally when user tries again
},
),
);
// AppToast.showErrorToast(message: 'Please enable your Touch or Face ID');
}
if (authenticated == true) {
Navigator.of(context).pop();
int lastLogin = 1;
var availableBiometrics = await auth.getAvailableBiometrics();
if (availableBiometrics.contains(BiometricType.strong) || availableBiometrics.contains(BiometricType.face)) {
lastLogin = 3; // Assume Face or secure fingerprint
} else if (availableBiometrics.contains(BiometricType.weak) || availableBiometrics.contains(BiometricType.fingerprint)) {
lastLogin = 2; // Likely weak fingerprint
}
await sharedPref.setInt(LAST_LOGIN, lastLogin); loginWithFingerPrintFace(type, int isActive, AuthenticatedUser user, String deviceToken) async {
showQuickLoginBottomSheet(context, user, deviceToken, true); try {
insertIMEI(lastLogin, deviceToken); authenticated = await auth.authenticate(
localizedReason: 'Scan your fingerprint to authenticate',
options: AuthenticationOptions(
useErrorDialogs: true,
stickyAuth: true,
),
authMessages: [
// IOSAuthMessages(
// cancelButton: 'cancel',
// goToSettingsButton: 'settings',
// goToSettingsDescription: 'Please set up your Touch ID.',
// lockOut: 'Please reenable your Touch ID'),
],
);
} on PlatformException catch (e) {
GifLoaderDialogUtils.hideDialog(context);
context.showBottomSheet(
child: ExceptionBottomSheet(
message: "Please enable your Touch or Face ID",
onOkPressed: () {
Navigator.of(context).pop();
// Don't resume timer here, let it continue naturally when user tries again
},
),
);
// AppToast.showErrorToast(message: 'Please enable your Touch or Face ID');
}
if (authenticated == true) {
Navigator.of(context).pop();
int lastLogin = 1;
var availableBiometrics = await auth.getAvailableBiometrics();
if (availableBiometrics.contains(BiometricType.strong) || availableBiometrics.contains(BiometricType.face)) {
lastLogin = 3; // Assume Face or secure fingerprint
} else if (availableBiometrics.contains(BiometricType.weak) || availableBiometrics.contains(BiometricType.fingerprint)) {
lastLogin = 2; // Likely weak fingerprint
} }
await sharedPref.setInt(LAST_LOGIN, lastLogin);
showQuickLoginBottomSheet(context, user, deviceToken, true);
insertIMEI(lastLogin, deviceToken);
} }
}
insertIMEI(lastLogin, String deviceToken) async { insertIMEI(lastLogin, String deviceToken) async {
authService.insertDeviceImei(lastLogin).then((value) => {}).catchError((err) { authService.insertDeviceImei(lastLogin).then((value) => {}).catchError((err) {
@ -816,5 +821,4 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
await sharedPref.setInt(LAST_LOGIN, lastLogin); await sharedPref.setInt(LAST_LOGIN, lastLogin);
authService.registeredAuthenticatedUser(data, deviceToken, 0, 0).then((res) => {}); authService.registeredAuthenticatedUser(data, deviceToken, 0, 0).then((res) => {});
} }
} }

@ -762,6 +762,7 @@ class _RegisterNew extends State<RegisterNew> {
final isHijriDate = isHijri == 1; final isHijriDate = isHijri == 1;
final dobString = isHijriDate ? selectedDOB!.toString() : dateFormat.format(selectedDOB!); final dobString = isHijriDate ? selectedDOB!.toString() : dateFormat.format(selectedDOB!);
var req; var req;
GifLoaderDialogUtils.showMyDialog(context);
if (skipRegistration) { if (skipRegistration) {
req = getCommonRequest(type: type); req = getCommonRequest(type: type);
} else { } else {

@ -217,7 +217,7 @@ class _SavedLogin extends State<SavedLogin> {
widget.savedLoginData.logInType != null && widget.savedLoginData.logInType != 1 widget.savedLoginData.logInType != null && widget.savedLoginData.logInType != 1
? Column( ? Column(
children: [ children: [
CustomButton( widget.savedLoginData.logInType !=1 ? CustomButton(
text: TranslationBase.of(context).loginByOTP, text: TranslationBase.of(context).loginByOTP,
onPressed: () { onPressed: () {
widget.savedLoginData.logInType = 1; widget.savedLoginData.logInType = 1;
@ -230,11 +230,11 @@ class _SavedLogin extends State<SavedLogin> {
borderWidth: 2, borderWidth: 2,
padding: EdgeInsets.fromLTRB(0, 14, 0, 14), padding: EdgeInsets.fromLTRB(0, 14, 0, 14),
icon: "assets/images/svg/password-validation.svg", icon: "assets/images/svg/password-validation.svg",
), ) : Container(),
SizedBox( SizedBox(
height: 20, height: 20,
), ),
CustomButton( widget.savedLoginData.logInType !=4 ? CustomButton(
text: "${TranslationBase.of(context).loginBy} ${getType(4, context)}", text: "${TranslationBase.of(context).loginBy} ${getType(4, context)}",
onPressed: () { onPressed: () {
widget.savedLoginData.logInType = 4; widget.savedLoginData.logInType = 4;
@ -247,7 +247,7 @@ class _SavedLogin extends State<SavedLogin> {
borderWidth: 2, borderWidth: 2,
padding: EdgeInsets.fromLTRB(0, 14, 0, 14), padding: EdgeInsets.fromLTRB(0, 14, 0, 14),
icon: "assets/images/svg/whatsapp.svg", icon: "assets/images/svg/whatsapp.svg",
), ) : Container(),
], ],
) )
: CustomButton( : CustomButton(
@ -703,6 +703,7 @@ class _SavedLogin extends State<SavedLogin> {
phoneController!.text, phoneController!.text,
(code) { (code) {
checkActivationCode(code, type, loginToken, onWrongActivationCode: (String? message) { checkActivationCode(code, type, loginToken, onWrongActivationCode: (String? message) {
smsOtp.clearOTPInput();
context.showBottomSheet( context.showBottomSheet(
child: ExceptionBottomSheet( child: ExceptionBottomSheet(
message: message.toString(), message: message.toString(),

@ -6,8 +6,6 @@ import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
import 'package:hmg_patient_app/uitl/utils.dart'; import 'package:hmg_patient_app/uitl/utils.dart';
import 'package:hmg_patient_app/widgets/buttons/defaultButton.dart'; import 'package:hmg_patient_app/widgets/buttons/defaultButton.dart';
class QuickLoginBottomSheet extends StatefulWidget { class QuickLoginBottomSheet extends StatefulWidget {
final VoidCallback onPressed; final VoidCallback onPressed;
final bool isDone; final bool isDone;
@ -17,8 +15,8 @@ class QuickLoginBottomSheet extends StatefulWidget {
@override @override
_QuickLoginBottomSheet createState() => _QuickLoginBottomSheet(); _QuickLoginBottomSheet createState() => _QuickLoginBottomSheet();
} }
class _QuickLoginBottomSheet extends State<QuickLoginBottomSheet> {
class _QuickLoginBottomSheet extends State<QuickLoginBottomSheet> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
@ -30,97 +28,103 @@ class _QuickLoginBottomSheet extends State<QuickLoginBottomSheet> {
), ),
), ),
padding: const EdgeInsets.all(24), padding: const EdgeInsets.all(24),
child: Column( mainAxisSize: MainAxisSize.min, child: Column(
crossAxisAlignment: CrossAxisAlignment.center,children: [
widget.isDone ? Column(children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [ InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: SvgPicture.asset("assets/images/svg/cross-circle.svg", width: 24, height: 24)),],),
Utils.showLottie(context: context, assetPath: 'assets/animations/lottie/checkmark.json', width: 120, height: 120, repeat: true),
Text(
TranslationBase.of(context).allSet,
textAlign: TextAlign.center,
style: context.dynamicTextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
],) : Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
widget.isDone
Image.asset("assets/images/lock-icon.png", height: 101,), ? Column(
const SizedBox(height: 10), children: [
Text( Row(
TranslationBase.of(context).enableQuickLogin, mainAxisAlignment: MainAxisAlignment.end,
style: context.dynamicTextStyle( children: [
fontSize: 26, InkWell(
fontWeight: FontWeight.bold, onTap: () {
color: Colors.black, Navigator.pop(context, true);
), },
), child: SvgPicture.asset("assets/images/svg/cross-circle.svg", width: 24, height: 24)),
],
const SizedBox(height: 5), ),
Utils.showLottie(context: context, assetPath: 'assets/animations/lottie/checkmark.json', width: 120, height: 120, repeat: true),
// Description Text(
Text( TranslationBase.of(context).allSet,
TranslationBase.of(context).enableMsg, textAlign: TextAlign.center,
style: context.dynamicTextStyle( style: context.dynamicTextStyle(
fontSize: 16, fontSize: 16,
color: Color(0xFF666666), fontWeight: FontWeight.bold,
height: 1.5, color: Colors.black,
), ),
), ),
],
)
: Column(
const SizedBox(height: 24), mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
// Buttons children: [
Row( Image.asset(
mainAxisAlignment: MainAxisAlignment.end, "assets/images/lock-icon.png",
children: [ height: 101,
Expanded(child: ),
CustomButton( const SizedBox(height: 10),
text:TranslationBase.of(context).enableQuickLogin, Text(
onPressed:widget.onPressed, TranslationBase.of(context).enableQuickLogin,
backgroundColor:Color(0xffED1C2B), style: context.dynamicTextStyle(
borderColor:Color(0xffED1C2B), fontSize: 26,
textColor: Colors.white, fontWeight: FontWeight.bold,
icon: "assets/images/svg/apple-finder.svg", color: Colors.black,
)), ),
], ),
), const SizedBox(height: 5),
SizedBox(height: 16,), // Description
Row( Text(
mainAxisAlignment: MainAxisAlignment.end, TranslationBase.of(context).enableMsg,
children: [ style: context.dynamicTextStyle(
Expanded(child: fontSize: 16,
color: Color(0xFF666666),
CustomButton( height: 1.5,
text:TranslationBase.of(context).notNow, ),
onPressed: (){ Navigator.pop(context);}, ),
backgroundColor:Color(0xffFEE9EA), const SizedBox(height: 24),
borderColor:Color(0xffFEE9EA), // Buttons
textColor: Colors.red, Row(
// icon: "assets/images/svg/apple-finder.svg", mainAxisAlignment: MainAxisAlignment.end,
)), children: [
], Expanded(
), child: CustomButton(
text: TranslationBase.of(context).enableQuickLogin,
onPressed: () {
widget.onPressed();
},
backgroundColor: Color(0xffED1C2B),
borderColor: Color(0xffED1C2B),
textColor: Colors.white,
icon: "assets/images/svg/apple-finder.svg",
)),
],
),
SizedBox(
height: 16,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
child: CustomButton(
text: TranslationBase.of(context).notNow,
onPressed: () {
Navigator.pop(context, true);
},
backgroundColor: Color(0xffFEE9EA),
borderColor: Color(0xffFEE9EA),
textColor: Colors.red,
// icon: "assets/images/svg/apple-finder.svg",
)),
],
),
],
)
], ],
)],), ),
); );
} }
}
}

Loading…
Cancel
Save