refactoriåtion

wala_plus_with_dialog_removal
FaizHashmi 3 weeks ago
parent 825845b4c3
commit e134e8d4e5

@ -807,6 +807,7 @@
"locationServicesRequiredForAttendance": "يجب تفعيل خدمة الموقع لتسجيل الحضور", "locationServicesRequiredForAttendance": "يجب تفعيل خدمة الموقع لتسجيل الحضور",
"pleaseProvideLocationPermission": "الرجاء منح إذن الموقع", "pleaseProvideLocationPermission": "الرجاء منح إذن الموقع",
"microphoneAccessRequired": "يحتاج التطبيق إلى إذن الوصول إلى الميكروفون لتسجيل الصوت.", "microphoneAccessRequired": "يحتاج التطبيق إلى إذن الوصول إلى الميكروفون لتسجيل الصوت.",
"shareAccessGuide": "مشاركة دليل الوصول" "shareAccessGuide": "مشاركة دليل الوصول",
"nationalIdOrIqamaNumber": "رقم الهوية الوطنية أو الإقامة"
} }

@ -807,7 +807,8 @@
"locationServicesRequiredForAttendance": "You need to enable location services to mark attendance", "locationServicesRequiredForAttendance": "You need to enable location services to mark attendance",
"pleaseProvideLocationPermission": "Please provide location permission", "pleaseProvideLocationPermission": "Please provide location permission",
"microphoneAccessRequired": "The app needs microphone access to be able to record audio.", "microphoneAccessRequired": "The app needs microphone access to be able to record audio.",
"shareAccessGuide": "Share Access Guide" "shareAccessGuide": "Share Access Guide",
"nationalIdOrIqamaNumber": "National ID or Iqama Number"
} }

@ -819,7 +819,8 @@ class CodegenLoader extends AssetLoader{
"locationServicesRequiredForAttendance": "يجب تفعيل خدمة الموقع لتسجيل الحضور", "locationServicesRequiredForAttendance": "يجب تفعيل خدمة الموقع لتسجيل الحضور",
"pleaseProvideLocationPermission": "الرجاء منح إذن الموقع", "pleaseProvideLocationPermission": "الرجاء منح إذن الموقع",
"microphoneAccessRequired": "يحتاج التطبيق إلى إذن الوصول إلى الميكروفون لتسجيل الصوت.", "microphoneAccessRequired": "يحتاج التطبيق إلى إذن الوصول إلى الميكروفون لتسجيل الصوت.",
"shareAccessGuide": "مشاركة دليل الوصول" "shareAccessGuide": "مشاركة دليل الوصول",
"nationalIdOrIqamaNumber": "رقم الهوية الوطنية أو الإقامة"
}; };
static const Map<String,dynamic> _en_US = { static const Map<String,dynamic> _en_US = {
"mohemm": "Mohemm", "mohemm": "Mohemm",
@ -1626,7 +1627,8 @@ static const Map<String,dynamic> _en_US = {
"locationServicesRequiredForAttendance": "You need to enable location services to mark attendance", "locationServicesRequiredForAttendance": "You need to enable location services to mark attendance",
"pleaseProvideLocationPermission": "Please provide location permission", "pleaseProvideLocationPermission": "Please provide location permission",
"microphoneAccessRequired": "The app needs microphone access to be able to record audio.", "microphoneAccessRequired": "The app needs microphone access to be able to record audio.",
"shareAccessGuide": "Share Access Guide" "shareAccessGuide": "Share Access Guide",
"nationalIdOrIqamaNumber": "National ID or Iqama Number"
}; };
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": _ar_SA, "en_US": _en_US}; static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": _ar_SA, "en_US": _en_US};
} }

@ -792,5 +792,6 @@ abstract class LocaleKeys {
static const pleaseProvideLocationPermission = 'pleaseProvideLocationPermission'; static const pleaseProvideLocationPermission = 'pleaseProvideLocationPermission';
static const microphoneAccessRequired = 'microphoneAccessRequired'; static const microphoneAccessRequired = 'microphoneAccessRequired';
static const shareAccessGuide = 'shareAccessGuide'; static const shareAccessGuide = 'shareAccessGuide';
static const nationalIdOrIqamaNumber = 'nationalIdOrIqamaNumber';
} }

