diff --git a/android/app/build.gradle b/android/app/build.gradle index d88df7fe..336e8e53 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -40,7 +40,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // applicationId "com.cloud.diplomaticquarterapp" - applicationId "com.ejada.hmg" + applicationId "com.ejada.hmg.uat" minSdkVersion 21 targetSdkVersion 30 versionCode flutterVersionCode.toInteger() diff --git a/android/app/google-services.json b/android/app/google-services.json index dd4038cf..6d1d75a9 100755 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -10,7 +10,7 @@ "client_info": { "mobilesdk_app_id": "1:815750722565:android:62281cd3e5df4063", "android_client_info": { - "package_name": "com.ejada.hmg" + "package_name": "com.ejada.hmg.uat" } }, "oauth_client": [ diff --git a/ios/Podfile b/ios/Podfile index d68afba2..89424e2a 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -3,6 +3,7 @@ # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' +$FirebaseAnalyticsWithoutAdIdSupport = true project 'Runner', { 'Debug' => :debug, diff --git a/lib/analytics/analytic-events.dart b/lib/analytics/analytic-events.dart new file mode 100644 index 00000000..3e107d95 --- /dev/null +++ b/lib/analytics/analytic-events.dart @@ -0,0 +1,69 @@ +import 'package:diplomaticquarterapp/uitl/utils.dart'; + +class _Event{ + String name; + String description; + bool active; + _Event(dynamic map){ + name = map['name']; + description = map['description']; + active = map['active']; + } + + flutterName() => 'f: $name'; +} + +class AnalyticEvents{ + static _Event get(String key) { + var e = _Event(mapping[key]); + if(e == null){ + var label = labelFrom(className: key); // Convert Class Name in to Label (HomeCare -> Home Care) + e = _Event({"name": label, "active":true, "description":key}); + } + return e; + } + + static var mapping = const { + "HomeHealthCarePage" : { + "active" : true, + "name" : "Home Health Care Page", + "description" : "", + }, + "SplashScreen" : { + "active" : true, + "name" : "Splash Screen", + "description" : "", + }, + "LandingPage" : { + "active" : true, + "name" : "Landing Page", + "description" : "", + }, + "WelcomeLogin" : { + "active" : true, + "name" : "Welcome Login", + "description" : "", + }, + "LoginType" : { + "active" : true, + "name" : "Login Type", + "description" : "", + }, + "Login" : { + "active" : true, + "name" : "Login", + "description" : "", + }, + "ForgotPassword" : { + "active" : true, + "name" : "Forgot Password", + "description" : "", + }, + "" : { + "active" : true, + "name" : "", + "description" : "", + }, + }; +} + diff --git a/lib/analytics/google-analytics.dart b/lib/analytics/google-analytics.dart new file mode 100644 index 00000000..f4bf8b72 --- /dev/null +++ b/lib/analytics/google-analytics.dart @@ -0,0 +1,85 @@ +import 'package:diplomaticquarterapp/analytics/analytic-events.dart'; +import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:firebase_analytics/firebase_analytics.dart'; +import 'package:firebase_analytics/observer.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +class Singleton { + const Singleton(); //Constant constructor + + void hello() { print('Hello world'); } +} + +var analytics = FirebaseAnalytics(); + +class GAnalytics{ + const GAnalytics(); + static GAnalytics shared = const GAnalytics(); + NavObserver navObserver() => NavObserver(); +} +// adb shell setprop debug.firebase.analytics.app com.ejada.hmg -> Android +class NavObserver extends RouteObserver>{ + + _sendScreenView(PageRoute route) async{ + + + log(String className){ + var event = AnalyticEvents.get(className); + if(event.active){ + analytics.setCurrentScreen(screenName: event.flutterName(), screenClassOverride: className).catchError( (Object error) { + debugPrint('$FirebaseAnalyticsObserver: $error'); + }, + test: (Object error) { + return error is PlatformException; + }, + ); + } + } + + if(route.settings.name != null && route.settings.name.isNotEmpty && route.settings.name != "null"){ + var class_ = routes[route.settings.name](0); + if(class_ != null) + log(class_.toStringShort()); + + }else if(route is FadePage){ + var class_ = route.page; + if(class_ != null) + log(class_.toStringShort()); + + }else if(route is MaterialPageRoute){ + var class_ = route.builder(null); + if (class_ != null) + log(class_.toStringShort()); + + }else{ + print(""); + } + + } + + @override + void didPush(Route route, Route previousRoute) { + super.didPush(route, previousRoute); + if (route is PageRoute) { + _sendScreenView(route); + } + } + + @override + void didReplace({Route newRoute, Route oldRoute}) { + super.didReplace(newRoute: newRoute, oldRoute: oldRoute); + if (newRoute is PageRoute) { + _sendScreenView(newRoute); + } + } + + @override + void didPop(Route route, Route previousRoute) { + super.didPop(route, previousRoute); + // if (previousRoute is PageRoute && route is PageRoute) { + // _sendScreenView(previousRoute); + // } + } +} \ No newline at end of file diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index fed1b69a..dc8749da 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1264,6 +1264,8 @@ const Map localizedValues = { "stretcher": {"en": "Stretcher", "ar": "نقالة"}, "none": {"en": "None", "ar": "لا شيء"}, "RRT-Summary": {"en": "Summary", "ar": "ملخص الطلب"}, + "Rapid-Response-Team": {"en": "Rapid Response Team", "ar": "فريق الاستجابة السريع"}, + "rrtService": {"en": "RRT Service", "ar": "خدمة RRT"}, "bill-amount": {"en": "Bill Amount", "ar": "مبلغ الفاتورة"}, "transport-method": {"en": "Transportation Method", "ar": "طريقة النقل"}, "directions": {"en": "Directions", "ar": "الاتجاهات"}, diff --git a/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart b/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart index 37fdae75..4b38ef65 100644 --- a/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart +++ b/lib/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart @@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/core/model/health_calcolator/get_doctor_by_ import 'package:diplomaticquarterapp/core/model/health_calcolator/get_doctor_list_calcolation_model.dart'; import 'package:diplomaticquarterapp/core/model/health_calcolator/get_doctor_list_calcolation_request_model.dart'; import 'package:diplomaticquarterapp/core/service/base_service.dart'; +import 'package:flutter/cupertino.dart'; class BariatricsService extends BaseService { List clinicCategoryList = []; @@ -75,19 +76,24 @@ class BariatricsService extends BaseService { }, body: body); } - Future getDoctorList() async { + Future getDoctorList({@required DiseasesByClinic disease}) async { hasError = false; - DoctorListByTimeRequestModel _doctorListReq = DoctorListByTimeRequestModel(); - _doctorListReq.isGetNearAppointment = false; - _doctorListReq.continueDentalPlan = false; - _doctorListReq.isSearchAppointmnetByClinicID = true; - _doctorListReq.latitude = 0; - _doctorListReq.longitude = 0; - _doctorListReq.license = true; - _doctorListReq.clinicID = 108; - _doctorListReq.patientID = 0; + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - //body['ClinicID'] = 108; // hint: it is static depend on IONIC project + Map body = Map(); + body['ClinicID'] = 108; // hint: it is static depend on IONIC project + body['ContinueDentalPlan'] = false; + body['IsGetNearAppointment'] = false; + body['IsSearchAppointmnetByClinicID'] = true; + body['LanguageID'] = languageID == 'ar' ? 1 : 2; + body['Latitude'] = 0; + body['License'] = true; + body['Longitude'] = 0; + body['PatientID'] = 0; + body['isDentalAllowedBackend'] = false; + + if(disease != null) + body['DiseaseID'] = disease.diseasesID; await baseAppClient.post(GET_DOCTOR_LIST_BY_TIME, onSuccess: (dynamic response, int statusCode) { doctorListByTime.clear(); @@ -98,6 +104,6 @@ class BariatricsService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: _doctorListReq.toJson()); + }, body: body); } } diff --git a/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart b/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart index 609e5424..53b39025 100644 --- a/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart +++ b/lib/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/core/model/health_calcolator/get_doctor_by_ import 'package:diplomaticquarterapp/core/model/health_calcolator/get_doctor_list_calcolation_model.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/health-calculator/bariatrics-service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:flutter/cupertino.dart'; import '../../../../locator.dart'; @@ -52,9 +53,9 @@ class BariatricsViewModel extends BaseViewModel { } } - void getDoctorList() async { + void getDoctorList({@required DiseasesByClinic disease}) async { setState(ViewState.Busy); - await _service.getDoctorList(); + await _service.getDoctorList(disease:disease); if (_service.hasError) { error = _service.error; setState(ViewState.Error); diff --git a/lib/main.dart b/lib/main.dart index 70ca9d71..bf090720 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,30 +1,29 @@ +import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; -import 'package:diplomaticquarterapp/uitl/HMG_Geofence.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; -import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:firebase_analytics/firebase_analytics.dart'; +import 'package:firebase_analytics/observer.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; -import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; - -import 'Constants.dart'; -import 'config/shared_pref_kay.dart'; import 'config/size_config.dart'; -import 'core/model/geofencing/requests/GeoZonesRequestModel.dart'; -import 'core/service/geofencing/GeofencingServices.dart'; import 'core/viewModels/project_view_model.dart'; import 'locator.dart'; import 'pages/pharmacies/compare-list.dart'; +import 'package:firebase_core/firebase_core.dart'; + void main() async { + WidgetsFlutterBinding.ensureInitialized(); + FirebaseApp defaultApp = await Firebase.initializeApp(); + setupLocator(); runApp(MyApp()); } @@ -35,6 +34,7 @@ class MyApp extends StatefulWidget { } class _MyApp extends State { + @override void initState() { // ProjectViewModel projectProvider; @@ -52,6 +52,7 @@ class _MyApp extends State { .showNow(title: "Payload", subtitle: payload, payload: payload); }); + // final themeNotifier = Provider.of(context); precacheImage(AssetImage('assets/images/powerd-by.jpg'), context); return LayoutBuilder( @@ -82,6 +83,9 @@ class _MyApp extends State { ], child: Consumer( builder: (context, projectProvider, child) => MaterialApp( + navigatorObservers: [ + GAnalytics.shared.navObserver() + ], showSemanticsDebugger: false, title: 'Diplomatic Quarter App', locale: projectProvider.appLocal, diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index 21f277d9..355300c4 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -17,6 +17,7 @@ import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; +import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/info.dart'; @@ -281,12 +282,10 @@ class _AllHabibMedicalServiceState extends State { title: TranslationBase.of(context).childVaccine, ), ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage( - page: ToDo(isShowAppBar: true), - ), - ), + onTap: (){ + Navigator.pop(context); + LandingPage.shared.switchToDoFromHMGServices(); + }, imageLocation: 'assets/images/new-design/upcoming_icon_bottom_bar.png', title: TranslationBase.of(context).todoList, diff --git a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart index a3d67613..c71a0c87 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bariatrics-screen.dart @@ -99,17 +99,8 @@ class _BariatricsPageState extends State { handler: () async { Navigator.push( context, - FadePage(page: DoctorList()), + FadePage(page: DoctorList(diseaseByClinic: _selectedDisease,)), ); - // await model.searchDoctorsByTime(_selectedDisease); - // if (model.state == ViewState.ErrorLocal) { - // AppToast.showErrorToast(message: model.error); - // } else {} - - // Navigator.push( - // context, - // MaterialPageRoute(builder: (context) => BariatricsPage()), - // ); }, ), ), @@ -131,15 +122,6 @@ class _BariatricsPageState extends State { context, FadePage(page: DoctorList()), ); - await model.searchDoctorsByTime(_selectedDisease); - if (model.state == ViewState.ErrorLocal) { - AppToast.showErrorToast(message: model.error); - } - - // Navigator.push( - // context, - // MaterialPageRoute(builder: (context) => BariatricsPage()), - // ); }, ), ), diff --git a/lib/pages/AlHabibMedicalService/health_calculator/doctor_list.dart b/lib/pages/AlHabibMedicalService/health_calculator/doctor_list.dart index b7d50303..4a24ecc2 100644 --- a/lib/pages/AlHabibMedicalService/health_calculator/doctor_list.dart +++ b/lib/pages/AlHabibMedicalService/health_calculator/doctor_list.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/HealthCalculator/DiseasesByClinic.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/health-calculator/Bariatrics-viewmodel.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; @@ -8,13 +9,14 @@ import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; class DoctorList extends StatelessWidget { - const DoctorList({Key key}) : super(key: key); + DiseasesByClinic diseaseByClinic; + DoctorList({Key key, this.diseaseByClinic}) : super(key: key); @override Widget build(BuildContext context) { return BaseView( allowAny: true, - onModelReady: (model) => model.getDoctorList(), + onModelReady: (model) => model.getDoctorList(disease: diseaseByClinic), builder: (BuildContext context, BariatricsViewModel model, Widget child) => AppScaffold( isShowDecPage: false, isShowAppBar: true, diff --git a/lib/pages/ErService/ErOptions.dart b/lib/pages/ErService/ErOptions.dart index e0ff3ed4..a6a61749 100644 --- a/lib/pages/ErService/ErOptions.dart +++ b/lib/pages/ErService/ErOptions.dart @@ -1,8 +1,12 @@ +import 'dart:convert'; + +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import '../../uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/pages/ErService/widgets/card_common.dart'; @@ -23,6 +27,7 @@ class ErOptions extends StatefulWidget { class _ErOptionsState extends State { LocationUtils locationUtils; + ProjectViewModel projectViewModel; @override void initState() { @@ -35,6 +40,9 @@ class _ErOptionsState extends State { } @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + final rrtLocked = !projectViewModel.havePrivilege(68); + return AppScaffold( isShowAppBar: widget.isAppbar, appBarTitle: TranslationBase.of(context).bookAppo, @@ -45,6 +53,7 @@ class _ErOptionsState extends State { children: [ Container( + height: 170, margin: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0), child: Row( mainAxisSize: MainAxisSize.max, @@ -82,6 +91,7 @@ class _ErOptionsState extends State { ), Container( margin: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0), + height: 170, child: Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.start, @@ -94,14 +104,24 @@ class _ErOptionsState extends State { onTap: (){ Navigator.push( context, - FadePage( - page: DdServicesPage())); + FadePage(page: DdServicesPage()) + ); }, ), ), Expanded( - child: Container(), + child: CardCommonEr( + locked: rrtLocked, + image: 'assets/images/new-design/AM.PNG', + text: TranslationBase.of(context).rrtService, + subText: TranslationBase.of(context).RapidResponseTeam, + onTap:(){ + Navigator.push( + context, + FadePage( + page: NearestEr())); + }), ) ], ), diff --git a/lib/pages/ErService/widgets/card_common.dart b/lib/pages/ErService/widgets/card_common.dart index 6b396dc9..cd0dfaa9 100644 --- a/lib/pages/ErService/widgets/card_common.dart +++ b/lib/pages/ErService/widgets/card_common.dart @@ -10,51 +10,72 @@ class CardCommonEr extends StatelessWidget { final image; final text; final subText; + final bool locked; final Function onTap; const CardCommonEr( - {@required this.image, - @required this.text, - @required this.subText, - @required this.onTap}); + { + this.locked = false, + @required this.image, + @required this.text, + @required this.subText, + @required this.onTap, + }); @override Widget build(BuildContext context) { return GestureDetector( - onTap: () => onTap(), - child: Container( - margin: EdgeInsets.fromLTRB(9.0, 9.0, 9.0, 9.0), - decoration: BoxDecoration(boxShadow: [ - BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0) - ], borderRadius: BorderRadius.circular(10), color: Colors.white), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ + onTap: locked ? null : onTap, + child: Opacity( + opacity: locked ? 0.25 : 1.0, + child: Stack( + children: [ Container( - margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), - child: Text(this.text, - overflow: TextOverflow.clip, - style: TextStyle( - color: new Color(0xFFc5272d), - letterSpacing: 1.0, - fontSize: 20.0)), + margin: EdgeInsets.fromLTRB(9.0, 9.0, 9.0, 9.0), + decoration: BoxDecoration(boxShadow: [ + BoxShadow(color: Colors.grey[400], blurRadius: 2.0, spreadRadius: 0.0) + ], borderRadius: BorderRadius.circular(10), color: Colors.white), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 0.0), + child: Text(this.text, + overflow: TextOverflow.clip, + style: TextStyle( + color: new Color(0xFFc5272d), + letterSpacing: 1.0, + fontSize: 20.0)), + ), + Container( + margin: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), + child: Text(this.subText, + overflow: TextOverflow.clip, + style: TextStyle( + color: Colors.black, letterSpacing: 1.0, fontSize: 15.0)), + ), + Spacer(), + Container( + alignment: Alignment.bottomRight, + margin: EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 8.0), + child: Image.asset(this.image, width: 60.0, height: 60.0), + ), + ], ), - Container( - margin: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), - child: Text(this.subText, - overflow: TextOverflow.clip, - style: TextStyle( - color: Colors.black, letterSpacing: 1.0, fontSize: 15.0)), - ), - Container( - alignment: Alignment.bottomRight, - margin: EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 8.0), - child: Image.asset(this.image, width: 60.0, height: 60.0), - ), - ], + ), + if(locked) + Align( + alignment: Alignment.center, + child: lock() + ) + ] , ), ), ); } + Widget lock(){ + return Container(child: Icon(Icons.lock_rounded, size: 80),); + } + } diff --git a/lib/pages/ToDoList/ToDo.dart b/lib/pages/ToDoList/ToDo.dart index 319221d5..febbdf0f 100644 --- a/lib/pages/ToDoList/ToDo.dart +++ b/lib/pages/ToDoList/ToDo.dart @@ -101,6 +101,7 @@ class _ToDoState extends State { return Container( margin: EdgeInsets.all(10.0), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( child: Card( @@ -372,44 +373,32 @@ class _ToDoState extends State { color: Color(0xff20bc44), ), height: 30.0, - margin: projectViewModel.isArabic - ? EdgeInsets.fromLTRB(160.0, 0.0, 30.0, 0.0) - : EdgeInsets.fromLTRB(20.0, 0.0, 160.0, 0.0), + padding: EdgeInsets.only(right:15), + margin: EdgeInsets.symmetric(horizontal:20), transform: Matrix4.translationValues(0.0, -8.0, 0.0), child: Row( + mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, children: [ widget.appoList[index].isLiveCareAppointment - ? Container( - margin: EdgeInsets.fromLTRB( - 5.0, 0.0, 5.0, 0.0), - child: Image.asset( - "assets/images/new-design/video.png"), - ) - : Container( - margin: EdgeInsets.fromLTRB( - 5.0, 0.0, 5.0, 0.0), - child: Image.asset( - "assets/images/new-design/walkin.png"), - ), + ? Image.asset( + "assets/images/new-design/video.png") + : Image.asset( + "assets/images/new-design/walkin.png"), widget.appoList[index].isLiveCareAppointment - ? Container( - child: Text( - TranslationBase.of(context).videoAppo, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 11.0)), - ) - : Container( - child: Text( - TranslationBase.of(context) - .walkinAppo, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 11.0)), - ) + ? Text( + TranslationBase.of(context).videoAppo, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 11.0)) + : Text( + TranslationBase.of(context) + .walkinAppo, + style: TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 11.0)) ], ), ), diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 211e1933..9708db83 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -1,5 +1,6 @@ import 'dart:io'; +import 'package:diplomaticquarterapp/analytics/google-analytics.dart'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/geofencing/requests/GeoZonesRequestModel.dart'; @@ -31,9 +32,11 @@ import 'package:diplomaticquarterapp/widgets/buttons/floatingActionButton.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; +import 'package:firebase_analytics/observer.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; @@ -43,12 +46,22 @@ import '../../routes.dart'; import 'home_page.dart'; class LandingPage extends StatefulWidget { + static LandingPage shared; + _LandingPageState state; + LandingPage() { + LandingPage.shared = this; + } + static bool isOpenCallPage = false; static IncomingCallData incomingCallData = new IncomingCallData(); @override - _LandingPageState createState() => _LandingPageState(); + _LandingPageState createState() => state = _LandingPageState(); + + switchToDoFromHMGServices(){ + state.changeCurrentTab(4); + } } class _LandingPageState extends State with WidgetsBindingObserver { @@ -84,18 +97,22 @@ class _LandingPageState extends State with WidgetsBindingObserver { bool isPageNavigated = false; LocationUtils locationUtils; - _changeCurrentTab(int tab) { + changeCurrentTab(int tab) { setState(() { - currentTab = tab; - if (tab != 0) + if(currentTab > 0 && tab == 2) + pageController.jumpToPage(0); + else if (tab != 0) pageController.jumpToPage(tab); else { IS_VOICE_COMMAND_CLOSED = false; pageController.jumpToPage(tab); } + currentTab = tab; }); } + + @override void didChangeAppLifecycleState(AppLifecycleState state) { super.didChangeAppLifecycleState(state); @@ -189,6 +206,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { // if (results[Permission.calendar].isGranted) ; }); requestPermissions(); + // }); // // //_firebase Background message handler @@ -367,7 +385,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { checkValue(projectProvider) { if (projectProvider.searchValue != null) { - _changeCurrentTab(2); + changeCurrentTab(2); } } @@ -545,7 +563,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { children: [ HomePage( goToMyProfile: () { - _changeCurrentTab(1); + changeCurrentTab(1); }, ), MedicalProfilePage(), @@ -555,7 +573,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { ], // Please do not remove the BookingOptions from this array ), bottomNavigationBar: BottomNavBar( - changeIndex: _changeCurrentTab, + changeIndex: changeCurrentTab, index: currentTab, ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked , @@ -564,7 +582,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { ? FloatingButton( elevation: true, onTap: () { - _changeCurrentTab(2); + changeCurrentTab(2); }) : null); } diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 7f2877ee..c5da90d5 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; @@ -40,6 +41,7 @@ class Login extends StatefulWidget { class _Login extends State { final util = Utils(); final nationalIDorFile = TextEditingController(); + final mobileNumberController = TextEditingController(); final int loginType = LoginType.loginType; String mobileNo; String countryCode = '966'; @@ -62,6 +64,11 @@ class _Login extends State { void initState() { // getDeviceToken(); super.initState(); + + if(BASE_URL.contains("uat.")){ + nationalIDorFile.text = "1231755"; + mobileNumberController.text = mobileNo = "537503378"; + } } getDeviceToken() async { @@ -102,6 +109,7 @@ class _Login extends State { Directionality( textDirection: TextDirection.ltr, child: MobileNo( + controller: mobileNumberController, onNumberChange: (value) => {mobileNo = value, validateForm()}, onCountryChange: (value) => countryCode = value)), diff --git a/lib/splashPage.dart b/lib/splashPage.dart index ef5db7f5..f75680ef 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -3,9 +3,12 @@ import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:firebase_analytics/observer.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; +import 'analytics/google-analytics.dart'; import 'config/shared_pref_kay.dart'; import 'config/size_config.dart'; import 'core/service/AuthenticatedUserObject.dart'; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index c3875466..2a966715 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -1159,6 +1159,8 @@ class TranslationBase { String get stretcher => localizedValues['stretcher'][locale.languageCode]; String get none => localizedValues['none'][locale.languageCode]; String get RRTSummary => localizedValues['RRT-Summary'][locale.languageCode]; + String get RapidResponseTeam => localizedValues['Rapid-Response-Team'][locale.languageCode]; + String get rrtService => localizedValues['rrtService'][locale.languageCode]; String get billAmount => localizedValues['bill-amount'][locale.languageCode]; String get transportMethod => localizedValues['transport-method'][locale.languageCode]; diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 5636de56..06aeca9d 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -551,6 +551,25 @@ openAppStore({String androidPackageName, String iOSAppID}) async { launch("https://itunes.apple.com/kr/app/apple-store/$iOSAppID)"); } } + +String labelFrom({@required String className}){ + RegExp exp = RegExp(r'(?<=[a-z])[A-Z]'); + + String result = className.replaceAllMapped(exp, (m) { + var str = m.group(0); + if(str != null){ + return ('_' + str); + } + return ""; + }); + + if(result.isEmpty) + return className; + + result = result.replaceAll("_", " "); + return result; +} + /* userBoard.asMap().map((i, element) => MapEntry(i, Stack( GestureDetector(onTap: () { diff --git a/pubspec.yaml b/pubspec.yaml index f06257a9..aab0cf32 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: # Localizations flutter_localizations: sdk: flutter - intl: ^0.16.1 + intl: ^0.16.0 # web view webview_flutter: ^0.3.24 # http client @@ -52,6 +52,7 @@ dependencies: shared_preferences: ^0.5.8 flutter_flexible_toast: ^0.1.4 firebase_messaging: ^7.0.3 + firebase_analytics: ^6.3.0 cloud_firestore: ^0.14.3 android_intent: ^0.3.7+7 # Progress bar