diff --git a/Certs/APNSDevPushCert.p12 b/Certs/APNSDevPushCert.p12 new file mode 100644 index 00000000..dba27aec Binary files /dev/null and b/Certs/APNSDevPushCert.p12 differ diff --git a/Certs/APNSProdCert.certSigningRequest b/Certs/APNSProdCert.certSigningRequest new file mode 100644 index 00000000..3f13a387 --- /dev/null +++ b/Certs/APNSProdCert.certSigningRequest @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIICkDCCAXgCAQAwSzEjMCEGCSqGSIb3DQEJARYUaGFyb29uNjEzOEBnbWFpbC5j +b20xFzAVBgNVBAMMDk1vaGFtZWQgTWVrYXd5MQswCQYDVQQGEwJBRTCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBALcPrk09MmhQhRNe8LYdaeN4mYtoKJg3 +SndMLgpxnaRqP7a6f4sp118wCFZsTXnwhPVP4DzmXWc2AzZtsusmhdw1tzNFtme0 +PtEjDXIPI2lHU3Zhi2zukZdAVxF+uNi3pcp0axina60ZQciIfb/7Fx6hNbqpk90E +O8a2Ob17Wq/ZTYIP4H7ZGydUe2ra9QyDtjmGj9vpEv+xXYWX685sgEylTG14DSOP +ozGsQmaf+QCMbCT3osq7idWc1IQ+3Oed0kUTx1jmRtZwPzQkJJ1Bx3vYSXN/EOlb +u+ei1Nqtc14aVCYvmcuvGDtMyRtw6w+syCw2CpJCPGNkxNz+EH9h+EUCAwEAAaAA +MA0GCSqGSIb3DQEBCwUAA4IBAQBYdu2AaZY6kReuT1Xp8ktlyPfjBRKhPPChuaeR +tFnYMsJtG0aIA/xOu4/RYDgmL92seimULXd9DIPvkJ2DuaB+bdfGTw0qXUlihkm8 +ui5O0L2F9OZbQxJogvTmrMsKnkoR27O5vyfCn9VMOLk3x1nyEzAXIj/5GHWw9T6t +r65jPUOfm6ikiZtICBzSaTPBtyfZB8mrbwG2dpOvVNSa1dj3xip4L8CL6TxH+qM3 ++N90QFYjvjphJkpn2Kt0ow9IyIyeqJbIYJmsWoV9pXddOHCjKdTWUjq7D2Jn3eUA +DAKjKgVqF4/dU10k7EtSfrw01aHLXjj5FxsD5YhVrgTA5xSq +-----END CERTIFICATE REQUEST----- diff --git a/Certs/APNSProdCert.p12 b/Certs/APNSProdCert.p12 new file mode 100644 index 00000000..b0ada453 Binary files /dev/null and b/Certs/APNSProdCert.p12 differ diff --git a/Certs/ApplePushServicesSandbox.certSigningRequest b/Certs/ApplePushServicesSandbox.certSigningRequest new file mode 100644 index 00000000..7d509a0a --- /dev/null +++ b/Certs/ApplePushServicesSandbox.certSigningRequest @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIICkDCCAXgCAQAwSzEjMCEGCSqGSIb3DQEJARYUaGFyb29uNjEzOEBnbWFpbC5j +b20xFzAVBgNVBAMMDk1vaGFtZWQgTWVrYXd5MQswCQYDVQQGEwJBRTCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnHqsyE7WfiVcE1Lpa4t4OVO6qlll2q +1djs0XG06R/dlDtIqv4940/XLj+hU93mzAcVvFW4DSIEdD3InM3+T6oMTjPu6meU +69h9ryaVkluQRrT/tdGI1EKO4MWGMe4MDIt7DqMhMfAcxTwekwdxdKaCEhaw3qnA +l/64AelY6URW1pHHJMA0VV7j+pE3jVNai+muMXPrhQ1VrOrV8FftpY3bEeRJR2Cl +T0tv0LhEMu4SfLnVWCzGQQC82hilDw3rH3ZDs8DFxF9agNVdwKlYamarh1dQXwRq +Yx2+sjY1/51r9L4VS+GAh9ECxz0e+43NpzfZ/N+mTeDYKDepaBwPQ6kCAwEAAaAA +MA0GCSqGSIb3DQEBCwUAA4IBAQB89OyLfywKT7ftmpEqCmgsmaJexb580q9w8wOk +1JhJkNV5ec+p1dnge2NZeJ4LGII/5wmPj1vANNW0GZdmJDgnC+2gg9toq1QLCAsF +rW7/LMpgAoEH+P5bhrHV9RRv6BQi0ZmN0apBHjp/pqZfm2Cl5jQPEWjUEf2tIF4l +LSKdok6IPO9n4Fgyk0XdUNSEhgVhsLtZkGiXnkI1YovKDnupTFYPXMLp103bc9zP +xDxwscvOysNDijlzZAkJPg2z8NrJIRDrKvLRHzxQwZ/1LHVB/51bp/1iyks3vOjh +qw5XVsrtGAjCjU9md7q3XkPSyKzhK9UqPdOxdvl1OY0KKIIY +-----END CERTIFICATE REQUEST----- diff --git a/Certs/aps.cer b/Certs/aps.cer index fb46df86..d95bac40 100644 Binary files a/Certs/aps.cer and b/Certs/aps.cer differ diff --git a/Certs/aps_development.cer b/Certs/aps_development.cer new file mode 100644 index 00000000..9a9934bb Binary files /dev/null and b/Certs/aps_development.cer differ diff --git a/CustomFlutterFirebaseMessagingService.java b/CustomFlutterFirebaseMessagingService.java new file mode 100644 index 00000000..0a4d83be --- /dev/null +++ b/CustomFlutterFirebaseMessagingService.java @@ -0,0 +1,17 @@ +package io.flutter.plugins.firebasemessaging; + +import android.content.Intent; + +import com.google.firebase.messaging.RemoteMessage; + +public class CustomFlutterFirebaseMessagingService extends FlutterFirebaseMessagingService { + @Override + public void onMessageReceived(RemoteMessage remoteMessage) { + if (remoteMessage.getData().containsKey("is_call")) { + Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName()); + startActivity(intent); + super.onMessageReceived(remoteMessage); + } else + super.onMessageReceived(remoteMessage); + } +} \ No newline at end of file diff --git a/android/CustomFlutterFirebaseMessagingService.java b/android/CustomFlutterFirebaseMessagingService.java new file mode 100644 index 00000000..0a4d83be --- /dev/null +++ b/android/CustomFlutterFirebaseMessagingService.java @@ -0,0 +1,17 @@ +package io.flutter.plugins.firebasemessaging; + +import android.content.Intent; + +import com.google.firebase.messaging.RemoteMessage; + +public class CustomFlutterFirebaseMessagingService extends FlutterFirebaseMessagingService { + @Override + public void onMessageReceived(RemoteMessage remoteMessage) { + if (remoteMessage.getData().containsKey("is_call")) { + Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName()); + startActivity(intent); + super.onMessageReceived(remoteMessage); + } else + super.onMessageReceived(remoteMessage); + } +} \ No newline at end of file diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 6d2cff69..ea14b71f 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -362,6 +362,8 @@ const Map> localizedValues = { "medicalProfile": {"en": "Medical Profile", 'ar': 'الملف الطبي'}, "consultation": {"en": "Consultation", "ar": "استشارة"}, "logs": {"en": "Logs", "ar": "السجلات"}, + "textToSpeech": {"en": "How May I Help You?", "ar": "كيف يمكنني مساعدتك؟"}, + "locationDialogMessage": {"en": "Allow the HMG app to access your location will assist you in showing the hospitals according to the nearest to you.", "ar": "السماح لتطبيق مجموعة الحبيب الطبية بالوصول إلى موقعك سيساعدك في إظهار المستشفيات وفقًا للأقرب إليك."} "parking":{"en":"Parking","ar":"مواقف"}, "alhabiServices":{"en":"HMG Service","ar":"خدمات الحبيب"}, "parkingTitle":{"en":"Car service, car service, service to save parking information, return to it later, 1- By clicking on (Read the code), save the parking data. 2- By clicking on the button (view my car park), it shows you the car’s location in Google Maps. 3- Read another position by pressing the Clear Position Data button.","ar":" خدمة المواقف، تتيح هذه الخدمة للمستخدم معلومات عن موقف السيارة ليسهل عليه العودة لها لاحقاً ، 1- بالضغط على زر(قراءة الكود) تستطيع حفظ البيانات الخاصة بالموقف. 2-بالضغط على زر(عرض موقف سيارتي) يعرض لك موقع السيارة في خرائط قوقل. 3- لإعادة قراءة موقف آخرعن طريق الضغط على زر(مسح بيانات الموقف). "}, diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index c9da9fe7..61e36022 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -11,4 +11,6 @@ const AUTH_DATA = 'auth-data'; const IMEI_USER_DATA = 'imei-user-data'; const NHIC_DATA = 'nhic-data'; const FAMILY_FILE = 'family-file'; +const USER_LAT = 'user-lat'; +const USER_LONG = 'user-long'; const IS_GO_TO_PARKING = 'IS_GO_TO_PARKING'; diff --git a/lib/main.dart b/lib/main.dart index ce0e097c..f641f22e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,4 @@ -import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; -import 'package:diplomaticquarterapp/pages/login/login.dart'; import 'package:diplomaticquarterapp/routes.dart'; -import 'package:diplomaticquarterapp/uitl/navigation_service.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 2f4ee2a0..07563a25 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -30,7 +30,7 @@ class DoctorList { int noOfPatientsRate; int originalClinicID; int personRate; - int projectDistanceInKiloMeters; + dynamic projectDistanceInKiloMeters; String qR; dynamic qRString; int rateNumber; diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 8c1d781c..88ecdb6b 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -502,8 +502,6 @@ class _BookConfirmState extends State { Future navigateToBookSuccess(context, DoctorList docObject, PatientShareResponse patientShareResponse) async { - print(widget.appoDateFormatted); -// print(widget.appoTimeFormatted); Navigator.push( context, diff --git a/lib/pages/BookAppointment/BookingOptions.dart b/lib/pages/BookAppointment/BookingOptions.dart index dacb25e9..b6dc5500 100644 --- a/lib/pages/BookAppointment/BookingOptions.dart +++ b/lib/pages/BookAppointment/BookingOptions.dart @@ -1,19 +1,36 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/CardCommon.dart'; -import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; import '../../uitl/translations_delegate_base.dart'; -class BookingOptions extends StatelessWidget { +class BookingOptions extends StatefulWidget { final bool isAppbar; + BookingOptions({this.isAppbar = false}); + + @override + _BookingOptionsState createState() => _BookingOptionsState(); +} + +class _BookingOptionsState extends State { + LocationUtils locationUtils; + + @override + void initState() { + locationUtils = + new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance + .addPostFrameCallback((_) => locationUtils.getCurrentLocation()); + + super.initState(); + } + @override Widget build(BuildContext context) { - final searchValue = Provider.of(context); return AppScaffold( - isShowAppBar: isAppbar, + isShowAppBar: widget.isAppbar, appBarTitle: TranslationBase.of(context).bookAppo, body: Container( margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), diff --git a/lib/pages/BookAppointment/Search.dart b/lib/pages/BookAppointment/Search.dart index d3ceaafd..b5f83c4c 100644 --- a/lib/pages/BookAppointment/Search.dart +++ b/lib/pages/BookAppointment/Search.dart @@ -1,9 +1,11 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByClinic.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByDoctor.dart'; +import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; -import 'package:diplomaticquarterapp/widgets/others/floating_button_search.dart'; import 'package:flutter/material.dart'; +import 'package:geolocator/geolocator.dart'; class Search extends StatefulWidget { final int type; diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index 7da5112b..5d74cc59 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -1,11 +1,11 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; +import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; -import 'widgets/DoctorView.dart'; - class SearchResults extends StatefulWidget { List doctorsList = []; @@ -49,19 +49,51 @@ class _SearchResultsState extends State { body: Container( margin: EdgeInsets.only(bottom: 10.0), child: SingleChildScrollView( - child: ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - itemCount: widget.doctorsList.length, - itemBuilder: (context, index) { - return DoctorView( - //AJ note - doctor: widget.doctorsList[index], - ); - }, + physics: BouncingScrollPhysics(), + child: FractionallySizedBox( + widthFactor: 1.0, + child: Column( + children: [ + ...List.generate( + widget.doctorsList.length, + (index) => AppExpandableNotifier( + title: widget.doctorsList[index].projectName, + bodyWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: widget.doctorsList.map((doctorObj) { + return DoctorView( + doctor: doctorObj, + ); + }).toList(), + ), + ), + ) + ], + ), ), + +// ListView.builder( +// scrollDirection: Axis.vertical, +// shrinkWrap: true, +// physics: ScrollPhysics(), +// padding: EdgeInsets.all(0.0), +// itemCount: widget.doctorsList.length, +// itemBuilder: (context, index) { +// return AppExpandableNotifier( +// title: widget.doctorsList[index].projectName, +// bodyWidget: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// children: widget.doctorsList.map((labOrder) { +// return DoctorView( +// doctor: widget.doctorsList[index], +// ); +// }).toList(), +// ), +// ); +// }, +// ), ), ), ); diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 28e3bcb6..2705b4dc 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -1,4 +1,4 @@ -import 'dart:convert'; +import "dart:collection"; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Clinics/ClinicListResponse.dart'; @@ -6,16 +6,11 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/BranchView.da import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; -import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; -import '../SearchResults.dart'; -import "dart:collection"; - class SearchByClinic extends StatefulWidget { final List clnicIds; SearchByClinic({this.clnicIds}); @@ -32,7 +27,6 @@ class _SearchByClinicState extends State { @override void initState() { WidgetsBinding.instance.addPostFrameCallback((_) => getClinicsList()); - super.initState(); } @@ -114,36 +108,43 @@ class _SearchByClinicState extends State { getDoctorsList(BuildContext context) { List doctorsList = []; - //======================== List arr = []; + List arrDistance = []; var distinctIds; List result; int numAll; - //========================= DoctorsListService service = new DoctorsListService(); service.getDoctorsList(int.parse(dropdownValue), 0, context).then((res) { if (res['MessageStatus'] == 1) { setState(() { if (res['DoctorList'].length != 0) { + print(res['DoctorList']); doctorsList.clear(); res['DoctorList'].forEach((v) { doctorsList.add(new DoctorList.fromJson(v)); arr.add(new DoctorList.fromJson(v).projectName); - // print(DoctorList.fromJson(v).projectName); - // print(DoctorList.fromJson(v).projectDistanceInKiloMeters); - // distinctIds = result.toSet().toList(); + arrDistance.add(new DoctorList.fromJson(v) + .projectDistanceInKiloMeters + .toString()); + +// print(DoctorList +// .fromJson(v) +// .projectName); +// print(DoctorList +// .fromJson(v) +// .projectDistanceInKiloMeters); +// distinctIds = result.toSet().toList(); }); } else {} }); result = LinkedHashSet.from(arr).toList(); numAll = result.length; - // print(result); - print("numAll=" + numAll.toString()); - navigateToSearchResults(context, doctorsList, result, numAll); + navigateToSearchResults( + context, doctorsList, result, numAll, arrDistance); } else { AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } @@ -153,12 +154,17 @@ class _SearchByClinicState extends State { text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } - Future navigateToSearchResults(context, docList, result, numAll) async { + Future navigateToSearchResults( + context, docList, result, numAll, resultDistance) async { Navigator.push( context, MaterialPageRoute( - builder: (context) => - BranchView(doctorsList: docList, result: result, num: numAll), +// builder: (context) => SearchResults(doctorsList: docList) + builder: (context) => BranchView( + doctorsList: docList, + result: result, + num: numAll, + resultDistance: resultDistance), ), ); //builder: (context) => SearchResults(doctorsList: docList))); diff --git a/lib/pages/BookAppointment/widgets/BranchView.dart b/lib/pages/BookAppointment/widgets/BranchView.dart index 82c38cb2..8ec0bbd5 100644 --- a/lib/pages/BookAppointment/widgets/BranchView.dart +++ b/lib/pages/BookAppointment/widgets/BranchView.dart @@ -1,8 +1,6 @@ import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:flutter/material.dart'; - import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -12,9 +10,11 @@ class BranchView extends StatefulWidget { final List doctorsList; final List result; + final List resultDistance; final int num; - const BranchView({Key key, this.doctorsList, this.result, this.num}) + const BranchView( + {Key key, this.doctorsList, this.result, this.resultDistance, this.num}) : super(key: key); @override @@ -30,8 +30,8 @@ class _BranchViewState extends State { body: new ListView.builder( itemBuilder: (BuildContext context, int index) { return new ExpandableListView( - result2: widget.result, + resultDistance: widget.resultDistance, val: index, doctorsList2: widget.doctorsList); }, @@ -42,13 +42,13 @@ class _BranchViewState extends State { } class ExpandableListView extends StatefulWidget { - final List result2; + final List resultDistance; final List doctorsList2; final val; const ExpandableListView( - {Key key, this.result2, this.val, this.doctorsList2}) + {Key key, this.result2, this.resultDistance, this.val, this.doctorsList2}) : super(key: key); @override @@ -61,11 +61,9 @@ class _ExpandableListViewState extends State { @override Widget build(BuildContext context) { return new Container( - // margin: new EdgeInsets.symmetric(vertical: 1.0), width: MediaQuery.of(context).size.width * 0.6, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0), + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 0.0), child: Card( - // margin: EdgeInsets.fromLTRB(20.0, 16.0, 20.0, 8.0), color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), @@ -77,19 +75,26 @@ class _ExpandableListViewState extends State { child: new Column( children: [ new Container( + margin: EdgeInsets.only(left: 5.0, right: 5.0), color: Colors.white, - // padding: new EdgeInsets.symmetric(horizontal: 5.0), child: new Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ new Text( - widget.result2[widget.val].toString()+" "+ "22 كم", + widget.result2[widget.val].toString() + + " " + + widget.resultDistance[widget.val] + .toString() != + "0" + ? getProjectDistance( + widget.resultDistance[widget.val].toString()) + : "", style: new TextStyle( fontWeight: FontWeight.bold, color: Colors.black), ), new IconButton( icon: new Container( - height: 30.0, + height: 28.0, width: 30.0, decoration: new BoxDecoration( color: Colors.red, @@ -124,13 +129,14 @@ class _ExpandableListViewState extends State { itemCount: widget.doctorsList2.length, itemBuilder: (context, index) { return widget.result2[widget.val].toString() == - widget.doctorsList2[index].projectName.toString()? DoctorView( - //AJ note - doctor: - widget.doctorsList2[index] - - // widget.doctorsList2[index] - ):Container(); + widget.doctorsList2[index].projectName.toString() + ? DoctorView( + //AJ note + doctor: widget.doctorsList2[index] + + // widget.doctorsList2[index] + ) + : Container(); }, ), ) @@ -140,6 +146,10 @@ class _ExpandableListViewState extends State { ), ); } + + String getProjectDistance(String distance) { + return " - " + distance + " KM"; + } } class ExpandableContainer extends StatelessWidget { @@ -162,7 +172,7 @@ class ExpandableContainer extends StatelessWidget { duration: new Duration(milliseconds: 500), curve: Curves.easeInOut, width: screenWidth, - height: expanded ? expandedHeight : collapsedHeight, + height: expanded ? MediaQuery.of(context).size.height : collapsedHeight, child: new Container( child: child, decoration: new BoxDecoration( diff --git a/lib/pages/BookAppointment/widgets/DoctorView.dart b/lib/pages/BookAppointment/widgets/DoctorView.dart index 3d69a93d..e8f08af5 100644 --- a/lib/pages/BookAppointment/widgets/DoctorView.dart +++ b/lib/pages/BookAppointment/widgets/DoctorView.dart @@ -21,7 +21,7 @@ class DoctorView extends StatelessWidget { getDoctorsProfile(context, doctor); }, child: Card( - margin: EdgeInsets.fromLTRB(20.0, 16.0, 20.0, 8.0), + margin: EdgeInsets.fromLTRB(10.0, 16.0, 10.0, 8.0), color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), @@ -39,7 +39,7 @@ class DoctorView extends StatelessWidget { fit: BoxFit.fill, height: 60.0, width: 60.0), ), Container( - width: MediaQuery.of(context).size.width * 0.6, + width: MediaQuery.of(context).size.width * 0.5, margin: EdgeInsets.fromLTRB(20.0, 10.0, 10.0, 0.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/pages/conference/conference_button_bar.dart b/lib/pages/conference/conference_button_bar.dart index d9abd212..d49c4e4a 100644 --- a/lib/pages/conference/conference_button_bar.dart +++ b/lib/pages/conference/conference_button_bar.dart @@ -212,6 +212,11 @@ class _ConferenceButtonBarState extends State with AfterLay key: Key('microphone-button'), onPressed: () => _onPressed(widget.onAudioEnabled), ), + CircleButton( + child: const Icon(Icons.switch_camera, color: Colors.white), + key: Key('switch-camera-button'), + onPressed: () => _onPressed(widget.onSwitchCamera), + ), CircleButton( radius: 35, child: const RotationTransition( @@ -226,11 +231,6 @@ class _ConferenceButtonBarState extends State with AfterLay key: Key('hangup-button'), onPressed: () => _onPressed(widget.onHangup), ), - CircleButton( - child: const Icon(Icons.switch_camera, color: Colors.white), - key: Key('switch-camera-button'), - onPressed: () => _onPressed(widget.onSwitchCamera), - ), ], ), ); diff --git a/lib/pages/conference/conference_page.dart b/lib/pages/conference/conference_page.dart index 60ffb0d5..7848d4f7 100644 --- a/lib/pages/conference/conference_page.dart +++ b/lib/pages/conference/conference_page.dart @@ -217,21 +217,21 @@ class _ConferencePageState extends State { ); } - if (length <= 3) { - buildInCols(true, false, 1); - } else if (length == 5) { - buildInCols(false, true, 2); - } else if (length <= 6 || length == 8) { - buildInCols(false, false, 2); - } else if (length == 7 || length == 9) { - buildInCols(true, false, 2); - } else if (length == 10) { - buildInCols(false, true, 3); - } else if (length == 13 || length == 16) { - buildInCols(true, false, 3); - } else if (length <= 18) { - buildInCols(false, false, 3); - } +// if (length <= 3) { +// buildInCols(true, false, 1); +// } else if (length == 5) { +// buildInCols(false, true, 2); +// } else if (length <= 6 || length == 8) { +// buildInCols(false, false, 2); +// } else if (length == 7 || length == 9) { +// buildInCols(true, false, 2); +// } else if (length == 10) { +// buildInCols(false, true, 3); +// } else if (length == 13 || length == 16) { +// buildInCols(true, false, 3); +// } else if (length <= 18) { +// buildInCols(false, false, 3); +// } return Column( children: children, diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 0e25c819..7f1316ed 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -15,6 +15,7 @@ import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/cupertino.dart'; @@ -107,6 +108,18 @@ class _LandingPageState extends State with WidgetsBindingObserver { }); pageController = PageController(keepPage: true); _firebaseMessaging.setAutoInitEnabled(true); + + if (Platform.isIOS) { + _firebaseMessaging.requestNotificationPermissions( +// const IosNotificationSettings( +// sound: true, +// badge: true, +// alert: true, +// provisional: true, +// ), + ); + } + _firebaseMessaging.getToken().then((String token) { sharedPref.setString(PUSH_TOKEN, token); if (token != null) { @@ -118,6 +131,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { //_firebase Background message handler _firebaseMessaging.configure( onMessage: (Map message) async { + showDialog("onMessage: $message"); print("onMessage: $message"); print(message); print(message['name']); @@ -187,19 +201,68 @@ class _LandingPageState extends State with WidgetsBindingObserver { onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler, onLaunch: (Map message) async { print("onLaunch: $message"); + showDialog("onLaunch: $message"); }, onResume: (Map message) async { print("onResume: $message"); + print(message); + print(message['name']); + print(message['appointmentdate']); + + showDialog("onResume: $message"); + + if (Platform.isIOS) { + if (message['is_call'] == "true") { + var route = ModalRoute.of(context); + + if (route != null) { + print(route.settings.name); + } + + Map myMap = + new Map.from(message); + print(myMap); + LandingPage.isOpenCallPage = true; + LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); + if (!isPageNavigated) { + isPageNavigated = true; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => IncomingCall( + incomingCallData: LandingPage.incomingCallData))) + .then((value) { + isPageNavigated = false; + }); + } + } else { + print("Is Call Not Found iOS"); + } + } else { + print("Is Call Not Found iOS"); + } }, ); } + showDialog(String message) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: message, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => {}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + void requestPermissions() async { await [ Permission.location, Permission.storage, Permission.camera, Permission.photos, + Permission.notification, Permission.accessMediaLocation ].request(); } diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 77c3e741..9100a64e 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -14,7 +14,6 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:smart_progress_bar/smart_progress_bar.dart'; @@ -49,7 +48,7 @@ class _clinic_listState extends State { liveCareClinicsListResponse = new LiveCareClinicsListResponse(); WidgetsBinding.instance.addPostFrameCallback((_) { // Future.delayed(new Duration(milliseconds: 1200), () { - getLiveCareClinicsList(); + getLiveCareClinicsList(); // }); }); getLanguageID(); @@ -58,79 +57,82 @@ class _clinic_listState extends State { @override Widget build(BuildContext context) { - return AppScaffold( - isShowAppBar: false, - body: SingleChildScrollView( - child: isDataLoaded - ? Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: EdgeInsets.all(15.0), - child: Text("Online Clinics: ", - style: TextStyle( - fontSize: 20.0, fontWeight: FontWeight.bold)), - ), - ListView.builder( - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: ScrollPhysics(), - padding: EdgeInsets.all(0.0), - itemCount: liveCareClinicsListResponse - .patientERGetClinicsList.length, - itemBuilder: (context, index) { - return InkWell( - onTap: () { - updateSelectedIndex(liveCareClinicsListResponse - .patientERGetClinicsList[index]); - }, - child: ClinicCard( - isSelected: selectedClinicID == - liveCareClinicsListResponse - .patientERGetClinicsList[index] - .serviceID - ? true - : false, - patientERGetClinicsList: liveCareClinicsListResponse - .patientERGetClinicsList[index], - languageID: languageID, - ), - ); - }, - ), - Container( - height: 80.0, - ), - ], - ), - ) - : Container(), - ), - bottomSheet: Container( - width: MediaQuery.of(context).size.width, - height: 50.0, - margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), - child: ButtonTheme( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - minWidth: MediaQuery.of(context).size.width * 0.7, - height: 45.0, - child: RaisedButton( - color: new Color(0xFF60686b), - textColor: Colors.white, - disabledTextColor: Colors.white, - disabledColor: new Color(0xFFbcc2c4), - onPressed: startLiveCare, - child: Text("Start", style: TextStyle(fontSize: 18.0)), - ), - ), + return SingleChildScrollView( + child: Column( + children: [ + isDataLoaded + ? Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: EdgeInsets.all(15.0), + child: Text("Online Clinics: ", + style: TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold)), + ), + ListView.builder( + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: ScrollPhysics(), + padding: EdgeInsets.all(0.0), + itemCount: liveCareClinicsListResponse + .patientERGetClinicsList.length, + itemBuilder: (context, index) { + return InkWell( + onTap: () { + updateSelectedIndex(liveCareClinicsListResponse + .patientERGetClinicsList[index]); + }, + child: ClinicCard( + isSelected: selectedClinicID == + liveCareClinicsListResponse + .patientERGetClinicsList[index] + .serviceID + ? true + : false, + patientERGetClinicsList: + liveCareClinicsListResponse + .patientERGetClinicsList[index], + languageID: languageID, + ), + ); + }, + ), + Container( + height: 10.0, + ), + ], + ), + ) + : Container(), + isDataLoaded ? Container( + width: MediaQuery.of(context).size.width, + height: 50.0, + margin: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), + child: ButtonTheme( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + minWidth: MediaQuery.of(context).size.width * 0.7, + height: 45.0, + child: RaisedButton( + color: new Color(0xFF60686b), + textColor: Colors.white, + disabledTextColor: Colors.white, + disabledColor: new Color(0xFFbcc2c4), + onPressed: startLiveCare, + child: Text("Start", style: TextStyle(fontSize: 18.0)), + ), + ), + ) : Container(), + ], ), ); } void startLiveCare() { + bool isError = false; LiveCareService service = new LiveCareService(); ERAppointmentFeesResponse erAppointmentFeesResponse = new ERAppointmentFeesResponse(); @@ -141,12 +143,15 @@ class _clinic_listState extends State { }) .catchError((err) { print(err); + isError = true; + AppToast.showErrorToast(message: err); }) .showProgressBar( text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) .then((value) { - getERAppointmentTime( - erAppointmentFeesResponse.getERAppointmentFeesList); + if (!isError) + getERAppointmentTime( + erAppointmentFeesResponse.getERAppointmentFeesList); }); } @@ -158,6 +163,7 @@ class _clinic_listState extends State { getERAppointmentFeesList, res['WatingtimeInteger']); }).catchError((err) { print(err); + AppToast.showErrorToast(message: err); }).showProgressBar( text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); } @@ -339,14 +345,17 @@ class _clinic_listState extends State { service .addNewCallForPatientER(selectedClinicID, clientRequestID, context) .then((res) { - AppToast.showSuccessToast( - message: "New Call has been added successfully"); - }).catchError((err) { - print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)).then((value) { - widget.getLiveCareHistory(); - }); + AppToast.showSuccessToast( + message: "New Call has been added successfully"); + }) + .catchError((err) { + print(err); + }) + .showProgressBar( + text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)) + .then((value) { + widget.getLiveCareHistory(); + }); } getLanguageID() async { diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index f223f91f..7510987c 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -2,22 +2,17 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; -import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_request.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_paitent_authentication_req.dart'; -import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; -import 'package:diplomaticquarterapp/models/Authentication/select_device_imei_res.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/login/login-type.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; -import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart'; -import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; -import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart'; import 'package:diplomaticquarterapp/widgets/input/text_field.dart'; import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -26,7 +21,6 @@ import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; class Login extends StatefulWidget { @override @@ -48,9 +42,16 @@ class _Login extends State { @override void initState() { +// getDeviceToken(); super.initState(); } + getDeviceToken() async { + setState(() async { + nationalIDorFile.text = await sharedPref.getString(PUSH_TOKEN); + }); + } + @override Widget build(BuildContext context) { return AppScaffold( @@ -196,7 +197,10 @@ class _Login extends State { this.sharedPref.setObject(USER_PROFILE, result.list), this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID), this.sharedPref.setString(TOKEN, result.authenticationTokenID), - + //this.checkIfUserAgreedBefore(result), + Navigator.of(context).pushNamed( + HOME, + ), appointmentRateViewModel .getIsLastAppointmentRatedList() .then((value) => { @@ -219,7 +223,6 @@ class _Login extends State { ) } }) - // SMSOTP.showLoadingDialog(context, false), }); } diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index b183aa63..4f16ab77 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -20,6 +20,9 @@ class DoctorsListService extends BaseService { AuthenticatedUser authUser = new AuthenticatedUser(); AuthProvider authProvider = new AuthProvider(); + double lat; + double long; + Future getDoctorsList(int clinicID, int projectID, BuildContext context, {doctorId}) async { //Utils.showProgressDialog(context); @@ -31,6 +34,12 @@ class DoctorsListService extends BaseService { authUser = data; } + if (await this.sharedPref.getDouble(USER_LAT) != null && + await this.sharedPref.getDouble(USER_LONG) != null) { + lat = await this.sharedPref.getDouble(USER_LAT); + long = await this.sharedPref.getDouble(USER_LONG); + } + var languageID = await sharedPref.getString(APP_LANGUAGE); Request req = appGlobal.getPublicRequest(); request = { @@ -52,11 +61,14 @@ class DoctorsListService extends BaseService { "gender": authUser.gender != null ? authUser.gender : 0, "age": authUser.age != null ? authUser.age : 0, "IsGetNearAppointment": false, - "Latitude": 0, - "Longitude": 0, - "License": true, + // "Latitude": 0, + // "Longitude": 0, + // "License": true, // "IsVoiceCommand": doctorId != null && doctorId.length > 0 ? true : false, // "DoctorIDsList": doctorId + "Latitude": lat.toString(), + "Longitude": long.toString(), + "License": true }; dynamic localRes; diff --git a/lib/uitl/location_util.dart b/lib/uitl/location_util.dart new file mode 100644 index 00000000..e3012734 --- /dev/null +++ b/lib/uitl/location_util.dart @@ -0,0 +1,69 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:geolocator/geolocator.dart'; + +class LocationUtils { + AppSharedPreferences sharedPref = new AppSharedPreferences(); + + bool isShowConfirmDialog; + BuildContext context; + + LocationUtils({@required this.isShowConfirmDialog, @required this.context}); + + void getCurrentLocation() async { + print("current location"); + isLocationServiceEnabled().then((value) { + if (value) { + checkPermission().then((permission) { + if (permission == LocationPermission.always || + permission == LocationPermission.whileInUse) { + getLastKnownPosition().then((value) => setLocation(value)); + } + + if (permission == LocationPermission.denied || + permission == LocationPermission.deniedForever) { + setZeroLocation(); + if (isShowConfirmDialog) showErrorLocationDialog(false); + } + }).catchError((err) { + print(err); + }); + } else { + if (isShowConfirmDialog) showErrorLocationDialog(false); + } + }).catchError((err) { + print(err); + }); + } + + showErrorLocationDialog(bool isPermissionError) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).locationDialogMessage, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () => { + ConfirmDialog.closeAlertDialog(context), + if (isPermissionError) + openAppSettings() + else + openLocationSettings() + }, + cancelFunction: () => {}); + return dialog.showAlertDialog(context); + } + + void setLocation(Position position) { + print(position); + this.sharedPref.setDouble(USER_LAT, position.latitude); + this.sharedPref.setDouble(USER_LONG, position.longitude); + } + + void setZeroLocation() { + this.sharedPref.setDouble(USER_LAT, 0.0); + this.sharedPref.setDouble(USER_LONG, 0.0); + } +} diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 43056cfb..d9fc04bc 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -450,6 +450,8 @@ class TranslationBase { String get logs => localizedValues['logs'][locale.languageCode]; String get textToSpeech => localizedValues['textToSpeech'][locale.languageCode]; + String get locationDialogMessage => + localizedValues['locationDialogMessage'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 526c0f5b..6958e67f 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -1,5 +1,4 @@ import 'package:connectivity/connectivity.dart'; -import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; diff --git a/pubspec.yaml b/pubspec.yaml index 657f7b78..f4c5e5c2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -99,6 +99,9 @@ dependencies: #hijri hijri: ^2.0.3 + #Handle Geolocation + geolocator: ^6.0.0+1 + #Dependencies for video call implementation native_device_orientation: ^0.3.0 enum_to_string: ^1.0.9