pull/29/head
aamir-csol 2 months ago
parent 335d51a04a
commit 0c58c22ea5

@ -726,7 +726,7 @@ const DEACTIVATE_ACCOUNT = 'Services/Patients.svc/REST/PatientAppleActivation_In
class ApiConsts { class ApiConsts {
static const maxSmallScreen = 660; static const maxSmallScreen = 660;
static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod; static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT

@ -297,12 +297,7 @@ class AuthenticationViewModel extends ChangeNotifier {
} else if (apiResponse.messageStatus == 1) { } else if (apiResponse.messageStatus == 1) {
if (apiResponse.data['isSMSSent']) { if (apiResponse.data['isSMSSent']) {
_appState.setAppAuthToken = apiResponse.data['LogInTokenID']; _appState.setAppAuthToken = apiResponse.data['LogInTokenID'];
await sendActivationCode( await sendActivationCode(otpTypeEnum: otpTypeEnum, phoneNumber: phoneNumberController.text, nationalIdOrFileNumber: nationalIdController.text, isForRegister: false);
otpTypeEnum: otpTypeEnum,
phoneNumber: phoneNumberController.text,
nationalIdOrFileNumber: nationalIdController.text,
);
} else { } else {
if (apiResponse.data['IsAuthenticated']) { if (apiResponse.data['IsAuthenticated']) {
await checkActivationCode( await checkActivationCode(
@ -310,7 +305,6 @@ class AuthenticationViewModel extends ChangeNotifier {
onWrongActivationCode: (String? message) {}, onWrongActivationCode: (String? message) {},
activationCode: null, //todo silent login case halded on the repo itself.. activationCode: null, //todo silent login case halded on the repo itself..
); );
} }
} }
} }
@ -318,18 +312,23 @@ class AuthenticationViewModel extends ChangeNotifier {
); );
} }
Future<void> sendActivationCode({required OTPTypeEnum otpTypeEnum, required String nationalIdOrFileNumber, required String phoneNumber, dynamic payload}) async { Future<void> sendActivationCode({required OTPTypeEnum otpTypeEnum, required String nationalIdOrFileNumber, required String phoneNumber, required bool isForRegister, dynamic payload}) async {
var request = RequestUtils.getCommonRequestSendActivationCode( var request = RequestUtils.getCommonRequestSendActivationCode(
otpTypeEnum: otpTypeEnum, otpTypeEnum: otpTypeEnum,
mobileNumber: phoneNumber, mobileNumber: phoneNumber,
selectedLoginType: otpTypeEnum.toInt(), selectedLoginType: otpTypeEnum.toInt(),
zipCode: selectedCountrySignup.countryCode, zipCode: selectedCountrySignup.countryCode,
nationalId: int.parse(nationalIdOrFileNumber), nationalId: int.parse(nationalIdOrFileNumber),
isFileNo: isPatientHasFile(request: payload), isFileNo: isForRegister ? isPatientHasFile(request: payload) : false,
patientId: 0, patientId: 0,
isForRegister: checkIsUserComingForRegister(request: payload), isForRegister: isForRegister,
patientOutSA: isPatientOutsideSA(request: payload), patientOutSA: isForRegister
payload: payload); ? isPatientOutsideSA(request: payload)
: selectedCountrySignup.countryCode == CountryEnum.saudiArabia
? false
: true,
payload: payload,
);
// TODO: GET APP SMS SIGNATURE HERE // TODO: GET APP SMS SIGNATURE HERE
request.sMSSignature = "enKTDcqbOVd"; request.sMSSignature = "enKTDcqbOVd";
@ -425,7 +424,6 @@ class AuthenticationViewModel extends ChangeNotifier {
resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async { resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async {
final activation = CheckActivationCode.fromJson(apiResponse.data as Map<String, dynamic>); final activation = CheckActivationCode.fromJson(apiResponse.data as Map<String, dynamic>);
if (activation.errorCode == '699') { if (activation.errorCode == '699') {
// Todo: Hide Loader // Todo: Hide Loader
// GifLoaderDialogUtils.hideDialog(context); // GifLoaderDialogUtils.hideDialog(context);
@ -443,7 +441,6 @@ class AuthenticationViewModel extends ChangeNotifier {
// Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew)); // Navigator.popUntil(context, (route) => Utils.route(route, equalsTo: RegisterNew));
return; return;
} else { } else {
if (activation.list != null && activation.list!.isNotEmpty) { if (activation.list != null && activation.list!.isNotEmpty) {
_appState.setAuthenticatedUser(activation.list!.first); _appState.setAuthenticatedUser(activation.list!.first);
} }
@ -672,7 +669,9 @@ class AuthenticationViewModel extends ChangeNotifier {
otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]), otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]),
nationalIdOrFileNumber: request["PatientIdentificationID"].toString(), nationalIdOrFileNumber: request["PatientIdentificationID"].toString(),
phoneNumber: request["PatientMobileNumber"].toString(), phoneNumber: request["PatientMobileNumber"].toString(),
payload: request); payload: request,
isForRegister: true,
);
} else { } else {
print("=======IN SA======="); print("=======IN SA=======");
chekUserNHICData(request: request); chekUserNHICData(request: request);
@ -713,7 +712,9 @@ class AuthenticationViewModel extends ChangeNotifier {
otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]), otpTypeEnum: OTPTypeEnumExtension.fromInt(request["OTP_SendType"]),
nationalIdOrFileNumber: request["PatientIdentificationID"].toString(), nationalIdOrFileNumber: request["PatientIdentificationID"].toString(),
phoneNumber: request["PatientMobileNumber"].toString(), phoneNumber: request["PatientMobileNumber"].toString(),
payload: request); payload: request,
isForRegister: true,
);
} }
}); });
@ -813,10 +814,8 @@ class AuthenticationViewModel extends ChangeNotifier {
log("Insert IMEI Failed"); log("Insert IMEI Failed");
} }
}); });
} }
Future<void> getPatientDeviceData(int loginType) async { Future<void> getPatientDeviceData(int loginType) async {
final resultEither = await _authenticationRepo.getPatientDeviceData( final resultEither = await _authenticationRepo.getPatientDeviceData(
patientDeviceDataRequest: GetUserMobileDeviceData( patientDeviceDataRequest: GetUserMobileDeviceData(
@ -839,7 +838,6 @@ class AuthenticationViewModel extends ChangeNotifier {
getDeviceLastLogin = deviceInfo['LoginType']; getDeviceLastLogin = deviceInfo['LoginType'];
} }
}); });
} }
@override @override

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart';
@ -15,7 +17,7 @@ class LoaderBottomSheet {
showModalBottomSheet( showModalBottomSheet(
context: _navService.navigatorKey.currentContext!, context: _navService.navigatorKey.currentContext!,
isDismissible: false, isDismissible: ApiConsts.appEnvironmentType == AppEnvironmentTypeEnum.uat ? true : false,
enableDrag: false, enableDrag: false,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (_) { builder: (_) {

Loading…
Cancel
Save