Merge branch 'master' into haroon_dev

pull/299/head
haroon amjad 1 day ago
commit 018f316a01

@ -368,11 +368,7 @@ class AuthenticationViewModel extends ChangeNotifier {
} else if (apiResponse.messageStatus == 1) {
if (apiResponse.data['isSMSSent']) {
_appState.setAppAuthToken = apiResponse.data['LogInTokenID'];
await sendActivationCode(
otpTypeEnum: otpTypeEnum,
phoneNumber: phoneNumberController.text,
nationalIdOrFileNumber: nationalIdController.text,
isForRegister: false);
await sendActivationCode(otpTypeEnum: otpTypeEnum, phoneNumber: phoneNumberController.text, nationalIdOrFileNumber: nationalIdController.text, isForRegister: false);
} else {
if (apiResponse.data['IsAuthenticated']) {
await checkActivationCode(
@ -434,10 +430,7 @@ class AuthenticationViewModel extends ChangeNotifier {
}
final resultEither = await _authenticationRepo.sendActivationCodeRepo(
sendActivationCodeReq: request,
isRegister: checkIsUserComingForRegister(request: payload),
languageID: 'er',
isFormFamilyFile: isFormFamilyFile);
sendActivationCodeReq: request, isRegister: checkIsUserComingForRegister(request: payload), languageID: 'er', isFormFamilyFile: isFormFamilyFile);
resultEither.fold(
(failure) async => await _errorHandlerService.handleError(failure: failure),
@ -514,9 +507,7 @@ class AuthenticationViewModel extends ChangeNotifier {
bool isSwitchUser = false,
int? patientID,
}) async {
bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null ||
_appState.getUserRegistrationPayload.patientOutSa == true ||
_appState.getUserRegistrationPayload.patientOutSa == 1);
bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true || _appState.getUserRegistrationPayload.patientOutSa == 1);
MyAppointmentsViewModel myAppointmentsVM = getIt<MyAppointmentsViewModel>();
if (isSwitchUser && _appState.getSuperUserID == null) {
@ -558,8 +549,7 @@ class AuthenticationViewModel extends ChangeNotifier {
request["ForRegisteration"] = _appState.getUserRegistrationPayload.isRegister;
request["isRegister"] = false;
final resultEither =
await _authenticationRepo.checkActivationCodeRepo(newRequest: request, activationCode: activationCode.toString(), isRegister: true);
final resultEither = await _authenticationRepo.checkActivationCodeRepo(newRequest: request, activationCode: activationCode.toString(), isRegister: true);
LoaderBottomSheet.hideLoader();
@ -633,7 +623,9 @@ class AuthenticationViewModel extends ChangeNotifier {
await medicalVm.getFamilyFiles(status: 0);
if (isFormFamilyFile) {
await medicalVm.getAllPendingRecordsByResponseId();
_navigationService.pushAndReplace(AppRoutes.medicalFilePage);
_navigationService.replaceAllRoutesAndNavigateToLandingWithMedicalAuth().whenComplete(() {
_navigationService.pushPageRoute(AppRoutes.medicalFilePage);
});
} else {
_navigationService.replaceAllRoutesAndNavigateToLanding();
}
@ -870,8 +862,7 @@ class AuthenticationViewModel extends ChangeNotifier {
: _appState.getAuthenticatedUser()!.mobileNumber)!;
nationalIdController.text = _appState.getAuthenticatedUser()!.patientIdentificationNo!;
onSuccess();
} else if ((loginTypeEnum == LoginTypeEnum.sms ||
loginTypeEnum == LoginTypeEnum.whatsapp && _appState.getSelectDeviceByImeiRespModelElement == null) &&
} else if ((loginTypeEnum == LoginTypeEnum.sms || loginTypeEnum == LoginTypeEnum.whatsapp && _appState.getSelectDeviceByImeiRespModelElement == null) &&
_appState.getAuthenticatedUser() != null) {
phoneNumberController.text = (_appState.getAuthenticatedUser()!.mobileNumber!.startsWith("0")
? _appState.getAuthenticatedUser()!.mobileNumber!.replaceFirst("0", "")
@ -928,8 +919,7 @@ class AuthenticationViewModel extends ChangeNotifier {
LoaderBottomSheet.showLoader();
// LoadingUtils.showFullScreenLoader(loadingText: "Setting up your medical file.\nMay take a moment.");
var request = RequestUtils.getUserSignupCompletionRequest(
fullName: nameController.text, emailAddress: emailController.text, gender: genderType, maritalStatus: maritalStatus);
var request = RequestUtils.getUserSignupCompletionRequest(fullName: nameController.text, emailAddress: emailController.text, gender: genderType, maritalStatus: maritalStatus);
final resultEither = await _authenticationRepo.registerUser(registrationPayloadDataModelRequest: request);
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async {
@ -1059,8 +1049,7 @@ class AuthenticationViewModel extends ChangeNotifier {
biometricEnabled: loginType == 1 || loginType == 2 ? false : true,
firstNameN: _appState.getAuthenticatedUser()!.firstNameN,
lastNameN: _appState.getAuthenticatedUser()!.lastNameN,
zipCode:
_appState.getAuthenticatedUser()!.zipCode //selectedCountrySignup == CountryEnum.others ? '0': selectedCountrySignup.countryCode,
zipCode: _appState.getAuthenticatedUser()!.zipCode //selectedCountrySignup == CountryEnum.others ? '0': selectedCountrySignup.countryCode,
)
.toJson());
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async {

@ -25,6 +25,7 @@ class NavigationService {
navigatorKey.currentState?.popUntil(ModalRoute.withName(routeName));
}
void replaceAllRoutesAndNavigateToLanding() {
AppState appState = getIt.get<AppState>();
appState.isAuthenticated = false;
@ -34,6 +35,13 @@ class NavigationService {
);
}
Future replaceAllRoutesAndNavigateToLandingWithMedicalAuth() async {
navigatorKey.currentState?.pushNamedAndRemoveUntil(
AppRoutes.landingScreen,
(Route<dynamic> route) => false,
);
}
void replaceAllRoutesAndNavigateToLandingAuth() {
navigatorKey.currentState?.pushNamedAndRemoveUntil(
AppRoutes.landingScreen,
@ -50,17 +58,10 @@ class NavigationService {
}
Future<T?> pushToOtpScreen<T>(
{required String phoneNumber,
required Function(int code) checkActivationCode,
required Function(String phoneNumber) onResendOTPPressed,
bool isFormFamilyFile = false}) {
{required String phoneNumber, required Function(int code) checkActivationCode, required Function(String phoneNumber) onResendOTPPressed, bool isFormFamilyFile = false}) {
return navigatorKey.currentState!.push(
MaterialPageRoute(
builder: (_) => OTPVerificationScreen(
phoneNumber: phoneNumber,
checkActivationCode: checkActivationCode,
onResendOTPPressed: onResendOTPPressed,
isFormFamilyFile: isFormFamilyFile)),
builder: (_) => OTPVerificationScreen(phoneNumber: phoneNumber, checkActivationCode: checkActivationCode, onResendOTPPressed: onResendOTPPressed, isFormFamilyFile: isFormFamilyFile)),
);
}

@ -57,7 +57,7 @@ class _FamilyFileAddWidgetState extends State<FamilyFileAddWidget> {
isAllowRadius: true,
isBorderAllowed: false,
isAllowLeadingIcon: true,
autoFocus: true,
autoFocus: false,
keyboardType: TextInputType.number,
fontFamily: "Poppins",
padding: EdgeInsets.symmetric(vertical: 8.h),
@ -76,7 +76,7 @@ class _FamilyFileAddWidgetState extends State<FamilyFileAddWidget> {
isAllowRadius: true,
isBorderAllowed: false,
isAllowLeadingIcon: true,
autoFocus: true,
autoFocus: false,
keyboardType: TextInputType.number,
fontFamily: "Poppins",
padding: EdgeInsets.symmetric(vertical: 8.h),
@ -91,7 +91,9 @@ class _FamilyFileAddWidgetState extends State<FamilyFileAddWidget> {
CustomButton(
text: LocaleKeys.add.tr(context: context),
onPressed: () {
FocusScope.of(context).unfocus();
// Unfocus all text fields and dismiss keyboard
FocusManager.instance.primaryFocus?.unfocus();
if (ValidationUtils.isValidatedIdAndPhoneWithCountryValidation(
nationalId: authVm.nationalIdController.text,
selectedCountry: authVm.selectedCountrySignup,

Loading…
Cancel
Save