From 7c398ba40d5ab894e156a85c0bced7da993d3ba6 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 9 Aug 2021 11:12:42 +0300 Subject: [PATCH] bug fix --- lib/config/config.dart | 11 +++-- lib/pages/landing/landing_page.dart | 49 ++++++++++--------- lib/pages/login/confirm-login.dart | 4 +- .../bottom_navigation/bottom_nav_bar.dart | 27 +++++----- 4 files changed, 50 insertions(+), 41 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index b60a4b07..f8bca863 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -13,8 +13,8 @@ const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; -const BASE_URL = 'https://uat.hmgwebservices.com/'; -//const BASE_URL = 'https://hmgwebservices.com/'; +//const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs //const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; @@ -124,7 +124,8 @@ const INSERT_ER_INERT_PRES_ORDER = /// ER RRT const GET_ALL_RC_TRANSPORTATION = 'rc/api/Transportation/getalltransportation'; -const GET_ALL_RRT_QUESTIONS = 'Services/Patients.svc/REST/PatientER_RRT_GetAllQuestions'; +const GET_ALL_RRT_QUESTIONS = + 'Services/Patients.svc/REST/PatientER_RRT_GetAllQuestions'; ///FindUs const GET_FINDUS_REQUEST = 'Services/Lists.svc/REST/Get_HMG_Locations'; @@ -333,7 +334,7 @@ const IS_DENTAL_ALLOWED_BACKEND = false; const PATIENT_TYPE = 1; const PATIENT_TYPE_ID = 1; var DEVICE_TOKEN = ""; -var IS_VOICE_COMMAND_CLOSED = false; +var IS_VOICE_COMMAND_CLOSED = true; var IS_TEXT_COMPLETED = false; var DeviceTypeID = Platform.isIOS ? 1 : 2; const LANGUAGE_ID = 2; @@ -353,7 +354,7 @@ const UPLOAD_INSURANCE_CARD = const GET_VACCINES = "Services/Patients.svc/REST/GetDoneVaccinesByPatientID"; const GET_VACCINES_EMAIL = "Services/Notifications.svc/REST/SendVaccinesEmail"; const GET_PAtIENTS_INSURANCE_APPROVALS = - "Services/Patients.svc/REST/GetApprovalStatus"; + "Services/Patients.svc/REST/GetApprovalStatus_DWH"; const SEARCH_BOT = 'HabibiChatBotApi/BotInterface/GetVoiceCommandResponse'; const GET_VACCINATIONS_ITEMS = "/Services/ERP.svc/REST/GET_VACCINATIONS_ITEMS"; diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 9708db83..df0af1f3 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -59,7 +59,7 @@ class LandingPage extends StatefulWidget { @override _LandingPageState createState() => state = _LandingPageState(); - switchToDoFromHMGServices(){ + switchToDoFromHMGServices() { state.changeCurrentTab(4); } } @@ -99,7 +99,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { changeCurrentTab(int tab) { setState(() { - if(currentTab > 0 && tab == 2) + if (currentTab > 0 && tab == 2) pageController.jumpToPage(0); else if (tab != 0) pageController.jumpToPage(tab); @@ -111,8 +111,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { }); } - - @override void didChangeAppLifecycleState(AppLifecycleState state) { super.didChangeAppLifecycleState(state); @@ -164,9 +162,9 @@ class _LandingPageState extends State with WidgetsBindingObserver { void initState() { super.initState(); WidgetsBinding.instance.addObserver(this); - //setState(() { + AppGlobal.context = context; - // }); + _requestIOSPermissions(); pageController = PageController(keepPage: true); _firebaseMessaging.setAutoInitEnabled(true); @@ -196,6 +194,8 @@ class _LandingPageState extends State with WidgetsBindingObserver { if (token != null && DEVICE_TOKEN == "") { DEVICE_TOKEN = token; checkUserStatus(token); + if (projectViewModel.isLogin) + this.getNotificationCount(DEVICE_TOKEN); } }); if (results[Permission.location].isGranted) ; @@ -420,7 +420,6 @@ class _LandingPageState extends State with WidgetsBindingObserver { authService .selectDeviceImei(DEVICE_TOKEN) .then((SelectDeviceIMEIRES value) { - this.getNotificationCount(DEVICE_TOKEN); GifLoaderDialogUtils.hideDialog(context); if (value != null) { setUserValues(value); @@ -444,23 +443,27 @@ class _LandingPageState extends State with WidgetsBindingObserver { var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); if (data != null) { - authService - .registeredAuthenticatedUser(data, token, 0, 0) - .then((res) => {print(res)}); + // authService + // .registeredAuthenticatedUser(data, token, 0, 0) + // .then((res) => {print(res)}); authService.getDashboard().then((value) => { - setState(() { - notificationCount = value['List_PatientDashboard'][0] - ['UnreadPatientNotificationCount'] > - 99 - ? '99+' - : value['List_PatientDashboard'][0] - ['UnreadPatientNotificationCount'] - .toString(); - - sharedPref.setString(NOTIFICATION_COUNT, notificationCount); - }) + if (value != null) + { + setState(() { + notificationCount = value['List_PatientDashboard'][0] + ['UnreadPatientNotificationCount'] > + 99 + ? '99+' + : value['List_PatientDashboard'][0] + ['UnreadPatientNotificationCount'] + .toString(); + + sharedPref.setString(NOTIFICATION_COUNT, notificationCount); + }) + } }); - familyFileProvider.getSharedRecordByStatus(); + + // familyFileProvider.getSharedRecordByStatus(); } } } @@ -576,7 +579,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { changeIndex: changeCurrentTab, index: currentTab, ), - floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked , + floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, floatingActionButton: (projectViewModel.havePrivilege(34) && currentTab == 0) ? FloatingButton( diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index 561089ff..bcbcf6cb 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -269,6 +269,7 @@ class _ConfirmLogin extends State { try { availableBiometrics = await auth.getAvailableBiometrics(); } on PlatformException catch (e) { + AppToast.showErrorToast(message: e.message); print(e); } if (!mounted) return; @@ -397,7 +398,8 @@ class _ConfirmLogin extends State { stickyAuth: true, iOSAuthStrings: iosStrings); } on PlatformException catch (e) { - AppToast.showErrorToast(message: e.toString()); + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: 'Please enable your Touch or Face ID'); } if (authenticated == true) { diff --git a/lib/widgets/bottom_navigation/bottom_nav_bar.dart b/lib/widgets/bottom_navigation/bottom_nav_bar.dart index 76819533..7c0c69d4 100644 --- a/lib/widgets/bottom_navigation/bottom_nav_bar.dart +++ b/lib/widgets/bottom_navigation/bottom_nav_bar.dart @@ -22,7 +22,9 @@ class BottomNavBar extends StatefulWidget { final ValueChanged changeIndex; final int index; final bool showHomeIcon; - BottomNavBar({Key key, this.changeIndex, this.index, this.showHomeIcon = false}) : super(key: key); + BottomNavBar( + {Key key, this.changeIndex, this.index, this.showHomeIcon = false}) + : super(key: key); @override _BottomNavBarState createState() => _BottomNavBarState(); @@ -75,7 +77,7 @@ class _BottomNavBarState extends State { Expanded( child: (widget.showHomeIcon) ? SizedBox( - child: BottomNavigationItem( + child: BottomNavigationItem( icon: Icons.home_outlined, activeIcon: Icons.home_outlined, changeIndex: _changeIndex, @@ -83,7 +85,7 @@ class _BottomNavBarState extends State { currentIndex: 2, name: TranslationBase.of(context).home, ), - ) + ) : SizedBox( height: 50, child: Column( @@ -104,15 +106,16 @@ class _BottomNavBarState extends State { currentIndex: 0, name: TranslationBase.of(context).home, ), - // BottomNavigationItem( - // icon: EvaIcons.calendar, - // activeIcon: EvaIcons.calendar, - // changeIndex: _changeIndex, - // index: _index, - // currentIndex: 2, - // name: TranslationBase.of(context).bookAppo, - // ), - if (/*widget.index == 0 && */projectViewModel.havePrivilege(34)) + // BottomNavigationItem( + // icon: EvaIcons.calendar, + // activeIcon: EvaIcons.calendar, + // changeIndex: _changeIndex, + // index: _index, + // currentIndex: 2, + // name: TranslationBase.of(context).bookAppo, + // ), + if (/*widget.index == 0 && */ projectViewModel + .havePrivilege(34)) BottomNavigationItem( icon: EvaIcons.calendar, activeIcon: EvaIcons.calendar,