@ -59,8 +59,7 @@ class AuthenticationViewModel extends ChangeNotifier {
required NavigationService navigationService ,
required NavigationService navigationService ,
required CacheService cacheService ,
required CacheService cacheService ,
required LocalAuthService localAuthService ,
required LocalAuthService localAuthService ,
} )
} ) : _navigationService = navigationService ,
: _navigationService = navigationService ,
_dialogService = dialogService ,
_dialogService = dialogService ,
_errorHandlerService = errorHandlerService ,
_errorHandlerService = errorHandlerService ,
_appState = appState ,
_appState = appState ,
@ -301,8 +300,7 @@ class AuthenticationViewModel extends ChangeNotifier {
final result = await _authenticationRepo . checkPatientAuthentication ( checkPatientAuthenticationReq: checkPatientAuthenticationReq ) ;
final result = await _authenticationRepo . checkPatientAuthentication ( checkPatientAuthenticationReq: checkPatientAuthenticationReq ) ;
result . fold (
result . fold (
( failure ) async = >
( failure ) async = > await _errorHandlerService . handleError (
await _errorHandlerService . handleError (
failure: failure ,
failure: failure ,
onUnHandledFailure: ( failure ) async {
onUnHandledFailure: ( failure ) async {
LoaderBottomSheet . hideLoader ( ) ;
LoaderBottomSheet . hideLoader ( ) ;
@ -445,8 +443,7 @@ class AuthenticationViewModel extends ChangeNotifier {
LoaderBottomSheet . hideLoader ( ) ;
LoaderBottomSheet . hideLoader ( ) ;
resultEither . fold (
resultEither . fold (
( failure ) async = >
( failure ) async = > await _errorHandlerService . handleError (
await _errorHandlerService . handleError (
failure: failure ,
failure: failure ,
onUnHandledFailure: ( failure ) async {
onUnHandledFailure: ( failure ) async {
LoaderBottomSheet . hideLoader ( ) ;
LoaderBottomSheet . hideLoader ( ) ;
@ -454,9 +451,6 @@ class AuthenticationViewModel extends ChangeNotifier {
message: failure . message ,
message: failure . message ,
label: LocaleKeys . notice . tr ( ) ,
label: LocaleKeys . notice . tr ( ) ,
onOkPressed: ( ) {
onOkPressed: ( ) {
_navigationService . pushAndReplace ( AppRoutes . register ) ;
} ,
onCancelPressed: ( ) {
_navigationService . pop ( ) ;
_navigationService . pop ( ) ;
} ) ;
} ) ;
} ) , ( apiResponse ) {
} ) , ( apiResponse ) {
@ -473,8 +467,7 @@ class AuthenticationViewModel extends ChangeNotifier {
final resultEither = await _authenticationRepo . checkActivationCodeRepo ( newRequest: CheckActivationCodeRegisterReq . fromJson ( request ) , activationCode: activationCode , isRegister: false ) ;
final resultEither = await _authenticationRepo . checkActivationCodeRepo ( newRequest: CheckActivationCodeRegisterReq . fromJson ( request ) , activationCode: activationCode , isRegister: false ) ;
resultEither . fold (
resultEither . fold (
( failure ) async = >
( failure ) async = > await _errorHandlerService . handleError (
await _errorHandlerService . handleError (
failure: failure ,
failure: failure ,
onUnHandledFailure: ( failure ) async {
onUnHandledFailure: ( failure ) async {
LoaderBottomSheet . hideLoader ( ) ;
LoaderBottomSheet . hideLoader ( ) ;
@ -885,9 +878,13 @@ class AuthenticationViewModel extends ChangeNotifier {
message: apiResponse . errorMessage ? ? " " ,
message: apiResponse . errorMessage ? ? " " ,
label: LocaleKeys . notice . tr ( ) ,
label: LocaleKeys . notice . tr ( ) ,
onOkPressed: ( ) {
onOkPressed: ( ) {
_dialogService . showPhoneNumberPickerSheet ( label: " Where would you like to receive OTP? " , message: " Please select from the below options to receive OTP. " , onSMSPress: ( ) {
_dialogService . showPhoneNumberPickerSheet (
label: " Where would you like to receive OTP? " ,
message: " Please select from the below options to receive OTP. " ,
onSMSPress: ( ) {
checkUserAuthentication ( otpTypeEnum: OTPTypeEnum . sms ) ;
checkUserAuthentication ( otpTypeEnum: OTPTypeEnum . sms ) ;
} , onWhatsappPress: ( ) {
} ,
onWhatsappPress: ( ) {
checkUserAuthentication ( otpTypeEnum: OTPTypeEnum . whatsapp ) ;
checkUserAuthentication ( otpTypeEnum: OTPTypeEnum . whatsapp ) ;
} ) ;
} ) ;
} ,
} ,