|
|
|
|
@ -22,8 +22,7 @@ import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doct
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/videocall-webrtc-rnd/webrtc/start_video_call.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'
|
|
|
|
|
as family;
|
|
|
|
|
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart' as family;
|
|
|
|
|
import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/payfort_services/payfort_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart';
|
|
|
|
|
@ -76,8 +75,7 @@ class LandingPage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
var authProvider = new AuthProvider();
|
|
|
|
|
AppointmentRateViewModel appointmentRateViewModel =
|
|
|
|
|
locator<AppointmentRateViewModel>();
|
|
|
|
|
AppointmentRateViewModel appointmentRateViewModel = locator<AppointmentRateViewModel>();
|
|
|
|
|
|
|
|
|
|
int currentTab = 0;
|
|
|
|
|
late PageController pageController;
|
|
|
|
|
@ -94,8 +92,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
bool _showBottomNavigationBar = true;
|
|
|
|
|
|
|
|
|
|
///inject the user data
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject =
|
|
|
|
|
locator<AuthenticatedUserObject>();
|
|
|
|
|
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
|
|
|
|
|
|
|
|
|
|
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging.instance;
|
|
|
|
|
final authService = new AuthProvider();
|
|
|
|
|
@ -122,22 +119,17 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
"appointmentdate": "2022-01-19",
|
|
|
|
|
"appointmenttime": "12:10",
|
|
|
|
|
"PatientName": "Testing",
|
|
|
|
|
"session_id":
|
|
|
|
|
"1_MX40NjIwOTk2Mn5-MTY0NzI1NjYxNDI2OX5ySXhlVjZjam13RFdMVmdleWVsSDhzQkx-fg",
|
|
|
|
|
"session_id": "1_MX40NjIwOTk2Mn5-MTY0NzI1NjYxNDI2OX5ySXhlVjZjam13RFdMVmdleWVsSDhzQkx-fg",
|
|
|
|
|
"token":
|
|
|
|
|
"T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9OGMyY2IyYWFiZmZmMzI4ZmEwMjgxNDdmMGFhZGI0N2JiZjdmZWY4MjpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWTBOekkxTmpZeE5ESTJPWDV5U1hobFZqWmphbTEzUkZkTVZtZGxlV1ZzU0RoelFreC1mZyZjcmVhdGVfdGltZT0xNjQ3MjU2NjE0Jm5vbmNlPTAuMjgzNDgyNjM1NDczNjQ2OCZyb2xlPW1vZGVyYXRvciZleHBpcmVfdGltZT0xNjQ3MjU4NDE0JmluaXRpYWxfbGF5b3V0X2NsYXNzX2xpc3Q9",
|
|
|
|
|
"DoctorImageURL":
|
|
|
|
|
"https://image.shutterstock.com/image-vector/sample-stamp-square-grunge-sign-260nw-1474408826.jpg",
|
|
|
|
|
"DoctorImageURL": "https://image.shutterstock.com/image-vector/sample-stamp-square-grunge-sign-260nw-1474408826.jpg",
|
|
|
|
|
"callerID": "9920",
|
|
|
|
|
"PatientID": "1231755",
|
|
|
|
|
"is_call": "true"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void _requestIOSPermissions() {
|
|
|
|
|
flutterLocalNotificationsPlugin
|
|
|
|
|
.resolvePlatformSpecificImplementation<
|
|
|
|
|
IOSFlutterLocalNotificationsPlugin>()
|
|
|
|
|
?.requestPermissions(
|
|
|
|
|
flutterLocalNotificationsPlugin.resolvePlatformSpecificImplementation<IOSFlutterLocalNotificationsPlugin>()?.requestPermissions(
|
|
|
|
|
alert: true,
|
|
|
|
|
badge: true,
|
|
|
|
|
sound: true,
|
|
|
|
|
@ -153,8 +145,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
return Future.value(false);
|
|
|
|
|
} else {
|
|
|
|
|
DateTime now = DateTime.now();
|
|
|
|
|
if (currentBackPressTime == null ||
|
|
|
|
|
now.difference(currentBackPressTime!) > Duration(seconds: 2)) {
|
|
|
|
|
if (currentBackPressTime == null || now.difference(currentBackPressTime!) > Duration(seconds: 2)) {
|
|
|
|
|
currentBackPressTime = now;
|
|
|
|
|
AppToast.showToast(message: TranslationBase.of(context).pressAgain);
|
|
|
|
|
return Future.value(false);
|
|
|
|
|
@ -169,18 +160,14 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
List<ImagesInfo> imagesInfo = [];
|
|
|
|
|
imagesInfo.add(
|
|
|
|
|
ImagesInfo(
|
|
|
|
|
imageEn:
|
|
|
|
|
'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/0.png',
|
|
|
|
|
imageAr:
|
|
|
|
|
'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/0.png'),
|
|
|
|
|
imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/0.png',
|
|
|
|
|
imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/0.png'),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
imagesInfo.add(
|
|
|
|
|
ImagesInfo(
|
|
|
|
|
imageEn:
|
|
|
|
|
'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/1.png',
|
|
|
|
|
imageAr:
|
|
|
|
|
'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/1.png'),
|
|
|
|
|
imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/1.png',
|
|
|
|
|
imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/1.png'),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Navigator.push(
|
|
|
|
|
@ -199,11 +186,8 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
}
|
|
|
|
|
if (tab == 4) {
|
|
|
|
|
List<ImagesInfo> imagesInfo = [];
|
|
|
|
|
imagesInfo.add(ImagesInfo(
|
|
|
|
|
imageEn:
|
|
|
|
|
'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/en/0.png',
|
|
|
|
|
imageAr:
|
|
|
|
|
'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/ar/0.png'));
|
|
|
|
|
imagesInfo.add(
|
|
|
|
|
ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/todo/ar/0.png'));
|
|
|
|
|
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
@ -248,8 +232,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
projectViewModel.analytics.bottomTabNavigation
|
|
|
|
|
.log(tabIndex: tab, isLoggedIn: projectViewModel.isLogin);
|
|
|
|
|
projectViewModel.analytics.bottomTabNavigation.log(tabIndex: tab, isLoggedIn: projectViewModel.isLogin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getToDoCount() {
|
|
|
|
|
@ -260,11 +243,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
print(res['AppointmentActiveNumber']);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
// toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount);
|
|
|
|
|
toDoProvider.setState(
|
|
|
|
|
res['AppointmentActiveNumber'],
|
|
|
|
|
res['AncillaryOrderListCount'],
|
|
|
|
|
true,
|
|
|
|
|
toDoProvider.notificationsCount);
|
|
|
|
|
toDoProvider.setState(res['AppointmentActiveNumber'], res['AncillaryOrderListCount'], true, toDoProvider.notificationsCount);
|
|
|
|
|
} else {}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
@ -303,10 +282,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
if (projectViewModel.isLogin && !projectViewModel.isLoginChild) {
|
|
|
|
|
int languageID =
|
|
|
|
|
Provider.of<ProjectViewModel>(context, listen: false).isArabic
|
|
|
|
|
? 1
|
|
|
|
|
: 2;
|
|
|
|
|
int languageID = Provider.of<ProjectViewModel>(context, listen: false).isArabic ? 1 : 2;
|
|
|
|
|
familyFileProvider.getSharedRecordByStatus(languageID);
|
|
|
|
|
}
|
|
|
|
|
// Future.delayed(Duration(seconds: 3)).then((result) async {
|
|
|
|
|
@ -322,31 +298,34 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
// HMGNetworkConnectivity(context).start();
|
|
|
|
|
|
|
|
|
|
_firebaseMessaging.getToken().then((String? token) {
|
|
|
|
|
print("Firebase Token: " + token!);
|
|
|
|
|
sharedPref.setString(PUSH_TOKEN, token!);
|
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
|
FirebaseMessaging.instance.getAPNSToken().then((value) {
|
|
|
|
|
print("Push APNS getToken: " + value!);
|
|
|
|
|
AppSharedPreferences().setString(APNS_TOKEN, value);
|
|
|
|
|
AppSharedPreferences().setString(ONESIGNAL_APNS_TOKEN, value);
|
|
|
|
|
});
|
|
|
|
|
// voIPKit.getVoIPToken().then((value) {
|
|
|
|
|
// print('🎈 example: getVoIPToken: $value');
|
|
|
|
|
// AppSharedPreferences().setString(APNS_TOKEN, value!);
|
|
|
|
|
// // getOneSignalVOIPToken(value);
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
// print("Firebase Token: " + token!);
|
|
|
|
|
sharedPref.setString(PUSH_TOKEN, token!);
|
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
|
FirebaseMessaging.instance.getAPNSToken().then((value) {
|
|
|
|
|
print("Push APNS getToken: " + value!);
|
|
|
|
|
AppSharedPreferences().setString(APNS_TOKEN, value);
|
|
|
|
|
AppSharedPreferences().setString(ONESIGNAL_APNS_TOKEN, value);
|
|
|
|
|
});
|
|
|
|
|
// voIPKit.getVoIPToken().then((value) {
|
|
|
|
|
// print('🎈 example: getVoIPToken: $value');
|
|
|
|
|
// AppSharedPreferences().setString(APNS_TOKEN, value!);
|
|
|
|
|
// // getOneSignalVOIPToken(value);
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
if (token != null) {
|
|
|
|
|
DEVICE_TOKEN = token;
|
|
|
|
|
if (!projectViewModel.isLoginChild) {
|
|
|
|
|
checkUserStatus(token);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
startZoom();
|
|
|
|
|
// HMG_Geofencing(context).loadZones().then((instance) => instance.init());
|
|
|
|
|
}
|
|
|
|
|
void startZoom(){
|
|
|
|
|
|
|
|
|
|
void startZoom() {
|
|
|
|
|
var zoom = ZoomVideoSdk();
|
|
|
|
|
InitConfig initConfig = InitConfig(
|
|
|
|
|
domain: "zoom.us",
|
|
|
|
|
@ -476,20 +455,14 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
|
|
|
|
|
getNotificationCount(token) async {
|
|
|
|
|
if (await sharedPref.getObject(USER_PROFILE) != null) {
|
|
|
|
|
var data =
|
|
|
|
|
AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
|
|
|
|
|
var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
|
|
|
|
|
if (data != null) {
|
|
|
|
|
authService.getDashboard().then((value) => {
|
|
|
|
|
if (value != null)
|
|
|
|
|
{
|
|
|
|
|
setState(() {
|
|
|
|
|
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, 0, true, notificationCount);
|
|
|
|
|
sharedPref.setString(NOTIFICATION_COUNT, notificationCount);
|
|
|
|
|
})
|
|
|
|
|
@ -519,11 +492,9 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
getText(currentTab).toUpperCase(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: currentTab == 0
|
|
|
|
|
? CustomColors.backgroudGreyColor
|
|
|
|
|
: Theme.of(context).textTheme.headline1!.color,
|
|
|
|
|
fontFamily:
|
|
|
|
|
projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
|
|
|
|
|
color: currentTab == 0 ? CustomColors.backgroudGreyColor : CustomColors.accentColor,
|
|
|
|
|
// : Theme.of(context).textTheme.headline1!.color,
|
|
|
|
|
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
|
|
|
|
|
// bold: true,
|
|
|
|
|
),
|
|
|
|
|
leading: Builder(
|
|
|
|
|
@ -532,14 +503,10 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
currentTab == 0
|
|
|
|
|
? IconButton(
|
|
|
|
|
icon: SvgPicture.asset(
|
|
|
|
|
"assets/images/new/menu.svg"),
|
|
|
|
|
color: Theme.of(context)
|
|
|
|
|
.textTheme
|
|
|
|
|
.headline1!
|
|
|
|
|
.color,
|
|
|
|
|
onPressed: () =>
|
|
|
|
|
Scaffold.of(context).openDrawer(),
|
|
|
|
|
icon: SvgPicture.asset("assets/images/new/menu.svg"),
|
|
|
|
|
// color: Theme.of(context).textTheme.headline1!.color,
|
|
|
|
|
color: CustomColors.white,
|
|
|
|
|
onPressed: () => Scaffold.of(context).openDrawer(),
|
|
|
|
|
)
|
|
|
|
|
: IconButton(
|
|
|
|
|
icon: Icon(Icons.arrow_back),
|
|
|
|
|
@ -550,9 +517,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
pageController.jumpToPage(0);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
projectViewModel.isLogin &&
|
|
|
|
|
model.notificationsCount != null &&
|
|
|
|
|
!projectViewModel.isLoginChild
|
|
|
|
|
projectViewModel.isLogin && model.notificationsCount != null && !projectViewModel.isLoginChild
|
|
|
|
|
? Positioned(
|
|
|
|
|
right: projectViewModel.isArabic ? 35 : 0,
|
|
|
|
|
top: 5,
|
|
|
|
|
@ -570,8 +535,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
model.notificationsCount.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontSize:
|
|
|
|
|
projectViewModel.isArabic ? 8 : 9,
|
|
|
|
|
fontSize: projectViewModel.isArabic ? 8 : 9,
|
|
|
|
|
),
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
@ -655,16 +619,15 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
index: currentTab,
|
|
|
|
|
),
|
|
|
|
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
|
|
|
|
floatingActionButton:
|
|
|
|
|
(projectViewModel.havePrivilege(34) && currentTab == 0)
|
|
|
|
|
? FloatingButton(
|
|
|
|
|
elevation: true,
|
|
|
|
|
onTap: () {
|
|
|
|
|
changeCurrentTab(2);
|
|
|
|
|
projectViewModel.analytics.appointment.book_appointment();
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
: null);
|
|
|
|
|
floatingActionButton: (projectViewModel.havePrivilege(34) && currentTab == 0)
|
|
|
|
|
? FloatingButton(
|
|
|
|
|
elevation: true,
|
|
|
|
|
onTap: () {
|
|
|
|
|
changeCurrentTab(2);
|
|
|
|
|
projectViewModel.analytics.appointment.book_appointment();
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
: null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
triggerRobot() {
|
|
|
|
|
@ -692,22 +655,13 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
await PushNotificationHandler.getInstance().requestPermissions();
|
|
|
|
|
// authService.selectDeviceImei(token).then((SelectDeviceIMEIRES? value) => setUserValues(value));
|
|
|
|
|
if (authenticatedUserObject.isLogin) {
|
|
|
|
|
var data =
|
|
|
|
|
AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
|
|
|
|
|
var data = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
|
|
|
|
|
if (data != null) {
|
|
|
|
|
authService
|
|
|
|
|
.registeredAuthenticatedUser(data, token, 0, 0)
|
|
|
|
|
.then((res) => {});
|
|
|
|
|
authService.registeredAuthenticatedUser(data, token, 0, 0).then((res) => {});
|
|
|
|
|
authService.getDashboard().then((value) async {
|
|
|
|
|
setState(() {
|
|
|
|
|
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, 0, true, notificationCount);
|
|
|
|
|
sharedPref.setString(NOTIFICATION_COUNT, notificationCount);
|
|
|
|
|
FlutterAppIconBadge.updateBadge(int.parse(notificationCount));
|
|
|
|
|
|