Merge branch 'refs/heads/master' into dev_sikander

pull/19/head
Sikander Saleem 2 months ago
commit dfe02917fc

@ -166,8 +166,8 @@ class ApiClientImp implements ApiClient {
body['Latitude'] = _appState.userLat.toString(); body['Latitude'] = _appState.userLat.toString();
body['Longitude'] = _appState.userLong.toString(); body['Longitude'] = _appState.userLong.toString();
body['DeviceTypeID'] = _appState.deviceTypeID; body['DeviceTypeID'] = _appState.deviceTypeID;
if (_appState.appLoginTokenID.isNotEmpty) { if (_appState.appAuthToken.isNotEmpty) {
body['LogInTokenID'] = _appState.appLoginTokenID; body[_appState.isAuthenticated ? 'TokenID' : 'LogInTokenID'] = _appState.appAuthToken;
} }
// body['TokenID'] = "@dm!n"; // body['TokenID'] = "@dm!n";

@ -62,9 +62,9 @@ class AppState {
SelectDeviceByImeiRespModelElement? get getSelectDeviceByImeiRespModelElement => _selectDeviceByImeiRespModelElement; SelectDeviceByImeiRespModelElement? get getSelectDeviceByImeiRespModelElement => _selectDeviceByImeiRespModelElement;
String appLoginTokenID = ""; // String appLoginTokenID = "";
//
set setAppLoginTokenID(v) => appLoginTokenID = v; // set setAppLoginTokenID(v) => appLoginTokenID = v;
String deviceToken = ""; String deviceToken = "";

@ -90,7 +90,7 @@ class RequestUtils {
} else { } else {
request.patientID = 0; request.patientID = 0;
request.searchType = 1; request.searchType = 1;
request.patientIdentificationID = request.nationalID = (nationIdText.isNotEmpty ? nationIdText : '0') as int?; request.patientIdentificationID = request.nationalID = (nationIdText.isNotEmpty ? int.parse(nationIdText) : 0);
} }
request.isRegister = false; request.isRegister = false;
} }

