From c6a95fe7d72737c988be1909a6bd760fb9d6a75c Mon Sep 17 00:00:00 2001 From: faizatflutter Date: Tue, 2 Sep 2025 15:18:03 +0300 Subject: [PATCH] latest push after master merged --- .../authentication_view_model.dart | 182 +++++++++--------- lib/presentation/home/landing_page.dart | 8 +- 2 files changed, 92 insertions(+), 98 deletions(-) diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart index 573c528..ed77aca 100644 --- a/lib/features/authentication/authentication_view_model.dart +++ b/lib/features/authentication/authentication_view_model.dart @@ -40,96 +40,96 @@ class AuthenticationViewModel extends ChangeNotifier { ); } - Future checkUserAuthentication({Function(dynamic)? onSuccess, Function(String)? onError}) async { - CheckPatientAuthenticationReq checkPatientAuthenticationReq = RequestUtils.getCommonRequestWelcome( - phoneNumber: '0567184134', - otpTypeEnum: OTPTypeEnum.sms, - deviceToken: 'dummyDeviceToken123', - patientOutSA: true, - loginTokenID: 'dummyLoginToken456', - registeredData: null, - patientId: 12345, - nationIdText: '1234567890', - countryCode: 'SA', - ); - - final result = await authenticationRepo.checkPatientAuthentication(checkPatientAuthenticationReq: checkPatientAuthenticationReq); - result.fold( - (failure) async => await errorHandlerService.handleError(failure: failure), - (apiResponse) { - if (apiResponse.data['isSMSSent']) { - // TODO: set this in AppState - // sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']); - // loginTokenID = value['LogInTokenID'], - // sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request), - sendActivationCode(type); - } else { - if (apiResponse.data['IsAuthenticated']) { - checkActivationCode(onWrongActivationCode: (String? message) {}); - } - } - }, - ); - } - - Future sendActivationCode({required OTPTypeEnum otpTypeEnum}) async { - var request = RequestUtils.getCommonRequestAuthProvider( - otpTypeEnum: otpTypeEnum, - registeredData: null, - deviceToken: "dummyLoginToken456", - mobileNumber: "0567184134", - zipCode: "SA", - patientOutSA: true, - loginTokenID: "dummyLoginToken456", - selectedOption: selectedOption, - patientId: 12345, - ); + // Future checkUserAuthentication({Function(dynamic)? onSuccess, Function(String)? onError}) async { + // CheckPatientAuthenticationReq checkPatientAuthenticationReq = RequestUtils.getCommonRequestWelcome( + // phoneNumber: '0567184134', + // otpTypeEnum: OTPTypeEnum.sms, + // deviceToken: 'dummyDeviceToken123', + // patientOutSA: true, + // loginTokenID: 'dummyLoginToken456', + // registeredData: null, + // patientId: 12345, + // nationIdText: '1234567890', + // countryCode: 'SA', + // ); + // + // final result = await authenticationRepo.checkPatientAuthentication(checkPatientAuthenticationReq: checkPatientAuthenticationReq); + // result.fold( + // (failure) async => await errorHandlerService.handleError(failure: failure), + // (apiResponse) { + // if (apiResponse.data['isSMSSent']) { + // // TODO: set this in AppState + // // sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']); + // // loginTokenID = value['LogInTokenID'], + // // sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request), + // sendActivationCode(type); + // } else { + // if (apiResponse.data['IsAuthenticated']) { + // checkActivationCode(onWrongActivationCode: (String? message) {}); + // } + // } + // }, + // ); + // } - request.sMSSignature = await SMSOTP.getSignature(); - selectedOption = type; - // GifLoaderDialogUtils.showMyDialog(context); - if (healthId != null || isDubai) { - if (!isDubai) { - request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob)); - } - request.healthId = healthId; - request.isHijri = isHijri; - await this.apiClient.sendActivationCodeRegister(request).then((result) { - // GifLoaderDialogUtils.hideDialog(context); - if (result != null && result['isSMSSent'] == true) { - this.startSMSService(type); - } - }).catchError((r) { - GifLoaderDialogUtils.hideDialog(context); - context.showBottomSheet( - child: ExceptionBottomSheet( - message: r.toString(), - onOkPressed: () { - Navigator.of(context).pop(); - }, - )); - // AppToast.showErrorToast(message: r); - }); - } else { - request.dob = ""; - request.healthId = ""; - request.isHijri = 0; - await this.authService.sendActivationCode(request).then((result) { - GifLoaderDialogUtils.hideDialog(context); - if (result != null && result['isSMSSent'] == true) { - this.startSMSService(type); - } - }).catchError((r) { - GifLoaderDialogUtils.hideDialog(context); - context.showBottomSheet( - child: ExceptionBottomSheet( - message: r.toString(), - onOkPressed: () { - Navigator.of(context).pop(); - }, - )); - // AppToast.showErrorToast(message: r.toString()); - }); - } - } + // Future sendActivationCode({required OTPTypeEnum otpTypeEnum}) async { + // var request = RequestUtils.getCommonRequestAuthProvider( + // otpTypeEnum: otpTypeEnum, + // registeredData: null, + // deviceToken: "dummyLoginToken456", + // mobileNumber: "0567184134", + // zipCode: "SA", + // patientOutSA: true, + // loginTokenID: "dummyLoginToken456", + // selectedOption: selectedOption, + // patientId: 12345, + // ); + // + // request.sMSSignature = await SMSOTP.getSignature(); + // selectedOption = type; + // // GifLoaderDialogUtils.showMyDialog(context); + // if (healthId != null || isDubai) { + // if (!isDubai) { + // request.dob = dob; //isHijri == 1 ? dob : dateFormat2.format(dateFormat.parse(dob)); + // } + // request.healthId = healthId; + // request.isHijri = isHijri; + // await this.apiClient.sendActivationCodeRegister(request).then((result) { + // // GifLoaderDialogUtils.hideDialog(context); + // if (result != null && result['isSMSSent'] == true) { + // this.startSMSService(type); + // } + // }).catchError((r) { + // GifLoaderDialogUtils.hideDialog(context); + // context.showBottomSheet( + // child: ExceptionBottomSheet( + // message: r.toString(), + // onOkPressed: () { + // Navigator.of(context).pop(); + // }, + // )); + // // AppToast.showErrorToast(message: r); + // }); + // } else { + // request.dob = ""; + // request.healthId = ""; + // request.isHijri = 0; + // await this.authService.sendActivationCode(request).then((result) { + // GifLoaderDialogUtils.hideDialog(context); + // if (result != null && result['isSMSSent'] == true) { + // this.startSMSService(type); + // } + // }).catchError((r) { + // GifLoaderDialogUtils.hideDialog(context); + // context.showBottomSheet( + // child: ExceptionBottomSheet( + // message: r.toString(), + // onOkPressed: () { + // Navigator.of(context).pop(); + // }, + // )); + // // AppToast.showErrorToast(message: r.toString()); + // }); + // } + // } } diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index 27e95de..8421856 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -11,23 +11,17 @@ import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; -import 'package:hmg_patient_app_new/presentation/authantication/login.dart'; import 'package:hmg_patient_app_new/presentation/home/data/landing_page_data.dart'; import 'package:hmg_patient_app_new/presentation/home/widgets/habib_wallet_card.dart'; import 'package:hmg_patient_app_new/presentation/home/widgets/large_service_card.dart'; import 'package:hmg_patient_app_new/presentation/home/widgets/small_service_card.dart'; import 'package:hmg_patient_app_new/presentation/medical_file/medical_file_page.dart'; -import 'package:hmg_patient_app_new/providers/authentication_view_model.dart'; import 'package:hmg_patient_app_new/providers/bottom_navigation_provider.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; +import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import 'package:provider/provider.dart'; -import '../../core/app_assets.dart'; -import '../../core/utils/utils.dart'; -import '../../widgets/buttons/custom_button.dart'; -import '../../widgets/transitions/fade_page.dart'; - class LandingPage extends StatefulWidget { const LandingPage({super.key});