|
|
|
|
@ -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/services/authentication/auth_provider.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'
|
|
|
|
|
as family;
|
|
|
|
|
import 'package:hmg_patient_app/services/family_files/family_files_provider.dart' as family;
|
|
|
|
|
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/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:firebase_messaging/firebase_messaging.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
// import 'package:flutter_app_icon_badge/flutter_app_icon_badge.dart';
|
|
|
|
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
@ -87,6 +87,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
var themeNotifier;
|
|
|
|
|
DateTime? currentBackPressTime;
|
|
|
|
|
bool authenticated = false;
|
|
|
|
|
|
|
|
|
|
// SignalRUtil signalRUtil;
|
|
|
|
|
// bool isDoneQuickLogin =false;
|
|
|
|
|
late ToDoCountProviderModel toDoProvider;
|
|
|
|
|
@ -109,6 +110,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
bool isTalking = false;
|
|
|
|
|
|
|
|
|
|
var sharedPref = new AppSharedPreferences();
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// var data = {
|
|
|
|
|
// "AppointmentNo": "2016059247",
|
|
|
|
|
@ -209,29 +211,29 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
// Future.delayed(Duration(seconds: 0), () {
|
|
|
|
|
// setState(() {
|
|
|
|
|
if (tab == 5) {
|
|
|
|
|
IS_VOICE_COMMAND_CLOSED = false;
|
|
|
|
|
triggerRobot();
|
|
|
|
|
IS_VOICE_COMMAND_CLOSED = false;
|
|
|
|
|
triggerRobot();
|
|
|
|
|
|
|
|
|
|
// pageController.jumpToPage(tab);
|
|
|
|
|
} else {
|
|
|
|
|
if (currentTab > 0 && tab == 2) {
|
|
|
|
|
pageController.jumpToPage(0);
|
|
|
|
|
// pageController.jumpToPage(tab);
|
|
|
|
|
} else {
|
|
|
|
|
if (currentTab > 0 && tab == 2) {
|
|
|
|
|
pageController.jumpToPage(0);
|
|
|
|
|
|
|
|
|
|
currentTab = tab;
|
|
|
|
|
} else if (tab != 0) {
|
|
|
|
|
// if (tab == 4 && projectViewModel.isLogin && model.count == 0) {
|
|
|
|
|
// AppToast.showErrorToast(message: TranslationBase.of(context).noBookedAppo);
|
|
|
|
|
// } else {
|
|
|
|
|
pageController.jumpToPage(tab);
|
|
|
|
|
currentTab = tab;
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
pageController.jumpToPage(tab);
|
|
|
|
|
currentTab = tab;
|
|
|
|
|
}
|
|
|
|
|
} else if (tab != 0) {
|
|
|
|
|
// if (tab == 4 && projectViewModel.isLogin && model.count == 0) {
|
|
|
|
|
// AppToast.showErrorToast(message: TranslationBase.of(context).noBookedAppo);
|
|
|
|
|
// } else {
|
|
|
|
|
pageController.jumpToPage(tab);
|
|
|
|
|
currentTab = tab;
|
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
pageController.jumpToPage(tab);
|
|
|
|
|
currentTab = tab;
|
|
|
|
|
}
|
|
|
|
|
setState(() {});
|
|
|
|
|
// currentTab = tab;
|
|
|
|
|
}
|
|
|
|
|
// currentTab = tab;
|
|
|
|
|
}
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
@ -380,11 +382,9 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
SelectDeviceIMEIRES savedData = SelectDeviceIMEIRES.fromJson(data);
|
|
|
|
|
Navigator.of(context).push(
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (BuildContext context) => SavedLogin(savedData),
|
|
|
|
|
builder: (BuildContext context) => SavedLogin(savedData),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
authService.selectDeviceImei(DEVICE_TOKEN).then((value) async {
|
|
|
|
|
@ -395,7 +395,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
setUserValues(value);
|
|
|
|
|
Navigator.of(context).push(
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (BuildContext context) => SavedLogin(savedData),
|
|
|
|
|
builder: (BuildContext context) => SavedLogin(savedData),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
@ -481,7 +481,6 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
authService.getDashboard().then((value) => {
|
|
|
|
|
if (value != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
notificationCount =
|
|
|
|
|
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 {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (value != null) {
|
|
|
|
|
|
|
|
|
|
notificationCount = value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'] > 99 ? '99+' : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString();
|
|
|
|
|
model.setState(model.count, model.ancillaryCount, true, notificationCount);
|
|
|
|
|
sharedPref.setString(NOTIFICATION_COUNT, notificationCount);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// 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");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
if(lastLoginStatus == 1 || lastLoginStatus == 4){
|
|
|
|
|
showQuickLoginBottomSheet(context, user, deviceToken,false);
|
|
|
|
|
}
|
|
|
|
|
if (lastLoginStatus == 1 || lastLoginStatus == 4) {
|
|
|
|
|
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) {
|
|
|
|
|
@ -750,63 +750,68 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
useSafeArea: true,
|
|
|
|
|
builder: (context) => SafeArea(
|
|
|
|
|
builder: (context) => SafeArea(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
|
|
|
|
|
child: QuickLoginBottomSheet(
|
|
|
|
|
isDone:isDone,
|
|
|
|
|
onPressed: (){
|
|
|
|
|
loginWithFingerPrintFace(3, 1, user, deviceToken);
|
|
|
|
|
},),
|
|
|
|
|
isDone: isDone,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
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);
|
|
|
|
|
showQuickLoginBottomSheet(context, user, deviceToken, true);
|
|
|
|
|
insertIMEI(lastLogin, deviceToken);
|
|
|
|
|
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);
|
|
|
|
|
showQuickLoginBottomSheet(context, user, deviceToken, true);
|
|
|
|
|
insertIMEI(lastLogin, deviceToken);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
insertIMEI(lastLogin, String deviceToken) async {
|
|
|
|
|
authService.insertDeviceImei(lastLogin).then((value) => {}).catchError((err) {
|
|
|
|
|
@ -816,5 +821,4 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
await sharedPref.setInt(LAST_LOGIN, lastLogin);
|
|
|
|
|
authService.registeredAuthenticatedUser(data, deviceToken, 0, 0).then((res) => {});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|