@ -138,19 +138,19 @@ extension EmailValidator on String {
decoration: isUnderLine ? TextDecoration.underline : null), decoration: isUnderLine ? TextDecoration.underline : null),
); );
Widget toText14({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, FontWeight? weight, int? maxlines}) => Text( Widget toText14({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, FontWeight? weight, int? maxlines, double? letterSpacing = -1}) => Text(
this, this,
textAlign: isCenter ? TextAlign.center : null, textAlign: isCenter ? TextAlign.center : null,
maxLines: maxlines, maxLines: maxlines,
style: TextStyle( style: TextStyle(
color: color ?? AppColors.blackColor, color: color ?? AppColors.blackColor,
fontSize: 14.fSize, fontSize: 14.fSize,
letterSpacing: -1, letterSpacing: letterSpacing,
fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal),
decoration: isUnderLine ? TextDecoration.underline : null), decoration: isUnderLine ? TextDecoration.underline : null),
); );
Widget toText15({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, FontWeight? weight, int? maxlines, double? letterSpacing = -0.4,}) => Text( Widget toText15({Color? color, bool isUnderLine = false, bool isBold = false, bool isCenter = false, FontWeight? weight, int? maxlines, double? letterSpacing = -1}) => Text(
this, this,
textAlign: isCenter ? TextAlign.center : null, textAlign: isCenter ? TextAlign.center : null,
maxLines: maxlines, maxLines: maxlines,

@ -272,7 +272,7 @@ class AuthenticationViewModel extends ChangeNotifier {
await _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage ?? "ErrorEmpty", onOkPressed: () {}); await _dialogService.showErrorBottomSheet(message: apiResponse.errorMessage ?? "ErrorEmpty", onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) { } else if (apiResponse.messageStatus == 1) {
if (apiResponse.data['isSMSSent']) { if (apiResponse.data['isSMSSent']) {
_appState.setAppLoginTokenID = apiResponse.data['LogInTokenID']; _appState.setAppAuthToken = apiResponse.data['LogInTokenID'];
sendActivationCode( sendActivationCode(
otpTypeEnum: otpTypeEnum, otpTypeEnum: otpTypeEnum,
phoneNumber: phoneNumberController.text, phoneNumber: phoneNumberController.text,
@ -364,7 +364,7 @@ class AuthenticationViewModel extends ChangeNotifier {
otpTypeEnum: otpTypeEnum, otpTypeEnum: otpTypeEnum,
deviceToken: _appState.deviceToken, deviceToken: _appState.deviceToken,
patientOutSA: true, patientOutSA: true,
loginTokenID: _appState.appLoginTokenID, loginTokenID: _appState.appAuthToken,
registeredData: null, registeredData: null,
nationIdText: nationalIdController.text, nationIdText: nationalIdController.text,
countryCode: selectedCountrySignup.countryCode, countryCode: selectedCountrySignup.countryCode,
@ -412,7 +412,7 @@ class AuthenticationViewModel extends ChangeNotifier {
_appState.setAuthenticatedUser(activation.list!.first); _appState.setAuthenticatedUser(activation.list!.first);
} }
_appState.setUserBloodGroup = (activation.patientBlodType ?? ""); _appState.setUserBloodGroup = (activation.patientBlodType ?? "");
_appState.setAppLoginTokenID = activation.authenticationTokenId; _appState.setAppAuthToken = activation.authenticationTokenId;
final request = RequestUtils.getAuthanticatedCommonRequest().toJson(); final request = RequestUtils.getAuthanticatedCommonRequest().toJson();
bool isUserAgreedBefore = await checkIfUserAgreedBefore(request: request); bool isUserAgreedBefore = await checkIfUserAgreedBefore(request: request);
clearDefaultInputValues(); clearDefaultInputValues();
@ -574,7 +574,7 @@ class AuthenticationViewModel extends ChangeNotifier {
chekUserNHICData(request: request); chekUserNHICData(request: request);
} else { } else {
print("=======OUT SA======="); print("=======OUT SA=======");
_appState.setAppLoginTokenID = 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(),

@ -9,8 +9,8 @@ class CheckActivationCodeRegisterReq {
String? logInTokenID; String? logInTokenID;
int? searchType; int? searchType;
int? patientID; int? patientID;
String? nationalID; int? nationalID;
String? patientIdentificationID; int? patientIdentificationID;
String? activationCode; String? activationCode;
bool? isSilentLogin; bool? isSilentLogin;
double? versionID; double? versionID;

@ -108,6 +108,7 @@ class _OTPVerificationScreenState extends State<OTPVerificationScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.scaffoldBgColor,
appBar: CustomAppBar( appBar: CustomAppBar(
hideLogoAndLang: true, hideLogoAndLang: true,
onBackPressed: () { onBackPressed: () {

@ -18,10 +18,7 @@ import 'package:hmg_patient_app_new/widgets/bottomsheet/generic_bottom_sheet.dar
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class SavedLogin extends StatefulWidget { class SavedLogin extends StatefulWidget {
const SavedLogin({Key? key}) : super(key: key); const SavedLogin({Key? key}) : super(key: key);
@override @override
@ -29,15 +26,17 @@ class SavedLogin extends StatefulWidget {
} }
class _SavedLogin extends State<SavedLogin> { class _SavedLogin extends State<SavedLogin> {
LoginTypeEnum loginType = LoginTypeEnum.sms; LoginTypeEnum loginType = LoginTypeEnum.sms;
late AuthenticationViewModel authVm; late AuthenticationViewModel authVm;
late AppState appState; late AppState appState;
@override @override
void initState() { void initState() {
authVm = context.read<AuthenticationViewModel>(); authVm = context.read<AuthenticationViewModel>();
appState = getIt.get<AppState>(); appState = getIt.get<AppState>();
authVm.phoneNumberController.text = appState.getSelectDeviceByImeiRespModelElement!.mobile!; authVm.phoneNumberController.text = appState.getSelectDeviceByImeiRespModelElement!.mobile!.startsWith("0")
? appState.getSelectDeviceByImeiRespModelElement!.mobile!.replaceFirst("0", "")
: appState.getSelectDeviceByImeiRespModelElement!.mobile!;
authVm.nationalIdController.text = appState.getSelectDeviceByImeiRespModelElement!.identificationNo!; authVm.nationalIdController.text = appState.getSelectDeviceByImeiRespModelElement!.identificationNo!;
super.initState(); super.initState();
@ -45,11 +44,12 @@ class _SavedLogin extends State<SavedLogin> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.scaffoldBgColor,
appBar: CustomAppBar( appBar: CustomAppBar(
onBackPressed: () {}, onBackPressed: () {
Navigator.of(context).pop();
},
onLanguageChanged: (lang) {}, onLanguageChanged: (lang) {},
), ),
body: SafeArea( body: SafeArea(
@ -78,12 +78,16 @@ class _SavedLogin extends State<SavedLogin> {
children: [ children: [
// Last login info // Last login info
("${LocaleKeys.lastloginBy.tr() } ${LoginTypeExtension.fromValue(appState.getSelectDeviceByImeiRespModelElement!.logInType!)!.displayName}" ("${LocaleKeys.lastloginBy.tr()} ${LoginTypeExtension.fromValue(appState.getSelectDeviceByImeiRespModelElement!.logInType!)!.displayName}")
).toText14(isBold: true, color: AppColors.greyTextColor), .toText14(isBold: true, color: AppColors.greyTextColor),
(appState.getSelectDeviceByImeiRespModelElement!.createdOn != null ? DateUtil.getFormattedDate(DateUtil.convertStringToDate(appState.getSelectDeviceByImeiRespModelElement!.createdOn!), "d MMMM, y at HH:mm") : '--') (appState.getSelectDeviceByImeiRespModelElement!.createdOn != null
? DateUtil.getFormattedDate(DateUtil.convertStringToDate(appState.getSelectDeviceByImeiRespModelElement!.createdOn!), "d MMMM, y at HH:mm")
: '--')
.toText16(isBold: true, color: AppColors.textColor), .toText16(isBold: true, color: AppColors.textColor),
Container(margin: EdgeInsets.all(16.h), child: Utils.buildSvgWithAssets(icon: getTypeIcons(loginType.toInt), height: 54, width: 54, iconColor: loginType.toInt == 4 ? null : AppColors.primaryRedColor)), Container(
margin: EdgeInsets.all(16.h),
child: Utils.buildSvgWithAssets(icon: getTypeIcons(loginType.toInt), height: 54, width: 54, iconColor: loginType.toInt == 4 ? null : AppColors.primaryRedColor)),
// Face ID login button // Face ID login button
SizedBox( SizedBox(
height: 45, height: 45,
@ -92,8 +96,7 @@ class _SavedLogin extends State<SavedLogin> {
onPressed: () { onPressed: () {
if (loginType == LoginTypeEnum.fingerprint || loginType == LoginTypeEnum.face) { if (loginType == LoginTypeEnum.fingerprint || loginType == LoginTypeEnum.face) {
authVm.loginWithFingerPrintFace(loginType.toInt); authVm.loginWithFingerPrintFace(loginType.toInt);
} } else {
else {
// int? val = loginType.toInt; // int? val = loginType.toInt;
authVm.checkUserAuthentication(otpTypeEnum: loginType == LoginTypeEnum.sms ? OTPTypeEnum.sms : OTPTypeEnum.whatsapp); authVm.checkUserAuthentication(otpTypeEnum: loginType == LoginTypeEnum.sms ? OTPTypeEnum.sms : OTPTypeEnum.whatsapp);
} }
@ -157,7 +160,7 @@ class _SavedLogin extends State<SavedLogin> {
Navigator.of(context).pop(); Navigator.of(context).pop();
loginType = LoginTypeEnum.sms; loginType = LoginTypeEnum.sms;
int? val = loginType.toInt; int? val = loginType.toInt;
authVm.checkUserAuthentication(otpTypeEnum:OTPTypeEnum.sms ); authVm.checkUserAuthentication(otpTypeEnum: OTPTypeEnum.sms);
}, },
backgroundColor: AppColors.primaryRedColor, backgroundColor: AppColors.primaryRedColor,
borderColor: AppColors.primaryRedBorderColor, borderColor: AppColors.primaryRedBorderColor,
@ -180,7 +183,7 @@ class _SavedLogin extends State<SavedLogin> {
Navigator.of(context).pop(); Navigator.of(context).pop();
loginType = LoginTypeEnum.whatsapp; loginType = LoginTypeEnum.whatsapp;
int? val = loginType.toInt; int? val = loginType.toInt;
authVm.checkUserAuthentication(otpTypeEnum:OTPTypeEnum.whatsapp ); authVm.checkUserAuthentication(otpTypeEnum: OTPTypeEnum.whatsapp);
}, },
backgroundColor: AppColors.transparent, backgroundColor: AppColors.transparent,
borderColor: AppColors.textColor, borderColor: AppColors.textColor,
@ -216,8 +219,7 @@ class _SavedLogin extends State<SavedLogin> {
} else { } else {
loginType = LoginTypeEnum.whatsapp; loginType = LoginTypeEnum.whatsapp;
int? val = loginType.toInt; int? val = loginType.toInt;
authVm.checkUserAuthentication(otpTypeEnum:OTPTypeEnum.whatsapp ); authVm.checkUserAuthentication(otpTypeEnum: OTPTypeEnum.whatsapp);
} }
}, },
backgroundColor: AppColors.whiteColor, backgroundColor: AppColors.whiteColor,

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

@ -1,6 +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/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/splashPage.dart'; import 'package:hmg_patient_app_new/splashPage.dart';
class AppRoutes { class AppRoutes {
@ -12,6 +13,6 @@ class AppRoutes {
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) => LandingPage(), landingScreen: (context) => LandingNavigation(),
}; };
} }

@ -102,7 +102,7 @@ class _CustomTabBarState extends State<CustomTabBar> {
children: [ children: [
if (tabBar.image != null) Utils.buildSvgWithAssets(icon: tabBar.image!, height: 18, width: 18, iconColor: isSelected ? widget.activeTextColor : widget.inActiveTextColor), if (tabBar.image != null) Utils.buildSvgWithAssets(icon: tabBar.image!, height: 18, width: 18, iconColor: isSelected ? widget.activeTextColor : widget.inActiveTextColor),
tabBar.title tabBar.title
.toText15(weight: isSelected ? FontWeight.w600 : FontWeight.w500, color: isSelected ? widget.activeTextColor : widget.inActiveTextColor, letterSpacing: isSelected ? -0.3 : -0.1), .toText14(weight: isSelected ? FontWeight.w600 : FontWeight.w500, color: isSelected ? widget.activeTextColor : widget.inActiveTextColor, letterSpacing: isSelected ? -0.3 : -0.1),
], ],
)).onPress(() { )).onPress(() {
setState(() { setState(() {

Loading…
Cancel
Save