diff --git a/lib/core/app_state.dart b/lib/core/app_state.dart index 604e985..8122bf4 100644 --- a/lib/core/app_state.dart +++ b/lib/core/app_state.dart @@ -1,6 +1,3 @@ -import 'dart:io'; - -import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:hmg_patient_app_new/main.dart'; diff --git a/lib/core/consts.dart b/lib/core/consts.dart index a018eac..4f98f21 100644 --- a/lib/core/consts.dart +++ b/lib/core/consts.dart @@ -3,132 +3,20 @@ class ApiConsts { static bool isDevelopment = true; - // static String baseUrlBackend = 'http://ec2-13-51-36-142.eu-north-1.compute.amazonaws.com:8082/api/'; // Backend API URL UAT - // static String baseUrlBackend = 'http://207.127.99.20:82/api/'; // Backend API URL PROD - static String baseUrlBackend = 'https://api-mob.meena-health.com/api/'; // Backend API URL PROD + // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT + static String baseUrl = 'https://hmgwebservices.com/'; // HIS API URL PROD - static String checkIfUserExists = 'UserRegistrationHIS/phone'; - static String checkIfUserExistsMultiple = 'UserRegistrationHIS/phone/multiple'; - static String checkIfUserExistsByMRN = 'UserRegistrationHIS/mrn/phone'; - static String checkIfUserLastLoggedIn = 'UserRegistrationHIS/device-token'; - static String updateUserLastLogIn = 'UserRegistrationHIS/save-device-token'; - static String getStories = 'Stories'; - static String saveAppointmentDetailsInBackend = 'UserAppointment'; - static String getPatientAppointmentHistory = 'UserAppointment/my-appointments'; - static String updateAppointmentDetailsInBackend = 'UserAppointment/update/'; - static String submitDoctorReview = 'DoctorReview/submit-review'; - static String getUserDataFromYakeenByIqama = 'Yakeen/by-iqama'; - static String getUserDataFromYakeenByNin = 'Yakeen/by-nin'; - static String sendVerificationCode = 'UserLogin/otp-request'; - static String checkVerificationCode = 'UserLogin/otp-verify'; - static String registerNewPatient = 'UserRegistrationHIS/save/patient'; - static String getPatientVitalSignsHistory = 'Vitals/my-vitals'; - static String getPatientLabReports = 'LabsOrder/my-orders'; - static String getPatientRadReports = 'RadiologyOrder/my-orders'; - static String getPatientPrescriptionsReports = 'Prescription/my-prescriptions'; - static String updatePatientStoryViewedAPI = 'Stories/view'; - static String getClinicsList = 'Clinics'; - static String getDoctorsList = 'Doctors'; - static String checkAppVersion = 'AppVersion/check-version'; - static String getPatientLabOrdersAndResults = 'LabsOrder/my-order-result'; - static String updatePatientProfile = 'Users/profile-update'; - static String getPatientVitalSignsFromHIS = 'getpatientvital'; - static String getDoctorReviewsByDoctorID = 'DoctorReview/'; - - // static String baseUrl = 'http://158.101.230.106:5016/phi/'; // HIS API URL UAT - static String baseUrl = 'http://158.101.232.32:5016/phi/'; // HIS API URL PROD - - //Doctor Search - static String doctorSearch = 'doctor/search'; - - //Get Patient Data - static String getPatientData = 'patientdata/getpatientsdata'; - - //Get Free Slots - static String getFreeSlots = 'doctor/timeslot'; - - //Create Appointment - static String createAppointment = 'patient/appointment/create'; - - //Cancel Appointment - static String cancelAppointment = 'patient/appointment/create'; - - //Create Deposit - static String createDeposit = 'patient/PatientDeposits'; - - //Update Patient Photo - static String updatePatientPhoto = 'patientphoto'; - - // get Patient Insurance Details - static String getPatientInsuranceDetails = "http://158.101.232.32:5021/getpolicydetails"; - - // get Patient Insurance Details - static String getDoctorSessionsByAppointments = "http://158.101.232.32:5016/phi/doctor/getdoctorsessionbyappointment"; // Prod - - // static String getDoctorSessionsByAppointments = "http://158.101.230.106:5016/phi/doctor/getdoctorsessionbyappointment"; // UAT - - //get Organization List - static String getOrganizationsList = 'organisationsearch'; - - //get Departments List - static String getDepartmentsList = 'getdepartmentsearch'; + static String SELECT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI'; static String VERSION_ID = "1.6"; - // Nabed APIs - static String nabedBaseUrl = "https://portal.nabed.net/api/"; // Live - static String nabedAuthenticationURL = "auth/jwt-token"; - static String nabedGetPatientData = "educate/external/content/icd?page="; - - // SANED URLs - static String sanedLoginPassword = "Aa123456@"; - static String sanedSource = "Meena Mobile App"; - - static String baseUrlSaned = 'https://staging.sanedhealth.com/'; // SANED API URL STAGING - // static String baseUrlSaned = 'https://hc.sanedhealth.com/'; // SANED API URL PRODUCTION - static String sanedAPIVersion = 'mn_hc/'; - - // static String sanedWebSocketURL = 'wss://locationapi.sanedhealth.com/ws?apikey=st_zuhDm9xSyI'; // UAT SANED WEBSOCKET URL - static String sanedWebSocketURL = 'wss://locationapiprod.sanedhealth.com/ws?apikey=st_A1xVs5qA7z'; // PRODUCTION WEBSOCKET URL - - static String getSanedAuthToken = 'api/external/login'; - static String getSanedProductCategories = 'get_product_categories'; - static String getProductPackages = 'get/product/packages'; - static String getPackageDetails = 'get/package/details'; - static String checkPatientByNationalitySaned = 'check_patient_by_nationality'; - static String signupPatient = 'api/signup'; - static String getPatientCartDetails = 'shop/cart'; - static String addPackageToCart = 'shop/cart/update'; - static String updateCartItems = 'shop/cart/update_json'; - static String getPatientLocationList = 'get_patient_location_list'; - static String updatePatientLocationList = 'update_patient_location'; - static String getAvailableSlots = 'get/category/slot'; - static String createHHCAppointment = 'api/create/appointment'; - static String cancelHHCAppointment = 'cancel_appointment'; - static String getBlackOutDates = 'get/blackout/dates'; - - // static String createConfirmHHCAppointment = 'api/create/appointment'; - static String getPatientHHCAppointmentHistory = 'get_patient_medical_history/appointment'; - static setBackendURLs() { if (isDevelopment) { - baseUrlSaned = 'https://staging.sanedhealth.com/'; - sanedWebSocketURL = "wss://locationapi.sanedhealth.com/ws?apikey=st_zuhDm9xSyI"; - baseUrlBackend = "http://ec2-13-51-36-142.eu-north-1.compute.amazonaws.com:8082/api/"; - baseUrl = "http://158.101.230.106:5016/phi/"; - getDoctorSessionsByAppointments = "http://158.101.230.106:5016/phi/doctor/getdoctorsessionbyappointment"; + baseUrl = "https://uat.hmgwebservices.com/"; } else { - baseUrlSaned = 'https://hc.sanedhealth.com/'; - sanedWebSocketURL = "wss://locationapiprod.sanedhealth.com/ws?apikey=st_A1xVs5qA7z"; - baseUrlBackend = "https://api-mob.meena-health.com/api/"; - baseUrl = "http://158.101.232.32:5016/phi/"; - getDoctorSessionsByAppointments = "http://158.101.232.32:5016/phi/doctor/getdoctorsessionbyappointment"; + baseUrl = "https://hmgwebservices.com/"; } } - -// Login -// static String baseUrlLogin = 'https://keycloak.dev.evxtest.monster/realms/'; -// static String getLoginToken = 'my_city_uat/protocol/openid-connect/token'; } class SharedPrefsConsts { diff --git a/lib/core/utils/push-notification-handler.dart b/lib/core/utils/push-notification-handler.dart index 4b7c424..0cd3be7 100644 --- a/lib/core/utils/push-notification-handler.dart +++ b/lib/core/utils/push-notification-handler.dart @@ -255,6 +255,7 @@ class PushNotificationHandler { } if (Platform.isIOS) { + final permission = await FirebaseMessaging.instance.requestPermission(); await FirebaseMessaging.instance.getAPNSToken().then((value) async { log("APNS token: " + value.toString()); await Utils.saveStringFromPrefs(SharedPrefsConsts.APNS_TOKEN, value.toString()); @@ -264,7 +265,6 @@ class PushNotificationHandler { badge: true, sound: true, ); - final permission = await FirebaseMessaging.instance.requestPermission(); if (permission.authorizationStatus == AuthorizationStatus.denied) return; } else {} diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 43594c6..14e14c8 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -3,7 +3,6 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/cupertino.dart'; import 'package:intl/intl.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; -import 'package:sizer/sizer.dart'; extension CapExtension on String { String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}"; diff --git a/lib/main.dart b/lib/main.dart index 5cfe8bb..48ea6ee 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -6,9 +6,12 @@ import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; +import 'package:hmg_patient_app_new/providers/authentication_view_model.dart'; import 'package:hmg_patient_app_new/routes/app_routes.dart'; import 'package:hmg_patient_app_new/theme/app_theme.dart'; import 'package:logger/logger.dart'; +import 'package:provider/provider.dart'; +import 'package:provider/single_child_widget.dart'; import 'core/utils/size_utils.dart'; import 'firebase_options.dart'; @@ -45,7 +48,7 @@ class MyHttpOverrides extends HttpOverrides { void main() async { WidgetsFlutterBinding.ensureInitialized(); await EasyLocalization.ensureInitialized(); - await Firebase.initializeApp(name: "hmg-patient-app", options: DefaultFirebaseOptions.currentPlatform); + await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); HttpOverrides.global = MyHttpOverrides(); runApp( @@ -56,8 +59,11 @@ void main() async { ], path: 'assets/langs', fallbackLocale: Locale('en', 'US'), - // assetLoader: const CodegenLoader(), - child: MyApp(), + child: MultiProvider(providers: [ + ChangeNotifierProvider( + create: (_) => AuthenticationViewModel(), + ), + ], child: MyApp()), ), ); } @@ -69,9 +75,10 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return SafeArea( - top: false, // Set to true if you want to avoid the notch area as well - bottom: Platform.isIOS ? false : true, - child: LayoutBuilder(builder: (context, constraints) { + top: false, // Set to true if you want to avoid the notch area as well + bottom: Platform.isIOS ? false : true, + child: LayoutBuilder( + builder: (context, constraints) { return Sizer( builder: (context, orientation, deviceType) { // SizeConfig().init(constraints, orientation); @@ -98,6 +105,8 @@ class MyApp extends StatelessWidget { ); }, ); - })); + }, + ), + ); } } diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index 0608b82..b3ddd19 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -14,9 +14,10 @@ class _LandingPageState extends State { return Scaffold( body: Column( children: [ - Center( - child: "Home Page".toText18(color: Colors.black), - ) + Padding( + padding: const EdgeInsets.all(64.0), + child: "Login".toText18(color: Colors.black), + ), ], ), ); diff --git a/lib/providers/authentication_view_model.dart b/lib/providers/authentication_view_model.dart new file mode 100644 index 0000000..af542ac --- /dev/null +++ b/lib/providers/authentication_view_model.dart @@ -0,0 +1,5 @@ +import 'package:flutter/material.dart'; + +class AuthenticationViewModel extends ChangeNotifier { + // Add properties and methods related to authentication here +} \ No newline at end of file diff --git a/lib/splashPage.dart b/lib/splashPage.dart index b64aa26..b05cab8 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -7,8 +7,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart'; import 'package:hmg_patient_app_new/presentation/home/landing_page.dart'; +import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import 'package:provider/provider.dart'; +import 'core/consts.dart'; import 'core/utils/LocalNotification.dart'; import 'core/utils/push-notification-handler.dart'; @@ -22,17 +24,21 @@ class _SplashScreenState extends State { void initState() { super.initState(); print("Splash init called............."); + Timer( + Duration(milliseconds: 500), + () async { + ApiConsts.setBackendURLs(); + PushNotificationHandler().init(context); // Asyncronously + }, + ); Timer(Duration(seconds: 3, milliseconds: 500), () async { LocalNotification.init(onNotificationClick: (payload) {}); Navigator.of(context).pushReplacement( - MaterialPageRoute( - builder: (BuildContext context) => LandingPage(), + FadePage( + page: LandingPage(), ), ); - // } else {} }); - // }, - // ); var zoom = ZoomVideoSdk(); InitConfig initConfig = InitConfig( @@ -40,11 +46,6 @@ class _SplashScreenState extends State { enableLog: true, ); zoom.initSdk(initConfig); - - // AppSharedPreferences().getAll().then((value) { - // debugPrint("ALL SHARED PREFERENCES!!!!!"); - // debugPrint(jsonEncode(value)); - // }); } /// load the Privilege from service