fixes for signup

pull/27/head
aamir-csol 2 months ago
parent 3c0e555536
commit 9b063ba764

@ -766,6 +766,7 @@ class ApiConsts {
SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx';
break; break;
case AppEnvironmentTypeEnum.preProd: case AppEnvironmentTypeEnum.preProd:
baseUrl = "https://webservices.hmg.com/"; baseUrl = "https://webservices.hmg.com/";
payFortEnvironment = FortEnvironment.production; payFortEnvironment = FortEnvironment.production;
applePayMerchantId = "merchant.com.hmgwebservices"; applePayMerchantId = "merchant.com.hmgwebservices";

@ -7,6 +7,8 @@ import 'package:hmg_patient_app_new/features/authentication/models/resp_models/c
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart';
import '../features/authentication/models/request_models/registration_payload_model.dart';
class AppState { class AppState {
NavigationService navigationService; NavigationService navigationService;
@ -103,4 +105,13 @@ class AppState {
set setNHICUserData(CheckUserStatusResponseNHIC value) { set setNHICUserData(CheckUserStatusResponseNHIC value) {
_nHICUserData = value; _nHICUserData = value;
} }
RegistrationDataModelPayload? _userRegistrationPayload;
RegistrationDataModelPayload get getUserRegistrationPayload => _userRegistrationPayload!;
set setUserRegistrationPayload(RegistrationDataModelPayload value) {
_userRegistrationPayload = value;
}
} }

@ -351,6 +351,7 @@ class PushNotificationHandler {
} }
onToken(String token) async { onToken(String token) async {
print("Push Notification Token: " + token); print("Push Notification Token: " + token);
await Utils.saveStringFromPrefs(CacheConst.pushToken, token); await Utils.saveStringFromPrefs(CacheConst.pushToken, token);
} }

@ -52,7 +52,13 @@ class AuthenticationRepoImp implements AuthenticationRepo {
try { try {
final list = response['Patient_SELECTDeviceIMEIbyIMEIList']; final list = response['Patient_SELECTDeviceIMEIbyIMEIList'];
if (list == null || list.isEmpty) { if (list == null || list.isEmpty) {
throw Exception("Device list is empty"); apiResponse = GenericApiModel<SelectDeviceByImeiRespModelElement>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: errorMessage,
data: null,
);
return;
} }
final model = SelectDeviceByImeiRespModelElement.fromJson(list[0] as Map<String, dynamic>); final model = SelectDeviceByImeiRespModelElement.fromJson(list[0] as Map<String, dynamic>);
@ -160,12 +166,17 @@ class AuthenticationRepoImp implements AuthenticationRepo {
required String? activationCode, required String? activationCode,
required bool isRegister, required bool isRegister,
}) async { }) async {
newRequest.activationCode = activationCode ?? "0000"; if (isRegister) {
newRequest.isSilentLogin = activationCode != null ? false : true; newRequest["activationCode"] = activationCode ?? "0000";
newRequest.projectOutSA = newRequest.zipCode == '966' ? false : true; newRequest["isSilentLogin"] = activationCode != null ? false : true;
newRequest.isDentalAllowedBackend = false; } else {
newRequest.forRegisteration = newRequest.isRegister ?? false; newRequest.activationCode = activationCode ?? "0000";
newRequest.isRegister = false; newRequest.isSilentLogin = activationCode != null ? false : true;
newRequest.projectOutSA = newRequest.zipCode == '966' ? false : true;
newRequest.isDentalAllowedBackend = false;
newRequest.forRegisteration = newRequest.isRegister ?? false;
newRequest.isRegister = false;
}
final endpoint = isRegister ? ApiConsts.checkActivationCodeRegister : ApiConsts.checkActivationCode; final endpoint = isRegister ? ApiConsts.checkActivationCodeRegister : ApiConsts.checkActivationCode;
@ -175,7 +186,7 @@ class AuthenticationRepoImp implements AuthenticationRepo {
await apiClient.post( await apiClient.post(
endpoint, endpoint,
body: newRequest.toJson(), body: isRegister ? newRequest : newRequest.toJson(),
onFailure: (error, statusCode, {messageStatus, failureType}) { onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType; failure = failureType;
}, },

@ -1,6 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:developer'; import 'dart:developer';
import 'package:flutter/services.dart' show rootBundle;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hijri_gregorian_calendar/hijri_gregorian_calendar.dart'; import 'package:hijri_gregorian_calendar/hijri_gregorian_calendar.dart';
import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/app_state.dart';
@ -14,6 +14,7 @@ import 'package:hmg_patient_app_new/core/utils/validation_utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/features/authentication/authentication_repo.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_repo.dart';
import 'package:hmg_patient_app_new/features/authentication/models/request_models/check_activation_code_register_request_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/request_models/check_activation_code_register_request_model.dart';
import 'package:hmg_patient_app_new/features/authentication/models/request_models/registration_payload_model.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_activation_code_resp_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_activation_code_resp_model.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_user_staus_nhic_response_model.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/check_user_staus_nhic_response_model.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/select_device_by_imei.dart';
@ -49,7 +50,7 @@ class AuthenticationViewModel extends ChangeNotifier {
_authenticationRepo = authenticationRepo, _authenticationRepo = authenticationRepo,
_localAuthService = localAuthService; _localAuthService = localAuthService;
final TextEditingController nationalIdController = TextEditingController(), phoneNumberController = TextEditingController(), dobController = TextEditingController(); final TextEditingController nationalIdController = TextEditingController(), phoneNumberController = TextEditingController(), dobController = TextEditingController(), nameController = TextEditingController();
CountryEnum selectedCountrySignup = CountryEnum.saudiArabia; CountryEnum selectedCountrySignup = CountryEnum.saudiArabia;
MaritalStatusTypeEnum? maritalStatus; MaritalStatusTypeEnum? maritalStatus;
GenderTypeEnum? genderType; GenderTypeEnum? genderType;
@ -62,23 +63,8 @@ class AuthenticationViewModel extends ChangeNotifier {
//================== //==================
bool isDubai = false;
bool authenticated = false;
late int mobileNumber;
String errorMsg = ''; String errorMsg = '';
var registerd_data;
bool isMoreOption = false;
var zipCode;
var patientOutSA;
var loginTokenID;
var loginType;
var deviceToken;
var lastLogin;
final FocusNode myFocusNode = FocusNode(); final FocusNode myFocusNode = FocusNode();
late int selectedOption = 1;
bool onlySMSBox = false;
int fingrePrintBefore = 0;
var healthId; var healthId;
Future<void> onLoginPressed() async { Future<void> onLoginPressed() async {
@ -134,8 +120,8 @@ class AuthenticationViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
void loadCountriesData({required BuildContext context}) async { Future<void> loadCountriesData() async {
final String response = await DefaultAssetBundle.of(context).loadString('assets/json/countriesList.json'); final String response = await rootBundle.loadString('assets/json/countriesList.json');
final List<dynamic> data = json.decode(response); final List<dynamic> data = json.decode(response);
countriesList = data.map((e) => NationalityCountries.fromJson(e)).toList(); countriesList = data.map((e) => NationalityCountries.fromJson(e)).toList();
} }
@ -164,6 +150,18 @@ class AuthenticationViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
bool isUserFromUAE() {
bool isFromUAE = false;
if (_appState.getUserRegistrationPayload.patientOutSa != 0) {
isFromUAE = true;
}
return isFromUAE;
}
void savePushTokenToAppState() async {
_appState.deviceToken = await Utils.getStringFromPrefs(CacheConst.pushToken);
}
Future<void> selectDeviceImei({required Function(dynamic data) onSuccess, Function(String)? onError}) async { Future<void> selectDeviceImei({required Function(dynamic data) onSuccess, Function(String)? onError}) async {
// LoadingUtils.showFullScreenLoading(); // LoadingUtils.showFullScreenLoading();
// String firebaseToken = _appState.deviceToken; // String firebaseToken = _appState.deviceToken;
@ -293,9 +291,9 @@ class AuthenticationViewModel extends ChangeNotifier {
} }
Future<void> sendActivationCode({required OTPTypeEnum otpTypeEnum, required String nationalIdOrFileNumber, required String phoneNumber, dynamic payload}) async { Future<void> sendActivationCode({required OTPTypeEnum otpTypeEnum, required String nationalIdOrFileNumber, required String phoneNumber, dynamic payload}) async {
bool isForRegister = await checkIsUserComingForRegister(request: payload); bool isForRegister = checkIsUserComingForRegister(request: payload);
bool isPatientOutSA = await isPatientOutsideSA(request: payload); bool isPatientOutSA = isPatientOutsideSA(request: payload);
bool isFileNo = await isPatientHasFile(request: payload); bool isFileNo = isPatientHasFile(request: payload);
var request = RequestUtils.getCommonRequestSendActivationCode( var request = RequestUtils.getCommonRequestSendActivationCode(
otpTypeEnum: otpTypeEnum, otpTypeEnum: otpTypeEnum,
@ -345,10 +343,9 @@ class AuthenticationViewModel extends ChangeNotifier {
); );
} }
Future<bool> checkIsUserComingForRegister({required dynamic request}) async { bool checkIsUserComingForRegister({required dynamic request}) {
bool isUserComingForRegister = false; bool isUserComingForRegister = false;
print(request); if (request != null && request['isRegister'] == true) {
if (request != null && request['isRegister']) {
isUserComingForRegister = true; isUserComingForRegister = true;
} }
return isUserComingForRegister; return isUserComingForRegister;
@ -370,18 +367,20 @@ class AuthenticationViewModel extends ChangeNotifier {
countryCode: selectedCountrySignup.countryCode, countryCode: selectedCountrySignup.countryCode,
).toJson(); ).toJson();
bool isForRegister = healthId != null || isDubai; bool isForRegister = _appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true;
if (isForRegister) { if (isForRegister) {
if (isDubai) request['DOB'] = dob; if (_appState.getUserRegistrationPayload.patientOutSa == true) request['DOB'] = _appState.getUserRegistrationPayload.dob;
request['HealthId'] = healthId; request['HealthId'] = _appState.getUserRegistrationPayload.healthId;
request['IsHijri'] = calenderType.toInt; request['IsHijri'] = _appState.getUserRegistrationPayload.isHijri;
final resultEither = await _authenticationRepo.checkActivationCodeRepo(newRequest: request, activationCode: activationCode.toString(), isRegister: true); final resultEither = await _authenticationRepo.checkActivationCodeRepo(newRequest: request, activationCode: activationCode.toString(), isRegister: true);
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) { resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) {
final activation = CheckActivationCode.fromJson(apiResponse.data as Map<String, dynamic>); final activation = CheckActivationCode.fromJson(apiResponse.data as Map<String, dynamic>);
if (registerd_data?.isRegister == true) { if (_appState.getUserRegistrationPayload.isRegister == true) {
_navigationService.popUntilNamed(AppRoutes.registerNewScreen); //TODO: KSA Version Came Hre
loadCountriesData();
_navigationService.pushAndReplace(AppRoutes.registerStepTwo);
// Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)); // Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew));
return; return;
} }
@ -403,8 +402,8 @@ class AuthenticationViewModel extends ChangeNotifier {
} else if (activation.messageStatus == 2) { } else if (activation.messageStatus == 2) {
onWrongActivationCode(activation.errorEndUserMessage); onWrongActivationCode(activation.errorEndUserMessage);
return; return;
} else if (registerd_data?.isRegister == true) { } else if (_appState.getUserRegistrationPayload.isRegister == true) {
_navigationService.popUntilNamed(AppRoutes.registerNewScreen); _navigationService.pushAndReplace(AppRoutes.registerStepTwo);
// Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)); // Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew));
return; return;
} else { } else {
@ -513,7 +512,6 @@ class AuthenticationViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
}); });
this.selectedOption = selectedOption;
notifyListeners(); notifyListeners();
} }
@ -569,16 +567,16 @@ class AuthenticationViewModel extends ChangeNotifier {
} else { } else {
request['forRegister'] = true; request['forRegister'] = true;
request['isRegister'] = true; request['isRegister'] = true;
if (await isPatientOutsideSA(request: response)) { if (isPatientOutsideSA(request: response)) {
print("=======IN SA=======");
chekUserNHICData(request: request);
} else {
print("=======OUT SA======="); print("=======OUT SA=======");
_appState.setAppAuthToken = response['LogInTokenID']; _appState.setAppAuthToken = response['LogInTokenID'];
sendActivationCode( sendActivationCode(
otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]), otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]),
nationalIdOrFileNumber: request["PatientIdentificationID"].toString(), nationalIdOrFileNumber: request["PatientIdentificationID"].toString(),
phoneNumber: request["PatientMobileNumber"].toString()); phoneNumber: request["PatientMobileNumber"].toString());
} else {
print("=======IN SA=======");
chekUserNHICData(request: request);
} }
} }
} else { } else {
@ -587,23 +585,20 @@ class AuthenticationViewModel extends ChangeNotifier {
} }
} }
Future<bool> isPatientOutsideSA({required dynamic request}) { bool isPatientOutsideSA({required dynamic request}) {
try { bool isOutSideSa = false;
if (request is Map<String, dynamic> && request.containsKey("PatientOutSA")) { if (request is Map<String, dynamic> && request.containsKey("PatientOutSA")) {
if (!request["PatientOutSA"]) { if (request["PatientOutSA"] == true) {
return Future.value(true); isOutSideSa = true;
} else {
return Future.value(false);
}
} else { } else {
return Future.value(false); isOutSideSa = false;
} }
} catch (e) {
return Future.value(false);
} }
print(isOutSideSa);
return isOutSideSa;
} }
Future<bool> isPatientHasFile({required dynamic request}) async { bool isPatientHasFile({required dynamic request}) {
bool isFile = false; bool isFile = false;
if (request != null && request["NationalID"] != null) { if (request != null && request["NationalID"] != null) {
isFile = request["NationalID"].length < 10; isFile = request["NationalID"].length < 10;
@ -615,13 +610,12 @@ class AuthenticationViewModel extends ChangeNotifier {
final resultEither = await _authenticationRepo.checkUserStatus(commonAuthanticatedRequest: request); final resultEither = await _authenticationRepo.checkUserStatus(commonAuthanticatedRequest: request);
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async { resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async {
if (apiResponse.data is Map) { if (apiResponse.data is Map) {
_appState.setNHICUserData = CheckUserStatusResponseNHIC.fromJson(apiResponse.data as Map<String, dynamic>); setNHICData(apiResponse.data, request);
sendActivationCode( sendActivationCode(
otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]), otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]),
nationalIdOrFileNumber: request["PatientIdentificationID"].toString(), nationalIdOrFileNumber: request["PatientIdentificationID"].toString(),
phoneNumber: request["PatientMobileNumber"].toString(), phoneNumber: request["PatientMobileNumber"].toString(),
payload: request, payload: request);
);
} }
}); });
@ -661,6 +655,12 @@ class AuthenticationViewModel extends ChangeNotifier {
// }); // });
} }
void setNHICData(dynamic data, dynamic request) {
_appState.setNHICUserData = CheckUserStatusResponseNHIC.fromJson(data as Map<String, dynamic>);
request["healthId"] = _appState.getNHICUserData.healthId;
_appState.setUserRegistrationPayload = RegistrationDataModelPayload.fromJson(request);
}
@override @override
void dispose() { void dispose() {
nationalIdController.dispose(); nationalIdController.dispose();

@ -0,0 +1,69 @@
import 'dart:convert';
class RegistrationDataModelPayload {
int? patientMobileNumber;
String? zipCode;
int? searchType;
int? patientId;
int? patientIdentificationId;
int? otpSendType;
int? patientOutSa;
bool? isDentalAllowedBackend;
String? dob;
int? isHijri;
bool? forRegister;
bool? isRegister;
String? healthId;
RegistrationDataModelPayload({
this.patientMobileNumber,
this.zipCode,
this.searchType,
this.patientId,
this.patientIdentificationId,
this.otpSendType,
this.patientOutSa,
this.isDentalAllowedBackend,
this.dob,
this.isHijri,
this.forRegister,
this.isRegister,
this.healthId,
});
factory RegistrationDataModelPayload.fromRawJson(String str) => RegistrationDataModelPayload.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory RegistrationDataModelPayload.fromJson(Map<String, dynamic> json) => RegistrationDataModelPayload(
patientMobileNumber: json["PatientMobileNumber"],
zipCode: json["ZipCode"],
searchType: json["SearchType"],
patientId: json["PatientID"],
patientIdentificationId: json["PatientIdentificationID"],
otpSendType: json["OTP_SendType"],
patientOutSa: json["PatientOutSA"],
isDentalAllowedBackend: json["isDentalAllowedBackend"],
dob: json["DOB"],
isHijri: json["IsHijri"],
forRegister: json["forRegister"],
isRegister: json["isRegister"],
healthId: json["healthId"],
);
Map<String, dynamic> toJson() => {
"PatientMobileNumber": patientMobileNumber,
"ZipCode": zipCode,
"SearchType": searchType,
"PatientID": patientId,
"PatientIdentificationID": patientIdentificationId,
"OTP_SendType": otpSendType,
"PatientOutSA": patientOutSa,
"isDentalAllowedBackend": isDentalAllowedBackend,
"DOB": dob,
"IsHijri": isHijri,
"forRegister": forRegister,
"isRegister": isRegister,
"healthId": healthId,
};
}

@ -19,31 +19,25 @@ import 'package:hmg_patient_app_new/widgets/input_widget.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class RegisterNewStep2 extends StatefulWidget { class RegisterNewStep2 extends StatefulWidget {
var nHICData; RegisterNewStep2({Key? key}) : super(key: key);
var payload;
RegisterNewStep2(this.nHICData, this.payload, {Key? key}) : super(key: key);
@override @override
_RegisterNew createState() => _RegisterNew(); _RegisterNew createState() => _RegisterNew();
} }
class _RegisterNew extends State<RegisterNewStep2> { class _RegisterNew extends State<RegisterNewStep2> {
bool isFromDubai = true;
AuthenticationViewModel? authVM; AuthenticationViewModel? authVM;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
authVM = context.read<AuthenticationViewModel>(); authVM = context.read<AuthenticationViewModel>();
authVM!.loadCountriesData(context: context);
// isFromDubai = widget.payload.zipCode!.contains("971") || widget.payload.zipCode!.contains("+971");
} }
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
authVM!.clearDefaultInputValues(); // authVM!.clearDefaultInputValues();
} }
@override @override
@ -72,22 +66,23 @@ class _RegisterNew extends State<RegisterNewStep2> {
child: Column( child: Column(
children: [ children: [
TextInputWidget( TextInputWidget(
labelText: isFromDubai ? LocaleKeys.fullName.tr() : LocaleKeys.name.tr(), labelText: authVM!.isUserFromUAE() ? LocaleKeys.fullName.tr() : LocaleKeys.name.tr(),
hintText: isFromDubai ? "name" ?? "" : (widget.nHICData!.firstNameEn!.toUpperCase() + " " + widget.nHICData!.lastNameEn!.toUpperCase()), hintText:
controller: null, authVM!.isUserFromUAE() ? "" : ("${appState.getNHICUserData.firstNameEn!.toUpperCase()} ${appState.getNHICUserData.lastNameEn!.toUpperCase()}"),
controller: authVM!.isUserFromUAE() ? authVM!.nameController : null,
isEnable: true, isEnable: true,
prefix: null, prefix: null,
isAllowRadius: false, isAllowRadius: false,
isBorderAllowed: false, isBorderAllowed: false,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: isFromDubai ? false : true, isReadOnly: authVM!.isUserFromUAE() ? false : true,
leadingIcon: AppAssets.user_circle) leadingIcon: AppAssets.user_circle)
.paddingSymmetrical(0.h, 16.h), .paddingSymmetrical(0.h, 16.h),
Divider(height: 1, color: AppColors.greyColor), Divider(height: 1, color: AppColors.greyColor),
TextInputWidget( TextInputWidget(
labelText: LocaleKeys.nationalIdNumber.tr(), labelText: LocaleKeys.nationalIdNumber.tr(),
hintText: isFromDubai ? "widget.payload.nationalID!" : (widget.nHICData!.idNumber ?? ""), hintText: authVM!.isUserFromUAE() ? appState.getUserRegistrationPayload.patientIdentificationId.toString() : (appState.getNHICUserData.idNumber ?? ""),
controller: null, controller: null,
isEnable: true, isEnable: true,
prefix: null, prefix: null,
@ -98,7 +93,7 @@ class _RegisterNew extends State<RegisterNewStep2> {
leadingIcon: AppAssets.student_card) leadingIcon: AppAssets.student_card)
.paddingSymmetrical(0.h, 16.h), .paddingSymmetrical(0.h, 16.h),
Divider(height: 1, color: AppColors.greyColor), Divider(height: 1, color: AppColors.greyColor),
isFromDubai authVM!.isUserFromUAE()
? Selector<AuthenticationViewModel, GenderTypeEnum?>( ? Selector<AuthenticationViewModel, GenderTypeEnum?>(
selector: (_, authViewModel) => authViewModel.genderType, selector: (_, authViewModel) => authViewModel.genderType,
shouldRebuild: (previous, next) => previous != next, shouldRebuild: (previous, next) => previous != next,
@ -121,19 +116,19 @@ class _RegisterNew extends State<RegisterNewStep2> {
}) })
: TextInputWidget( : TextInputWidget(
labelText: LocaleKeys.gender.tr(), labelText: LocaleKeys.gender.tr(),
hintText: (widget.nHICData!.gender ?? ""), hintText: (appState.getNHICUserData.gender ?? ""),
controller: null, controller: null,
isEnable: true, isEnable: true,
prefix: null, prefix: null,
isAllowRadius: false, isAllowRadius: false,
isBorderAllowed: false, isBorderAllowed: false,
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: isFromDubai ? false : true, isReadOnly: authVM!.isUserFromUAE() ? false : true,
leadingIcon: AppAssets.user_full, leadingIcon: AppAssets.user_full,
onChange: (value) {}) onChange: (value) {})
.paddingSymmetrical(0.h, 16.h), .paddingSymmetrical(0.h, 16.h),
Divider(height: 1, color: AppColors.greyColor), Divider(height: 1, color: AppColors.greyColor),
isFromDubai authVM!.isUserFromUAE()
? Selector<AuthenticationViewModel, MaritalStatusTypeEnum?>( ? Selector<AuthenticationViewModel, MaritalStatusTypeEnum?>(
selector: (_, authViewModel) => authViewModel.maritalStatus, selector: (_, authViewModel) => authViewModel.maritalStatus,
shouldRebuild: (previous, next) => previous != next, shouldRebuild: (previous, next) => previous != next,
@ -158,8 +153,8 @@ class _RegisterNew extends State<RegisterNewStep2> {
: TextInputWidget( : TextInputWidget(
labelText: LocaleKeys.maritalStatus.tr(), labelText: LocaleKeys.maritalStatus.tr(),
hintText: appState.isArabic() hintText: appState.isArabic()
? (MaritalStatusTypeExtension.fromValue(widget.nHICData!.maritalStatusCode)!.typeAr) ? (MaritalStatusTypeExtension.fromValue(appState.getNHICUserData.maritalStatusCode)!.typeAr)
: (MaritalStatusTypeExtension.fromValue(widget.nHICData!.maritalStatusCode)!.type), : (MaritalStatusTypeExtension.fromValue(appState.getNHICUserData.maritalStatusCode)!.type),
isEnable: true, isEnable: true,
prefix: null, prefix: null,
isAllowRadius: false, isAllowRadius: false,
@ -170,7 +165,7 @@ class _RegisterNew extends State<RegisterNewStep2> {
onChange: (value) {}) onChange: (value) {})
.paddingSymmetrical(0.h, 16.h), .paddingSymmetrical(0.h, 16.h),
Divider(height: 1, color: AppColors.greyColor), Divider(height: 1, color: AppColors.greyColor),
isFromDubai authVM!.isUserFromUAE()
? Selector<AuthenticationViewModel, ({List<NationalityCountries>? countriesList, NationalityCountries? selectedCountry, bool isArabic})>( ? Selector<AuthenticationViewModel, ({List<NationalityCountries>? countriesList, NationalityCountries? selectedCountry, bool isArabic})>(
selector: (context, authViewModel) { selector: (context, authViewModel) {
final appState = getIt.get<AppState>(); final appState = getIt.get<AppState>();
@ -206,8 +201,8 @@ class _RegisterNew extends State<RegisterNewStep2> {
: TextInputWidget( : TextInputWidget(
labelText: LocaleKeys.nationality.tr(), labelText: LocaleKeys.nationality.tr(),
hintText: appState.isArabic() hintText: appState.isArabic()
? (authVM!.countriesList!.firstWhere((e) => e.id == (widget.nHICData!.nationalityCode ?? ""), orElse: () => NationalityCountries()).nameN ?? "") ? (authVM!.countriesList!.firstWhere((e) => e.id == (appState.getNHICUserData.nationalityCode ?? ""), orElse: () => NationalityCountries()).nameN ?? "")
: (authVM!.countriesList!.firstWhere((e) => e.id == (widget.nHICData!.nationalityCode ?? ""), orElse: () => NationalityCountries()).name ?? ""), : (authVM!.countriesList!.firstWhere((e) => e.id == (appState.getNHICUserData.nationalityCode ?? ""), orElse: () => NationalityCountries()).name ?? ""),
isEnable: true, isEnable: true,
prefix: null, prefix: null,
isAllowRadius: false, isAllowRadius: false,
@ -223,7 +218,7 @@ class _RegisterNew extends State<RegisterNewStep2> {
), ),
TextInputWidget( TextInputWidget(
labelText: LocaleKeys.mobileNumber.tr(), labelText: LocaleKeys.mobileNumber.tr(),
hintText: ("widget.payload.mobileNo" ?? ""), hintText: (appState.getUserRegistrationPayload.patientMobileNumber.toString() ?? ""),
controller: authVM!.phoneNumberController, controller: authVM!.phoneNumberController,
isEnable: true, isEnable: true,
prefix: null, prefix: null,
@ -240,15 +235,15 @@ class _RegisterNew extends State<RegisterNewStep2> {
), ),
TextInputWidget( TextInputWidget(
labelText: LocaleKeys.dob.tr(), labelText: LocaleKeys.dob.tr(),
hintText: isFromDubai ? "widget.payload.dob!" : (widget.nHICData!.dateOfBirth ?? ""), hintText: authVM!.isUserFromUAE() ? appState.getUserRegistrationPayload.dob! : (appState.getNHICUserData.dateOfBirth ?? ""),
controller: authVM!.dobController, controller: authVM!.dobController,
isEnable: true, isEnable: authVM!.isUserFromUAE() ? true : false,
prefix: null, prefix: null,
isBorderAllowed: false, isBorderAllowed: false,
isAllowLeadingIcon: true, isAllowLeadingIcon: true,
isReadOnly: true, isReadOnly: true,
leadingIcon: AppAssets.birthday_cake, leadingIcon: AppAssets.birthday_cake,
selectionType: SelectionTypeEnum.calendar, selectionType: authVM!.isUserFromUAE() ? SelectionTypeEnum.calendar : null,
).paddingSymmetrical(0.h, 16.h), ).paddingSymmetrical(0.h, 16.h),
], ],
), ),

@ -39,6 +39,7 @@ class _LandingPageState extends State<LandingPage> {
@override @override
void initState() { void initState() {
authVM = context.read<AuthenticationViewModel>(); authVM = context.read<AuthenticationViewModel>();
authVM.savePushTokenToAppState();
if (mounted) { if (mounted) {
authVM.checkLastLoginStatus(() { authVM.checkLastLoginStatus(() {
// showQuickLogin(context, false); // showQuickLogin(context, false);

@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/presentation/authentication/login.dart'; import 'package:hmg_patient_app_new/presentation/authentication/login.dart';
import 'package:hmg_patient_app_new/presentation/authentication/register.dart';
import 'package:hmg_patient_app_new/presentation/authentication/register_step2.dart';
import 'package:hmg_patient_app_new/presentation/home/landing_page.dart'; import 'package:hmg_patient_app_new/presentation/home/landing_page.dart';
import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart';
import 'package:hmg_patient_app_new/splashPage.dart'; import 'package:hmg_patient_app_new/splashPage.dart';
@ -7,12 +9,15 @@ import 'package:hmg_patient_app_new/splashPage.dart';
class AppRoutes { class AppRoutes {
static const String initialRoute = '/initialRoute'; static const String initialRoute = '/initialRoute';
static const String loginScreen = '/loginScreen'; static const String loginScreen = '/loginScreen';
static const String registerNewScreen = '/registerNewScreen'; static const String register = '/register';
static const String registerStepTwo = '/registerStepTwo';
static const String landingScreen = '/landingScreen'; static const String landingScreen = '/landingScreen';
static Map<String, WidgetBuilder> get routes => { static Map<String, WidgetBuilder> get routes => {
initialRoute: (context) => SplashPage(), initialRoute: (context) => SplashPage(),
loginScreen: (context) => LoginScreen(), loginScreen: (context) => LoginScreen(),
landingScreen: (context) => LandingNavigation(), landingScreen: (context) => LandingNavigation(),
register: (context) => RegisterNew(),
registerStepTwo: (context) => RegisterNewStep2(),
}; };
} }

@ -105,7 +105,7 @@ class _CustomCountryDropdownState extends State<CustomCountryDropdown> {
SizedBox(width: 4.h), SizedBox(width: 4.h),
if (widget.isEnableTextField) if (widget.isEnableTextField)
SizedBox( SizedBox(
height: 20, height: 18,
width: 200, width: 200,
child: TextField( child: TextField(
focusNode: textFocusNode, focusNode: textFocusNode,

Loading…
Cancel
Save