Merge branch 'sultan' into 'development'

Sultan

See merge request Cloud_Solution/doctor_app_flutter!258
merge-requests/259/merge
Mohammad Aljammal 4 years ago
commit 588d98f8ed

@ -12,3 +12,4 @@ final LOGGED_IN_USER = 'loggedUser';
final DASHBOARD_DATA = 'dashboard-data';
final OTP_TYPE = 'otp-type';
final LAST_LOGIN_USER = 'last-login-user';
final PASSWORD = 'password';

@ -4,30 +4,30 @@ class GetIMEIDetailsModel {
int logInTypeID;
bool outSA;
String mobile;
Null identificationNo;
dynamic identificationNo;
int doctorID;
String doctorName;
String doctorNameN;
int clinicID;
String clinicDescription;
Null clinicDescriptionN;
dynamic clinicDescriptionN;
int projectID;
String projectName;
String genderDescription;
Null genderDescriptionN;
dynamic genderDescriptionN;
String titleDescription;
Null titleDescriptionN;
Null zipCode;
dynamic titleDescriptionN;
dynamic zipCode;
String createdOn;
Null createdBy;
dynamic createdBy;
String editedOn;
int editedBy;
dynamic editedBy;
bool biometricEnabled;
Null preferredLanguage;
dynamic preferredLanguage;
bool isActive;
String vidaAuthTokenID;
String vidaRefreshTokenID;
String password;
GetIMEIDetailsModel(
{this.iD,
this.iMEI,
@ -56,7 +56,8 @@ class GetIMEIDetailsModel {
this.preferredLanguage,
this.isActive,
this.vidaAuthTokenID,
this.vidaRefreshTokenID});
this.vidaRefreshTokenID,
this.password});
GetIMEIDetailsModel.fromJson(Map<String, dynamic> json) {
iD = json['ID'];
@ -87,6 +88,7 @@ class GetIMEIDetailsModel {
isActive = json['IsActive'];
vidaAuthTokenID = json['VidaAuthTokenID'];
vidaRefreshTokenID = json['VidaRefreshTokenID'];
password = json['Password'];
}
Map<String, dynamic> toJson() {
@ -119,6 +121,7 @@ class GetIMEIDetailsModel {
data['IsActive'] = this.isActive;
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['VidaRefreshTokenID'] = this.vidaRefreshTokenID;
data['Password'] = this.password;
return data;
}
}

@ -1,9 +1,9 @@
class InsertIMEIDetailsModel {
String iMEI;
int logInTypeID;
Null outSA;
Null mobile;
Null identificationNo;
dynamic outSA;
String mobile;
dynamic identificationNo;
int doctorID;
String doctorName;
String doctorNameN;
@ -31,7 +31,7 @@ class InsertIMEIDetailsModel {
int patientOutSA;
String vidaAuthTokenID;
String vidaRefreshTokenID;
dynamic password;
InsertIMEIDetailsModel(
{this.iMEI,
this.logInTypeID,
@ -64,13 +64,14 @@ class InsertIMEIDetailsModel {
this.isLoginForDoctorApp,
this.patientOutSA,
this.vidaAuthTokenID,
this.vidaRefreshTokenID});
this.vidaRefreshTokenID,
this.password});
InsertIMEIDetailsModel.fromJson(Map<String, dynamic> json) {
iMEI = json['IMEI'];
logInTypeID = json['LogInTypeID'];
outSA = json['OutSA'];
mobile = json['Mobile'];
mobile = json['MobileNo'];
identificationNo = json['IdentificationNo'];
doctorID = json['DoctorID'];
doctorName = json['DoctorName'];
@ -99,6 +100,7 @@ class InsertIMEIDetailsModel {
patientOutSA = json['PatientOutSA'];
vidaAuthTokenID = json['VidaAuthTokenID'];
vidaRefreshTokenID = json['VidaRefreshTokenID'];
password = json['Password'];
}
Map<String, dynamic> toJson() {
@ -106,7 +108,7 @@ class InsertIMEIDetailsModel {
data['IMEI'] = this.iMEI;
data['LogInTypeID'] = this.logInTypeID;
data['OutSA'] = this.outSA;
data['Mobile'] = this.mobile;
data['MobileNo'] = this.mobile;
data['IdentificationNo'] = this.identificationNo;
data['DoctorID'] = this.doctorID;
data['DoctorName'] = this.doctorName;
@ -135,6 +137,7 @@ class InsertIMEIDetailsModel {
data['PatientOutSA'] = this.patientOutSA;
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['VidaRefreshTokenID'] = this.vidaRefreshTokenID;
data['Password'] = this.password;
return data;
}
}

@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/core/model/search_drug_request_model.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart';
class PrescriptionService extends BaseService {
@ -93,9 +94,24 @@ class PrescriptionService extends BaseService {
}
Future getDrugToDrug(
VitalSignData vital, List<GetAllergiesResModel> allergy) async {
VitalSignData vital,
List<MasterKeyModel> diagnosis,
List<GetAllergiesResModel> allergy,
PatiantInformtion patient,
List<PrescriptionModel> prescription) async {
Map<String, dynamic> request = {
"Prescription": {
"objPatientInfo": {"Gender": patient.gender, "Age": patient.age},
"objVitalSign": {"Height": vital.heightCm, "Weight": vital.weightKg},
"objPrescriptionItems": prescription[0].entityList,
"objAllergies": allergy,
"objDiagnosis": diagnosis,
"IsDoctor": "false",
"IsPharmacist": "false"
}
};
hasError = false;
var request = {};
await baseAppClient.post(DRUG_TO_DRUG,
onSuccess: (dynamic response, int statusCode) {
drugToDrug = [];
@ -103,6 +119,6 @@ class PrescriptionService extends BaseService {
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: _drugRequestModel.toJson());
}, body: request);
}
}

@ -81,11 +81,15 @@ class AuthViewModel extends BaseViewModel {
Future insertDeviceImei(request) async {
var loggedIn = await sharedPref.getObj(LOGGED_IN_USER);
var user = await sharedPref.getObj(LAST_LOGIN_USER);
if (user != null) {
user = GetIMEIDetailsModel.fromJson(user);
}
request['IMEI'] = DEVICE_TOKEN;
request['LogInTypeID'] = await sharedPref.getInt(OTP_TYPE);
request['BioMetricEnabled'] = true;
request['MobileNo'] = loggedIn['MobileNumber'];
request['MobileNo'] =
loggedIn != null ? loggedIn['MobileNumber'] : user.mobile;
InsertIMEIDetailsModel nRequest = InsertIMEIDetailsModel.fromJson(request);
nRequest.genderDescription = request['Gender_Description'];
nRequest.genderDescriptionN = request['Gender_DescriptionN'];
@ -93,9 +97,14 @@ class AuthViewModel extends BaseViewModel {
nRequest.titleDescription = request['Title_Description'];
nRequest.titleDescriptionN = request['Title_DescriptionN'];
nRequest.projectID = await sharedPref.getInt(PROJECT_ID);
nRequest.doctorID = loggedIn != null
? loggedIn['List_MemberInformation'][0]['MemberID']
: user.doctorID;
nRequest.outSA = loggedIn != null ? loggedIn['PatientOutSA'] : user.outSA;
nRequest.vidaAuthTokenID = await sharedPref.getString(VIDA_AUTH_TOKEN_ID);
nRequest.vidaRefreshTokenID =
await sharedPref.getString(VIDA_REFRESH_TOKEN_ID);
nRequest.password = await sharedPref.getString(PASSWORD);
try {
var localRes;
await baseAppClient.post(INSERT_DEVICE_IMEI,

@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart';
class PrescriptionViewModel extends BaseViewModel {
@ -72,10 +73,15 @@ class PrescriptionViewModel extends BaseViewModel {
}
Future getDrugToDrug(
VitalSignData vital, List<GetAllergiesResModel> allergy) async {
VitalSignData vital,
List<MasterKeyModel> listOfDiagnosisType,
List<GetAllergiesResModel> allergy,
PatiantInformtion patient,
List<PrescriptionModel> prescription) async {
hasError = false;
setState(ViewState.Busy);
await _prescriptionService.getDrugToDrug(vital, allergy);
await _prescriptionService.getDrugToDrug(
vital, listOfDiagnosisType, allergy, patient, prescription);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);

@ -11,7 +11,7 @@ class ActivationCodeModel2 {
int isMobileFingerPrint;
String vidaAuthTokenID;
String vidaRefreshTokenID;
String iMEI;
ActivationCodeModel2(
{this.oTPSendType,
this.mobileNumber,
@ -24,7 +24,8 @@ class ActivationCodeModel2 {
this.generalid,
this.isMobileFingerPrint,
this.vidaAuthTokenID,
this.vidaRefreshTokenID});
this.vidaRefreshTokenID,
this.iMEI});
ActivationCodeModel2.fromJson(Map<String, dynamic> json) {
oTPSendType = json['OTP_SendType'];
@ -39,6 +40,7 @@ class ActivationCodeModel2 {
isMobileFingerPrint = json['IsMobileFingerPrint'];
vidaAuthTokenID = json['VidaAuthTokenID'];
vidaRefreshTokenID = json['VidaRefreshTokenID'];
iMEI = json['IMEI'];
}
Map<String, dynamic> toJson() {
@ -55,6 +57,7 @@ class ActivationCodeModel2 {
data['IsMobileFingerPrint'] = this.isMobileFingerPrint;
data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['VidaRefreshTokenID'] = this.vidaRefreshTokenID;
data['IMEI'] = this.iMEI;
return data;
}
}

@ -70,7 +70,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
DEVICE_TOKEN = token;
var request = await sharedPref.getObj(DOCTOR_PROFILE);
authProvider.insertDeviceImei(request).then((value) {
print(value['ReturnValue']);
print(value);
changeIsLoading(false);
});
}

@ -3,6 +3,7 @@ import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/model/Prescription_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/models/livecare/transfer_to_admin.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
@ -25,13 +26,13 @@ import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:intl/intl.dart';
addPrescriptionForm(
context, PrescriptionViewModel model, PatiantInformtion patient) {
addPrescriptionForm(context, PrescriptionViewModel model,
PatiantInformtion patient, prescription) {
showModalBottomSheet(
isScrollControlled: true,
context: context,
builder: (BuildContext bc) {
return PrescriptionFormWidget(model, patient);
return PrescriptionFormWidget(model, patient, prescription);
});
}
@ -85,7 +86,8 @@ postProcedure(
class PrescriptionFormWidget extends StatefulWidget {
final PrescriptionViewModel model;
PatiantInformtion patient;
PrescriptionFormWidget(this.model, this.patient);
List<PrescriptionModel> prescriptionList;
PrescriptionFormWidget(this.model, this.patient, this.prescriptionList);
@override
_PrescriptionFormWidgetState createState() => _PrescriptionFormWidgetState();
@ -308,7 +310,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
ListSelectDialog dialog =
ListSelectDialog(
list: model.drugsList,
attributeName: 'Description',
attributeName: 'GenericName',
attributeValueId: 'ItemId',
okText:
TranslationBase.of(context)
@ -713,8 +715,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
.addMedication,
onPressed: () {
formKey.currentState.save();
// Navigator.pop(context);
// openDrugToDrug();
Navigator.pop(context);
openDrugToDrug();
if (strength == null ||
route == null ||
frequency == null ||
@ -819,9 +821,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
DrugToDrug(widget.patient),
DrugToDrug(widget.patient, widget.prescriptionList),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2),
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 3),
child: AppButton(
title: TranslationBase.of(context).addMedication,
onPressed: () {

@ -1,5 +1,8 @@
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/prescription_model.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-vital-sign-viewmodel.dart';
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
@ -16,13 +19,15 @@ import 'package:flutter/material.dart';
class DrugToDrug extends StatefulWidget {
final PatiantInformtion patient;
DrugToDrug(this.patient);
final prescription;
DrugToDrug(this.patient, this.prescription);
@override
_DrugToDrug createState() => _DrugToDrug();
}
class _DrugToDrug extends State<DrugToDrug> {
int typeID = 1;
bool isLoaded = false;
List<Map<dynamic, dynamic>> expandableList = [
{'name': 'CRITICAL'},
{'name': 'HIGH'},
@ -30,54 +35,59 @@ class _DrugToDrug extends State<DrugToDrug> {
{'name': 'LOW'},
{'name': 'INFO'},
];
GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP(
patientMRN: 2954208, //widget.patient.patientMRN,
episodeId: 210011002, //widget.patient.episodeNo,
appointmentNo: 2016055308, //widget.patient.appointmentNo,
doctorID: '',
editedBy: '');
VitalSignsViewModel model = new VitalSignsViewModel();
SOAPViewModel model2 = new SOAPViewModel();
@override
void initState() {
getTypeID();
getRequestedData();
super.initState();
}
@override
Widget build(BuildContext context) {
GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP(
patientMRN: 2954208, //widget.patient.patientMRN,
episodeId: 210011002, //widget.patient.episodeNo,
appointmentNo: 2016055308, //widget.patient.appointmentNo,
doctorID: '',
editedBy: '');
return BaseView<VitalSignsViewModel>(
onModelReady: (model) => model.getPatientVitalSign(widget.patient),
builder: (BuildContext context, model, Widget child) {
return BaseView<SOAPViewModel>(
onModelReady: (model2) =>
model2.getPatientAllergy(generalGetReqForSOAP),
builder: (BuildContext context, model2, Widget child) {
return BaseView<PrescriptionViewModel>(
onModelReady: (model3) => model3.getDrugToDrug(
model.patientVitalSigns, model2.patientAllergiesList),
builder: (BuildContext context,
PrescriptionViewModel model3, Widget child) =>
NetworkBaseView(
baseViewModel: model3,
child: Container(
height: SizeConfig.realScreenHeight * .45,
child: new ListView.builder(
itemCount: expandableList.length,
itemBuilder: (context, i) {
return new ExpansionTile(
title: new Text(
expandableList[i]['name'],
style: new TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
fontStyle: FontStyle.italic),
),
children: <Widget>[Text('Hi')],
);
}))));
});
});
return isLoaded == true
? BaseView<PrescriptionViewModel>(
onModelReady: (model3) => model3.getDrugToDrug(
model.patientVitalSigns,
model2.listOfDiagnosisType,
model2.patientAllergiesList,
widget.patient,
widget.prescription),
builder: (BuildContext context, PrescriptionViewModel model3,
Widget child) =>
NetworkBaseView(
baseViewModel: model3,
child: Container(
height: SizeConfig.realScreenHeight * .4,
child: new ListView.builder(
itemCount: expandableList.length,
itemBuilder: (context, i) {
return new ExpansionTile(
title: new Text(
expandableList[i]['name'],
style: new TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
fontStyle: FontStyle.italic),
),
children: <Widget>[Text('Hi')],
);
}))))
: Container(
height: SizeConfig.realScreenHeight * .45,
child: Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Colors.black),
)));
}
getTypeID() async {
@ -86,4 +96,15 @@ class _DrugToDrug extends State<DrugToDrug> {
typeID = type;
});
}
getRequestedData() async {
await model.getPatientVitalSign(widget.patient);
await model2.getPatientAllergy(generalGetReqForSOAP);
await model2.getMasterLookup(MasterKeysService.DiagnosisType);
if (model.state == ViewState.Idle && model2.state == ViewState.Idle) {
setState(() {
isLoaded = true;
});
}
}
}

@ -128,7 +128,10 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
InkWell(
onTap: () {
addPrescriptionForm(
context, model, patient);
context,
model,
patient,
model.prescriptionList);
//model.postPrescription();
},
child: CircleAvatar(
@ -219,7 +222,10 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
),
onTap: () {
addPrescriptionForm(
context, model, patient);
context,
model,
patient,
model.prescriptionList);
//model.postPrescription();
},
),
@ -516,8 +522,8 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
children: [
InkWell(
onTap: () {
addPrescriptionForm(
context, model, patient);
addPrescriptionForm(context, model,
patient, model.prescriptionList);
//model.postPrescription();
},
child: CircleAvatar(

@ -63,6 +63,10 @@ class _VerificationMethodsState extends State<VerificationMethods> {
bool authenticated;
var fingrePrintBefore;
var selectedOption;
@override
void initState() {
super.initState();
@ -105,7 +109,9 @@ class _VerificationMethodsState extends State<VerificationMethods> {
helpers.showErrorToast('Error: ${snapshot.error}');
return Text('Error: ${snapshot.error}');
} else {
return Container(
return SingleChildScrollView(
child: Container(
height: SizeConfig.realScreenHeight,
width: SizeConfig.realScreenWidth,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -155,18 +161,17 @@ class _VerificationMethodsState extends State<VerificationMethods> {
TextOverflow.ellipsis,
),
subtitle: Text(
// user. != null
// ? formatDate(Helpers
// .convertStringToDate(
// user
// .))
// : user !=
// null
// ? formatDate(Helpers
// .convertStringToDate(user
// .createdOn))
//:
'--',
user.editedOn != null
? formatDate(Helpers
.convertStringToDate(
user
.editedOn))
: user.createdOn !=
null
? formatDate(Helpers
.convertStringToDate(user
.createdOn))
: '--',
overflow:
TextOverflow.ellipsis,
textAlign:
@ -263,7 +268,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
3, authProv)),
Expanded(
child: getButton(
2, authProv))
4, authProv))
],
)
: SizedBox(),
@ -275,7 +280,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
child:
getButton(1, authProv)),
Expanded(
child: getButton(4, authProv))
child: getButton(2, authProv))
],
),
]),
@ -307,7 +312,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
))
],
),
);
));
}
}
});
@ -342,14 +347,13 @@ class _VerificationMethodsState extends State<VerificationMethods> {
authProv
.sendActivationCodeForDoctorApp(activationCodeModel)
.then((res) {
widget.changeLoadingStata(false);
if (res['MessageStatus'] == 1) {
print("VerificationCode : " + res["VerificationCode"]);
sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]);
sharedPref.setString(
VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]);
sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]);
sharedPref.setString(PASSWORD, widget.password);
this.startSMSService(oTPSendType, authProv);
} else {
print(res['ErrorEndUserMessage']);
@ -380,55 +384,50 @@ class _VerificationMethodsState extends State<VerificationMethods> {
sendActivationCodeVerificationScreen(
oTPSendType, AuthViewModel authProv) async {
// TODO : build enum for verfication method
if (oTPSendType == 1 || oTPSendType == 2) {
widget.changeLoadingStata(true);
ActivationCodeModel2 activationCodeModel = ActivationCodeModel2(
facilityId: user.projectID,
memberID: user.doctorID,
zipCode: user.outSA == true ? '971' : '966',
mobileNumber: user.mobile,
oTPSendType: oTPSendType,
isMobileFingerPrint: 1,
vidaAuthTokenID: user.vidaAuthTokenID,
vidaRefreshTokenID: user.vidaRefreshTokenID);
//if (oTPSendType == 1 || oTPSendType == 2) {
widget.changeLoadingStata(true);
ActivationCodeModel2 activationCodeModel = ActivationCodeModel2(
iMEI: user.iMEI,
facilityId: user.projectID,
memberID: user.doctorID,
zipCode: user.outSA == true ? '971' : '966',
mobileNumber: user.mobile,
oTPSendType: oTPSendType,
isMobileFingerPrint: 1,
vidaAuthTokenID: user.vidaAuthTokenID,
vidaRefreshTokenID: user.vidaRefreshTokenID);
try {
authProv
.sendActivationCodeVerificationScreen(activationCodeModel)
.then((res) {
widget.changeLoadingStata(false);
if (res['MessageStatus'] == 1) {
print("VerificationCode : " + res["VerificationCode"]);
sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]);
sharedPref.setString(
VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]);
sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]);
try {
authProv
.sendActivationCodeVerificationScreen(activationCodeModel)
.then((res) {
if (res['MessageStatus'] == 1) {
print("VerificationCode : " + res["VerificationCode"]);
sharedPref.setString(VIDA_AUTH_TOKEN_ID, res["VidaAuthTokenID"]);
sharedPref.setString(
VIDA_REFRESH_TOKEN_ID, res["VidaRefreshTokenID"]);
sharedPref.setString(LOGIN_TOKEN_ID, res["LogInTokenID"]);
if (oTPSendType == 1 || oTPSendType == 2) {
widget.changeLoadingStata(false);
this.startSMSService(oTPSendType, authProv);
} else {
print(res['ErrorEndUserMessage']);
helpers.showErrorToast(res['ErrorEndUserMessage']);
checkActivationCode(authProv);
}
}).catchError((err) {
print('$err');
widget.changeLoadingStata(false);
helpers.showErrorToast();
});
} catch (e) {}
} else {
// TODO route to this page with parameters to inicate we should present 2 option
if (Platform.isAndroid && oTPSendType == 3) {
helpers.showErrorToast('Your device not support this feature');
} else {
// Navigator.of(context).push(MaterialPageRoute(
// builder: (BuildContext context) =>
// VerificationMethodsScreen(password: widget.password,)));
} else {
print(res['ErrorEndUserMessage']);
helpers.showErrorToast(res['ErrorEndUserMessage']);
}
}).catchError((err) {
print('$err');
widget.changeLoadingStata(false);
// Navigator.of(context).pushNamed(VERIFICATION_METHODS,
// arguments: {'verificationMethod': oTPSendType});
}
}
helpers.showErrorToast();
});
} catch (e) {}
// }
// else {
// checkActivationCode(authProv);
// }
}
Widget getButton(flag, authProv) {
@ -635,10 +634,10 @@ class _VerificationMethodsState extends State<VerificationMethods> {
authenticateUser(type, isActive, authProv) {
//GifLoaderDialogUtils.showMyDialog(context);
// if (type == 2 || type == 3) {
// fingrePrintBefore = type;
// }
//this.selectedOption = fingrePrintBefore != null ? fingrePrintBefore : type;
if (type == 3 || type == 4) {
fingrePrintBefore = type;
}
this.selectedOption = fingrePrintBefore != null ? fingrePrintBefore : type;
switch (type) {
case 1:
@ -657,55 +656,14 @@ class _VerificationMethodsState extends State<VerificationMethods> {
default:
break;
}
// sharedPref.setInt(LAST_LOGIN,
// this.selectedOption); //this.cs.sharedService.setStorage(this.selectedOption, AuthenticationService.LAST_LOGIN);
sharedPref.setInt(OTP_TYPE, selectedOption);
// sharedPref.setInt(LAST_LOGIN),
}
loginWithSMS(type, isActive, authProv) {
this.sendActivationCode(type, authProv);
// //if (!el.disabled) {
// if (this.user != null) {
// this.checkUserAuthentication(type);
// } else {
// // if (this.loginTokenID != null) {
// this.sendActivationCode(type, authProv);
// // } else {
// //this.checkUserAuthentication(type);
// // }
// }
}
// checkUserAuthentication(type) {
// // showLoader(true);
// // var req = getCommonRequest(type: type);
// // req.logInTokenID = "";
// // var request = CheckPatientAuthenticationReq.fromJson(req.toJson());
// // sharedPref.setObject(REGISTER_DATA_FOR_REGISTER, request);
// // authService
// // .checkPatientAuthentication(request)
// // .then((value) => {
// // GifLoaderDialogUtils.hideDialog(context),
// // if (value['isSMSSent'])
// // {
// // sharedPref.setString(LOGIN_TOKEN_ID, value['LogInTokenID']),
// // this.loginTokenID = value['LogInTokenID'],
// // sharedPref.setObject(REGISTER_DATA_FOR_LOGIIN, request),
// // // Future.delayed(Duration(seconds: 1), () {
// // this.sendActivationCode(type)
// // // })
// // }
// // else
// // {
// // if (value['IsAuthenticated']) {this.checkActivationCode()}
// // }
// // })
// // .catchError((err) {
// // print(err);
// // GifLoaderDialogUtils.hideDialog(context);
// // });
// }
Future<void> _getAvailableBiometrics() async {
var availableBiometrics;
try {
@ -729,11 +687,10 @@ class _VerificationMethodsState extends State<VerificationMethods> {
}
startSMSService(type, authProv) {
sharedPref.setInt(OTP_TYPE, type);
new SMSOTP(
context,
type,
_loggedUser['MobileNumber'],
_loggedUser != null ? _loggedUser['MobileNumber'] : user.mobile,
(value) {
showDialog(
context: context,
@ -746,7 +703,7 @@ class _VerificationMethodsState extends State<VerificationMethods> {
this.checkActivationCode(authProv, value: value);
},
() => {
Navigator.pop(context),
//Navigator.pop(context),
print('Faild..'),
},
).displayDialog(context);
@ -759,31 +716,29 @@ class _VerificationMethodsState extends State<VerificationMethods> {
localizedReason: 'Scan your fingerprint to authenticate',
useErrorDialogs: true,
stickyAuth: true);
if (user.logInTypeID == 1 || user.logInTypeID == 2) {
this.onlySMSBox = true;
if (user != null && (user.logInTypeID == 3 || user.logInTypeID == 4)) {
this.sendActivationCode(type, authProv);
// this.checkActivationCode(authProv);
} else {
this.checkActivationCode(authProv);
setState(() {
this.onlySMSBox = true;
});
}
// if (authenticated == true) {
// if (user != null && (user.logInTypeID == 4 || user.logInTypeID == 3)) {
// //this.checkActivationCode();
// } else {
// // var request = this.getCommonRequest(type: type);
// // this.getMobileInfo(request);
// }
// }
}
}
checkActivationCode(AuthViewModel authProv, {value}) async {
CheckActivationCodeRequestModel checkActivationCodeForDoctorApp =
new CheckActivationCodeRequestModel(
zipCode: _loggedUser['ZipCode'],
mobileNumber: _loggedUser['MobileNumber'],
projectID: await sharedPref.getInt(PROJECT_ID),
zipCode:
_loggedUser != null ? _loggedUser['ZipCode'] : user.zipCode,
mobileNumber:
_loggedUser != null ? _loggedUser['MobileNumber'] : user.mobile,
projectID: await sharedPref.getInt(PROJECT_ID) != null
? await sharedPref.getInt(PROJECT_ID)
: user.projectID,
logInTokenID: await sharedPref.getString(LOGIN_TOKEN_ID),
activationCode: value,
activationCode: value ?? '0000',
oTPSendType: await sharedPref.getInt(OTP_TYPE),
generalid: "Cs2020@2016\$2958");

Loading…
Cancel
Save