@ -366,9 +366,7 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
await Utils.saveStringFromPrefs("P_DEP_MOBILE_NUMBER", mobile); await Utils.saveStringFromPrefs("P_DEP_MOBILE_NUMBER", mobile);
} }
String tokenID = String tokenID =
(AppState().postParamsObject?.tokenID != null && AppState().postParamsObject!.tokenID!.isNotEmpty) (AppState().postParamsObject?.tokenID != null && AppState().postParamsObject!.tokenID!.isNotEmpty) ? AppState().postParamsObject!.tokenID! : (AppState().authenticationTokenID ?? "");
? AppState().postParamsObject!.tokenID!
: (AppState().authenticationTokenID ?? "");
if (tokenID.isNotEmpty) { if (tokenID.isNotEmpty) {
await Utils.saveStringFromPrefs("P_DEP_TOKEN_ID", tokenID); await Utils.saveStringFromPrefs("P_DEP_TOKEN_ID", tokenID);
} }
@ -409,7 +407,7 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
message: LocaleKeys.areYouSureWantToLogOut.tr(), message: LocaleKeys.areYouSureWantToLogOut.tr(),
confirmText: LocaleKeys.yes.tr(), confirmText: LocaleKeys.yes.tr(),
cancelText: LocaleKeys.no.tr(), cancelText: LocaleKeys.no.tr(),
isDestructive: true, isDestructive: false,
onConfirm: () async { onConfirm: () async {
if (ApiConsts.isDependetLogin) { if (ApiConsts.isDependetLogin) {
await _clearDependentPrefs(); await _clearDependentPrefs();
@ -497,11 +495,7 @@ class _DashboardScreenForDependetState extends State<DashboardScreenForDependet>
} }
}, },
), ),
if (ApiConsts.isDependetLogin) IconButton( if (ApiConsts.isDependetLogin) InkWell(onTap: _performLogout, child: SvgPicture.asset('assets/images/drawer/logout.svg', height: 20, width: 20)),
icon: const Icon(Icons.logout_rounded, size: 24, color: Color(0xFF1E293B)),
tooltip: LocaleKeys.logout.tr(),
onPressed: _performLogout,
),
], ],
), ),
], ],

