login issue fixed

merge-requests/392/head
Sultan Khan 4 years ago
parent f0bb94c422
commit 2ebfdcfdd7

@ -12,8 +12,8 @@ const PACKAGES_PRODUCTS = '/api/products';
const PACKAGES_CUSTOMER = '/api/customers';
const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
const PACKAGES_ORDERS = '/api/orders';
const BASE_URL = 'https://uat.hmgwebservices.com/';
// const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/';
const BASE_URL = 'https://hmgwebservices.com/';
// Pharmacy UAT URLs
const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';

@ -34,6 +34,7 @@ import 'package:intl/intl.dart';
import 'package:local_auth/auth_strings.dart';
import 'package:local_auth/local_auth.dart';
import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/config/config.dart';
class ConfirmLogin extends StatefulWidget {
@override
@ -403,12 +404,13 @@ class _ConfirmLogin extends State<ConfirmLogin> {
}
if (authenticated == true) {
if (user != null && (user.logInType == 2 || user.logInType == 3)) {
this.checkActivationCode();
} else {
var request = this.getCommonRequest(type: type);
this.getMobileInfo(request);
}
// if (user != null && (user.logInType == 2 || user.logInType == 3)) {
// this.checkActivationCode();
// } else {
var request = this.getCommonRequest(type: type);
this.getMobileInfo(request);
//}
}
}
}
@ -418,13 +420,18 @@ class _ConfirmLogin extends State<ConfirmLogin> {
this.authService.getLoginInfo(request).then((result) {
GifLoaderDialogUtils.hideDialog(context);
if (result['SMSLoginRequired'] == false) {
this.loginTokenID = result.logInTokenID;
this.patientOutSA = result.patientOutSA;
this.loginTokenID = result['LogInTokenID'];
this.patientOutSA = result['PatientOutSA'];
// sms for register the biometric
if (result.isSMSSent) {
this.onlySMSBox = false;
if (result['isSMSSent']) {
setState(() {
isMoreOption = true;
this.onlySMSBox = true;
// this.fingrePrintBefore = true;
});
//this.button();
} else {
setDefault();
checkActivationCode();
}
} else {
@ -505,7 +512,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
}
checkActivationCode({value}) async {
Navigator.pop(context);
// Navigator.pop(context);
GifLoaderDialogUtils.showMyDialog(context);
var request = this.getCommonRequest().toJson();
@ -587,12 +594,13 @@ class _ConfirmLogin extends State<ConfirmLogin> {
});
}
goToHome() {
goToHome() async {
authenticatedUserObject.isLogin = true;
appointmentRateViewModel.isLogin = true;
projectViewModel.isLogin = true;
projectViewModel.user = authenticatedUserObject.user;
Provider.of<ProjectViewModel>(context, listen: false).setUser(authenticatedUserObject.user);
await authenticatedUserObject.getUser(getUser: true);
getToDoCount();
// pharmacyModuleViewModel.generatePharmacyToken().then((value) async {
@ -603,7 +611,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
.getIsLastAppointmentRatedList()
.then((value) => {
getToDoCount(),
// GifLoaderDialogUtils.hideDialog(context),
GifLoaderDialogUtils.hideDialog(AppGlobal.context),
if (appointmentRateViewModel.isHaveAppointmentNotRate)
{
Navigator.pushAndRemoveUntil(

@ -24,29 +24,20 @@ enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED }
AppSharedPreferences sharedPref = new AppSharedPreferences();
AppGlobal appGlobal = new AppGlobal();
const String INSERT_DEVICE_IMEI =
'Services/Patients.svc/REST/Patient_INSERTDeviceIMEI';
const String SELECT_DEVICE_IMEI =
'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI';
const String CHECK_PATIENT_AUTH =
'Services/Authentication.svc/REST/CheckPatientAuthentication';
const String INSERT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_INSERTDeviceIMEI';
const String SELECT_DEVICE_IMEI = 'Services/Patients.svc/REST/Patient_SELECTDeviceIMEIbyIMEI';
const String CHECK_PATIENT_AUTH = 'Services/Authentication.svc/REST/CheckPatientAuthentication';
const GET_MOBILE_INFO = 'Services/Authentication.svc/REST/GetMobileLoginInfo';
const SEND_ACTIVATION_CODE =
'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationType';
const CHECK_ACTIVATION_CODE =
'Services/Authentication.svc/REST/CheckActivationCode';
const FORGOT_PASSWORD =
'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo';
const CHECK_PATIENT_FOR_REGISTRATION =
"Services/Authentication.svc/REST/CheckPatientForRegisteration";
const SEND_ACTIVATION_CODE = 'Services/Authentication.svc/REST/SendActivationCodebyOTPNotificationType';
const CHECK_ACTIVATION_CODE = 'Services/Authentication.svc/REST/CheckActivationCode';
const FORGOT_PASSWORD = 'Services/Authentication.svc/REST/CheckActivationCodeForSendFileNo';
const CHECK_PATIENT_FOR_REGISTRATION = "Services/Authentication.svc/REST/CheckPatientForRegisteration";
const CHECK_USER_STATUS = "Services/NHIC.svc/REST/GetPatientInfo";
const REGISTER_USER = 'Services/Authentication.svc/REST/PatientRegistration';
const LOGGED_IN_USER_URL =
'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo';
const LOGGED_IN_USER_URL = 'Services/MobileNotifications.svc/REST/Insert_PatientMobileDeviceInfo';
const FORGOT_PATIENT_ID =
'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber';
const FORGOT_PATIENT_ID = 'Services/Authentication.svc/REST/SendPatientIDSMSByMobileNumber';
const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard';
const PROFILE_SETTING = 'Services/Patients.svc/REST/GetPateintInfoForUpdate';
const SAVE_SETTING = 'Services/Patients.svc/REST/UpdatePateintInfo';
@ -55,8 +46,7 @@ class AuthProvider with ChangeNotifier {
bool isLogin = false;
bool isLoading = true;
dynamic authenticatedUser;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AuthProvider() {
getUserAuthentication();
@ -110,17 +100,14 @@ class AuthProvider with ChangeNotifier {
var lastLogin = lstLogin; //await sharedPref.getInt(
// LAST_LOGIN); //this.cs.sharedService.getStorage(AuthenticationService.LAST_LOGIN); //this.cs.sharedService.getSharedData(AuthenticationService.LAST_LOGIN, false);
var request =
AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
var request = AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE));
var newRequest = INSERTDeviceIMEIRequest();
var imei = await sharedPref.getString(PUSH_TOKEN);
// if (!request.) {
newRequest.iMEI = imei; //imei!=null ? imei : '';
newRequest.firstName =
request.firstName ?? "" + " " + request.lastName ?? "";
newRequest.firstNameN =
request.firstNameN ?? "" + " " + request.lastNameN ?? "";
newRequest.firstName = request.firstName ?? "" + " " + request.lastName ?? "";
newRequest.firstNameN = request.firstNameN ?? "" + " " + request.lastNameN ?? "";
newRequest.lastNameN = request.lastNameN ?? "";
newRequest.outSA = request.outSA == 1 ? true : false;
newRequest.biometricEnabled = false;
@ -135,8 +122,7 @@ class AuthProvider with ChangeNotifier {
newRequest.tokenID = await sharedPref.getString(TOKEN);
// }
await new BaseAppClient().post(INSERT_DEVICE_IMEI,
onSuccess: (dynamic response, int statusCode) {
await new BaseAppClient().post(INSERT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
@ -153,10 +139,8 @@ class AuthProvider with ChangeNotifier {
dynamic localRes;
Map<String, dynamic> request = {};
request['IMEI'] = imei;
await new BaseAppClient().post(SELECT_DEVICE_IMEI,
onSuccess: (dynamic response, int statusCode) {
localRes = SelectDeviceIMEIRES.fromJson(
response['Patient_SELECTDeviceIMEIbyIMEIList'][0]);
await new BaseAppClient().post(SELECT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) {
localRes = SelectDeviceIMEIRES.fromJson(response['Patient_SELECTDeviceIMEIbyIMEIList'][0]);
}, onFailure: (String error, int statusCode) {
throw error;
}, body: request);
@ -166,8 +150,7 @@ class AuthProvider with ChangeNotifier {
}
}
Future<dynamic> checkPatientAuthentication(
CheckPatientAuthenticationReq request) async {
Future<dynamic> checkPatientAuthentication(CheckPatientAuthenticationReq request) async {
request.versionID = VERSION_ID;
request.channel = CHANNEL;
request.iPAdress = IP_ADDRESS;
@ -176,8 +159,7 @@ class AuthProvider with ChangeNotifier {
request.patientOutSA = request.zipCode == '966' ? 0 : 1;
try {
dynamic localRes;
await new BaseAppClient().post(CHECK_PATIENT_AUTH,
onSuccess: (dynamic response, int statusCode) {
await new BaseAppClient().post(CHECK_PATIENT_AUTH, onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
@ -198,10 +180,10 @@ class AuthProvider with ChangeNotifier {
request.deviceTypeID = DeviceTypeID;
request.patientOutSA = request.zipCode == '966' ? 0 : 1;
request.isDentalAllowedBackend = false;
// request.patientTypeID = request.patientType;
// request.patientType = request.patientType;
dynamic localRes;
await new BaseAppClient().post(GET_MOBILE_INFO,
onSuccess: (dynamic response, int statusCode) {
await new BaseAppClient().post(GET_MOBILE_INFO, onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
@ -220,8 +202,7 @@ class AuthProvider with ChangeNotifier {
request.isDentalAllowedBackend = false;
dynamic localRes;
await new BaseAppClient().post(SEND_ACTIVATION_CODE,
onSuccess: (dynamic response, int statusCode) {
await new BaseAppClient().post(SEND_ACTIVATION_CODE, onSuccess: (dynamic response, int statusCode) {
localRes = response;
authenticatedUser = CheckActivationCode.fromJson(localRes);
}, onFailure: (String error, int statusCode) {
@ -243,14 +224,12 @@ class AuthProvider with ChangeNotifier {
neRequest.patientOutSA = neRequest.zipCode == '966' ? 0 : 1;
neRequest.projectOutSA = neRequest.zipCode == '966' ? false : true;
neRequest.isDentalAllowedBackend = false;
neRequest.deviceToken = null;
neRequest.forRegisteration =
neRequest.isRegister != null ? neRequest.isRegister : false;
// neRequest.deviceToken = null;
neRequest.forRegisteration = neRequest.isRegister != null ? neRequest.isRegister : false;
neRequest.isRegister = false;
dynamic localRes;
try {
await new BaseAppClient().post(CHECK_ACTIVATION_CODE,
onSuccess: (dynamic response, int statusCode) {
await new BaseAppClient().post(CHECK_ACTIVATION_CODE, onSuccess: (dynamic response, int statusCode) {
localRes = response; //CheckActivationCode.fromJson();
}, onFailure: (String error, int statusCode) {
localRes = error;
@ -270,8 +249,7 @@ class AuthProvider with ChangeNotifier {
return authenticatedUser;
}
Future<dynamic> checkPatientForRegisteration(
CheckPatientForRegistration request) async {
Future<dynamic> checkPatientForRegisteration(CheckPatientForRegistration request) async {
request.versionID = VERSION_ID;
request.channel = CHANNEL;
request.iPAdress = IP_ADDRESS;
@ -282,8 +260,7 @@ class AuthProvider with ChangeNotifier {
// request.tokenID = '';
dynamic localRes;
try {
await new BaseAppClient().post(CHECK_PATIENT_FOR_REGISTRATION,
onSuccess: (dynamic response, int statusCode) {
await new BaseAppClient().post(CHECK_PATIENT_FOR_REGISTRATION, onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
localRes = error;
@ -306,8 +283,7 @@ class AuthProvider with ChangeNotifier {
// request.tokenID = '';
dynamic localRes;
try {
await new BaseAppClient().post(CHECK_USER_STATUS,
onSuccess: (dynamic response, int statusCode) {
await new BaseAppClient().post(CHECK_USER_STATUS, onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
localRes = error;
@ -332,8 +308,7 @@ class AuthProvider with ChangeNotifier {
// request.tokenID = '';
dynamic localRes;
try {
await new BaseAppClient().post(REGISTER_USER,
onSuccess: (dynamic response, int statusCode) {
await new BaseAppClient().post(REGISTER_USER, onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
localRes = error;
@ -345,30 +320,26 @@ class AuthProvider with ChangeNotifier {
}
}
Future registeredAuthenticatedUser(
AuthenticatedUser user, deviceToken, lat, long) async {
Future registeredAuthenticatedUser(AuthenticatedUser user, deviceToken, lat, long) async {
var request = new RegisteredAuthenticatedUserRequest();
request.deviceToken = deviceToken;
request.voipToken =
""; //this.cs.sharedService.getSharedData(AuthenticationService.APNS_TOKEN, false);
request.voipToken = ""; //this.cs.sharedService.getSharedData(AuthenticationService.APNS_TOKEN, false);
request.deviceType = DeviceTypeID.toString();
request.patientMobileNumber = '0' + user.mobileNumber;
request.patientMobileNumber = user.mobileNumber[0] == '0' ? user.mobileNumber : '0' + user.mobileNumber;
request.nationalID = user.patientIdentificationNo;
request.gender = user.gender;
request.patientID = user.patientID;
request.patientOutSA = user.outSA;
request.loginType = await sharedPref.getInt(LAST_LOGIN) != null
? await sharedPref.getInt(LAST_LOGIN)
: 1;
request.loginType = await sharedPref.getInt(LAST_LOGIN) != null ? await sharedPref.getInt(LAST_LOGIN) : 1;
request.mACAddress = '00:00:00:00:00:00';
request.latitude = lat;
request.longitude = long;
request.languageID = int.parse(user.preferredLanguage);
request.patientTypeID = 2;
request.patientTypeID = user.patientType;
request.patientType = user.patientType;
dynamic localRes;
try {
await new BaseAppClient().post(LOGGED_IN_USER_URL,
onSuccess: (dynamic response, int statusCode) {
await new BaseAppClient().post(LOGGED_IN_USER_URL, onSuccess: (dynamic response, int statusCode) {
localRes = response;
}, onFailure: (String error, int statusCode) {
localRes = error;
@ -394,8 +365,7 @@ class AuthProvider with ChangeNotifier {
dynamic localRes;
await new BaseAppClient().post(FORGOT_PATIENT_ID,
onSuccess: (response, statusCode) async {
await new BaseAppClient().post(FORGOT_PATIENT_ID, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
throw error;
@ -416,8 +386,7 @@ class AuthProvider with ChangeNotifier {
dynamic localRes;
try {
await new BaseAppClient().post(FORGOT_PASSWORD,
onSuccess: (dynamic response, int statusCode) {
await new BaseAppClient().post(FORGOT_PASSWORD, onSuccess: (dynamic response, int statusCode) {
localRes = response; //CheckActivationCode.fromJson();
}, onFailure: (String error, int statusCode) {
localRes = error;
@ -439,12 +408,10 @@ class AuthProvider with ChangeNotifier {
request['generalid'] = GENERAL_ID;
request['LanguageID'] = LANGUAGE_ID;
request['DeviceTypeID'] = DeviceTypeID;
request["PatientTypeID"] = 1;
request["PatientType"] = 1;
dynamic localRes;
try {
await new BaseAppClient().post(DASHBOARD,
onSuccess: (dynamic response, int statusCode) {
await new BaseAppClient().post(DASHBOARD, onSuccess: (dynamic response, int statusCode) {
localRes = response; //CheckActivationCode.fromJson();
}, onFailure: (String error, int statusCode) {
localRes = error;
@ -461,8 +428,7 @@ class AuthProvider with ChangeNotifier {
getSettings() async {
dynamic localRes;
try {
await new BaseAppClient().post(PROFILE_SETTING,
onSuccess: (dynamic response, int statusCode) {
await new BaseAppClient().post(PROFILE_SETTING, onSuccess: (dynamic response, int statusCode) {
localRes = response; //CheckActivationCode.fromJson();
}, onFailure: (String error, int statusCode) {
localRes = error;
@ -479,8 +445,7 @@ class AuthProvider with ChangeNotifier {
Future saveSettings(request) async {
dynamic localRes;
try {
await new BaseAppClient().post(SAVE_SETTING,
onSuccess: (dynamic response, int statusCode) {
await new BaseAppClient().post(SAVE_SETTING, onSuccess: (dynamic response, int statusCode) {
localRes = response; //CheckActivationCode.fromJson();
}, onFailure: (String error, int statusCode) {
localRes = error;

Loading…
Cancel
Save