|
|
|
|
@ -80,7 +80,7 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
String errorMsg = '';
|
|
|
|
|
final FocusNode myFocusNode = FocusNode();
|
|
|
|
|
var healthId;
|
|
|
|
|
int getDeviceLastLogin =1;
|
|
|
|
|
int getDeviceLastLogin = 1;
|
|
|
|
|
|
|
|
|
|
Future<void> onLoginPressed() async {
|
|
|
|
|
try {
|
|
|
|
|
@ -297,7 +297,6 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
phoneNumber: phoneNumberController.text,
|
|
|
|
|
nationalIdOrFileNumber: nationalIdController.text,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if (apiResponse.data['IsAuthenticated']) {
|
|
|
|
|
await checkActivationCode(
|
|
|
|
|
@ -305,7 +304,6 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
onWrongActivationCode: (String? message) {},
|
|
|
|
|
activationCode: null, //todo silent login case halded on the repo itself..
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -423,7 +421,6 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async {
|
|
|
|
|
final activation = CheckActivationCode.fromJson(apiResponse.data as Map<String, dynamic>);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (activation.errorCode == '699') {
|
|
|
|
|
// Todo: Hide Loader
|
|
|
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
@ -441,7 +438,6 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
// Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew));
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
if (activation.list != null && activation.list!.isNotEmpty) {
|
|
|
|
|
_appState.setAuthenticatedUser(activation.list!.first);
|
|
|
|
|
}
|
|
|
|
|
@ -451,7 +447,9 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
bool isUserAgreedBefore = await checkIfUserAgreedBefore(request: request);
|
|
|
|
|
|
|
|
|
|
//updating the last login type in app state to show the fingerprint/face id option on home screen
|
|
|
|
|
if (_appState.getSelectDeviceByImeiRespModelElement != null) {
|
|
|
|
|
_appState.getSelectDeviceByImeiRespModelElement!.logInType = loginTypeEnum.toInt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LoaderBottomSheet.hideLoader();
|
|
|
|
|
insertPatientIMEIData(loginTypeEnum.toInt);
|
|
|
|
|
@ -784,10 +782,8 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
log("Insert IMEI Failed");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getPatientDeviceData(int loginType) async {
|
|
|
|
|
final resultEither = await _authenticationRepo.getPatientDeviceData(
|
|
|
|
|
patientDeviceDataRequest: GetUserMobileDeviceData(
|
|
|
|
|
@ -795,22 +791,21 @@ class AuthenticationViewModel extends ChangeNotifier {
|
|
|
|
|
deviceTypeId: _appState.getDeviceTypeID(),
|
|
|
|
|
patientId: _appState.getSelectDeviceByImeiRespModelElement!.patientId!,
|
|
|
|
|
patientType: _appState.getSelectDeviceByImeiRespModelElement!.patientType,
|
|
|
|
|
patientOutSa:_appState.getSelectDeviceByImeiRespModelElement!.outSa == true ?1 :0,
|
|
|
|
|
patientOutSa: _appState.getSelectDeviceByImeiRespModelElement!.outSa == true ? 1 : 0,
|
|
|
|
|
loginType: loginType,
|
|
|
|
|
languageId: _appState.getLanguageID(),
|
|
|
|
|
latitude: _appState.userLat,
|
|
|
|
|
longitude: _appState.userLong,
|
|
|
|
|
mobileNo:_appState.getSelectDeviceByImeiRespModelElement!.mobile! ,
|
|
|
|
|
patientMobileNumber:int.parse(_appState.getSelectDeviceByImeiRespModelElement!.mobile!),
|
|
|
|
|
nationalId:_appState.getSelectDeviceByImeiRespModelElement!.identificationNo)
|
|
|
|
|
mobileNo: _appState.getSelectDeviceByImeiRespModelElement!.mobile!,
|
|
|
|
|
patientMobileNumber: int.parse(_appState.getSelectDeviceByImeiRespModelElement!.mobile!),
|
|
|
|
|
nationalId: _appState.getSelectDeviceByImeiRespModelElement!.identificationNo)
|
|
|
|
|
.toJson());
|
|
|
|
|
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async {
|
|
|
|
|
if (apiResponse.messageStatus == 1) {
|
|
|
|
|
dynamic deviceInfo= apiResponse.data['List_MobileLoginInfo'];
|
|
|
|
|
dynamic deviceInfo = apiResponse.data['List_MobileLoginInfo'];
|
|
|
|
|
getDeviceLastLogin = deviceInfo['LoginType'];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|