@ -244,7 +244,7 @@ class _LoginScreenState extends State<LoginScreen> {
bool autoLoggedIn = await _tryDependentAutoLogin(); bool autoLoggedIn = await _tryDependentAutoLogin();
if (autoLoggedIn) { if (autoLoggedIn) {
return; return;
}else { } else {
dependentLoginInfo = await LoginApiClient().getMobileLoginInfoNEWDependent(devToken, devType, memberType: MemberType.dependent.value); dependentLoginInfo = await LoginApiClient().getMobileLoginInfoNEWDependent(devToken, devType, memberType: MemberType.dependent.value);
Utils.hideLoading(context); Utils.hideLoading(context);
if (dependentLoginInfo != null) { if (dependentLoginInfo != null) {
@ -790,9 +790,7 @@ class _LoginScreenState extends State<LoginScreen> {
String savedLoginType = await Utils.getStringFromPrefs("P_DEP_LOGIN_TYPE"); String savedLoginType = await Utils.getStringFromPrefs("P_DEP_LOGIN_TYPE");
int loginType = int.tryParse(savedLoginType) ?? 1; int loginType = int.tryParse(savedLoginType) ?? 1;
String effectiveToken = savedAuthToken.isNotEmpty String effectiveToken = savedAuthToken.isNotEmpty ? savedAuthToken : (savedToken.isNotEmpty ? savedToken : savedLoginToken);
? savedAuthToken
: (savedToken.isNotEmpty ? savedToken : savedLoginToken);
if (nationalId.text.isEmpty) { if (nationalId.text.isEmpty) {
nationalId.text = savedNid; nationalId.text = savedNid;
@ -847,13 +845,7 @@ class _LoginScreenState extends State<LoginScreen> {
String devType = Platform.isAndroid ? "android" : "ios"; String devType = Platform.isAndroid ? "android" : "ios";
try { try {
GenericResponseModel? depLoginResponse = await LoginApiClient().memberLoginDependent( GenericResponseModel? depLoginResponse = await LoginApiClient().memberLoginDependent(nationalId: savedNid, birthDate: savedDob, deviceToken: devToken, deviceType: devType, context: context);
nationalId: savedNid,
birthDate: savedDob,
deviceToken: devToken,
deviceType: devType,
context: context,
);
if (depLoginResponse?.errorMessage != null && depLoginResponse!.errorMessage!.isNotEmpty) { if (depLoginResponse?.errorMessage != null && depLoginResponse!.errorMessage!.isNotEmpty) {
if (Utils.isMazayaAccessRevoked(depLoginResponse.errorMessage)) { if (Utils.isMazayaAccessRevoked(depLoginResponse.errorMessage)) {
@ -866,22 +858,14 @@ class _LoginScreenState extends State<LoginScreen> {
} }
if (depLoginResponse != null) { if (depLoginResponse != null) {
String? authToken = (depLoginResponse.authenticationTokenID != null && depLoginResponse.authenticationTokenID!.trim().isNotEmpty) String? authToken = (depLoginResponse.authenticationTokenID != null && depLoginResponse.authenticationTokenID!.trim().isNotEmpty) ? depLoginResponse.authenticationTokenID!.trim() : null;
? depLoginResponse.authenticationTokenID!.trim()
: null;
String? logInTokenID = depLoginResponse.logInTokenID; String? logInTokenID = depLoginResponse.logInTokenID;
String? mobileNumber = depLoginResponse.getWalaplusDepInfoModel?.pEmpMobileNumber ?? savedMobile; String? mobileNumber = depLoginResponse.getWalaplusDepInfoModel?.pEmpMobileNumber ?? savedMobile;
if (authToken != null && authToken.isNotEmpty) { if (authToken != null && authToken.isNotEmpty) {
if (mounted) { if (mounted) {
Utils.hideLoading(context); Utils.hideLoading(context);
_completeDependentLogin( _completeDependentLogin(depLoginResponse, logInTokenID ?? authToken, mobileNumber, loginType: loginType, navigateToDashboard: true);
depLoginResponse,
logInTokenID ?? authToken,
mobileNumber,
loginType: loginType,
navigateToDashboard: true,
);
} }
return true; return true;
} }
@ -1043,7 +1027,7 @@ class _LoginScreenState extends State<LoginScreen> {
20.height, 20.height,
_buildDependentCtaCard(context), _buildDependentCtaCard(context),
] else ...[ ] else ...[
InputWidget(LocaleKeys.nationalId.tr(), "1234567890", nationalId, isInputTypeNum: true), InputWidget(LocaleKeys.nationalIdOrIqamaNumber.tr(), "1234567890", nationalId, isInputTypeNum: true),
12.height, 12.height,
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,

@ -65,10 +65,7 @@ class _InputWidgetState extends State<InputWidget> {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
color: widget.isBackgroundEnable ? Color(0xffF7F7F7) : Colors.white, color: widget.isBackgroundEnable ? Color(0xffF7F7F7) : Colors.white,
border: Border.all( border: Border.all(color: widget.isEnableBorder ? Color(0xffefefef) : Colors.transparent, width: 1),
color: widget.isEnableBorder ? Color(0xffefefef) : Colors.transparent,
width: 1,
),
), ),
child: InkWell( child: InkWell(
onTap: widget.hasSelection ? () {} : null, onTap: widget.hasSelection ? () {} : null,
@ -79,15 +76,7 @@ class _InputWidgetState extends State<InputWidget> {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(widget.labelText, style: const TextStyle(fontSize: 11, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.44)),
widget.labelText,
style: const TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
),
TextField( TextField(
enabled: widget.isEnable, enabled: widget.isEnable,
scrollPadding: EdgeInsets.zero, scrollPadding: EdgeInsets.zero,
@ -97,23 +86,11 @@ class _InputWidgetState extends State<InputWidget> {
obscuringCharacter: "*", obscuringCharacter: "*",
obscureText: isObscureText, obscureText: isObscureText,
onChanged: widget.onChange, onChanged: widget.onChange,
style: const TextStyle( style: const TextStyle(fontSize: 14, height: 21 / 14, fontWeight: FontWeight.w400, color: Color(0xff2B353E), letterSpacing: -0.44),
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff2B353E),
letterSpacing: -0.44,
),
decoration: InputDecoration( decoration: InputDecoration(
isDense: true, isDense: true,
hintText: widget.hintText, hintText: widget.hintText,
hintStyle: const TextStyle( hintStyle: const TextStyle(fontSize: 14, height: 21 / 14, fontWeight: FontWeight.w400, color: Color(0xff575757), letterSpacing: -0.56),
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff575757),
letterSpacing: -0.56,
),
suffixIconConstraints: const BoxConstraints(minWidth: 50), suffixIconConstraints: const BoxConstraints(minWidth: 50),
suffixIcon: widget.suffixTap == null ? null : IconButton(icon: const Icon(Icons.mic, color: MyColors.darkTextColor), onPressed: widget.suffixTap), suffixIcon: widget.suffixTap == null ? null : IconButton(icon: const Icon(Icons.mic, color: MyColors.darkTextColor), onPressed: widget.suffixTap),
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
@ -131,7 +108,7 @@ class _InputWidgetState extends State<InputWidget> {
setState(() { setState(() {
isObscureText = !isObscureText; isObscureText = !isObscureText;
}); });
}) }),
], ],
if (widget.hasSelection) Icon(Icons.keyboard_arrow_down_outlined), if (widget.hasSelection) Icon(Icons.keyboard_arrow_down_outlined),
], ],

Loading…
Cancel
Save