pull/17/head
haroon amjad 2 months ago
parent 757546f0bb
commit 2d0fc11f05

@ -170,8 +170,8 @@ class ApiClientImp implements ApiClient {
body['LogInTokenID'] = _appState.appLoginTokenID;
}
body['TokenID'] = "@dm!n";
body['PatientID'] = "4767477";
// body['TokenID'] = "@dm!n";
// body['PatientID'] = "4767477";
}
body.removeWhere((key, value) => value == null);

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

@ -4,6 +4,7 @@ import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:hijri_gregorian_calendar/hijri_gregorian_calendar.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/cache_consts.dart';
import 'package:hmg_patient_app_new/core/common_models/nationality_country_model.dart';
import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/loading_utils.dart';
@ -32,6 +33,7 @@ class AuthenticationViewModel extends ChangeNotifier {
final DialogService _dialogService;
final NavigationService _navigationService;
final LocalAuthService _localAuthService;
AuthenticationViewModel({
required AppState appState,
required AuthenticationRepo authenticationRepo,
@ -45,7 +47,7 @@ class AuthenticationViewModel extends ChangeNotifier {
_errorHandlerService = errorHandlerService,
_appState = appState,
_authenticationRepo = authenticationRepo,
_localAuthService = localAuthService;
_localAuthService = localAuthService;
final TextEditingController nationalIdController = TextEditingController(), phoneNumberController = TextEditingController(), dobController = TextEditingController();
CountryEnum selectedCountrySignup = CountryEnum.saudiArabia;
@ -164,9 +166,11 @@ class AuthenticationViewModel extends ChangeNotifier {
Future<void> selectDeviceImei({required Function(dynamic data) onSuccess, Function(String)? onError}) async {
// LoadingUtils.showFullScreenLoading();
String firebaseToken = _appState.deviceToken == ""
? "dOGRRszQQMGe_9wA5Hx3kO:APA91bFV5IcIJXvcCXXk0tc2ddtZgWwCPq7sGSuPr-YW7iiJpQZKgFGN9GAzCVOWL8MfheaP1slE8MdxB7lczdPBGdONQ7WbMmhgHcsUCUktq-hsapGXXqc"
: _appState.deviceToken;
// String firebaseToken = _appState.deviceToken;
String firebaseToken = await Utils.getStringFromPrefs(CacheConst.pushToken);
// == ""
// ? "dOGRRszQQMGe_9wA5Hx3kO:APA91bFV5IcIJXvcCXXk0tc2ddtZgWwCPq7sGSuPr-YW7iiJpQZKgFGN9GAzCVOWL8MfheaP1slE8MdxB7lczdPBGdONQ7WbMmhgHcsUCUktq-hsapGXXqc"
// : _appState.deviceToken;
final result = await _authenticationRepo.selectDeviceByImei(firebaseToken: firebaseToken);
result.fold(
@ -216,7 +220,7 @@ class AuthenticationViewModel extends ChangeNotifier {
// SelectDeviceByImeiRespModelElement savedData =
// SelectDeviceByImeiRespModelElement.fromJson(respData);
_navigationService.pushPage(page: SavedLogin());
// _navigationService.pushPage(page: LoginScreen());
// _navigationService.pushPage(page: LoginScreen());
} else {
LoadingUtils.hideFullScreenLoader();
_navigationService.pushPage(page: LoginScreen());
@ -396,7 +400,7 @@ class AuthenticationViewModel extends ChangeNotifier {
// GifLoaderDialogUtils.hideDialog(context);
onWrongActivationCode(activation.errorEndUserMessage);
return;
} else if(activation.messageStatus ==2){
} else if (activation.messageStatus == 2) {
onWrongActivationCode(activation.errorEndUserMessage);
return;
} else if (registerd_data?.isRegister == true) {
@ -406,7 +410,6 @@ class AuthenticationViewModel extends ChangeNotifier {
} else {
if (activation.list != null && activation.list!.isNotEmpty) {
_appState.setAuthenticatedUser(activation.list!.first);
}
_appState.setUserBloodGroup = (activation.patientBlodType ?? "");
_appState.setAppLoginTokenID = activation.authenticationTokenId;
@ -418,7 +421,7 @@ class AuthenticationViewModel extends ChangeNotifier {
} else {
navigateToHomeScreen();
//Agreement page not designed yet so we are navigating to home screen directly
// getUserAgreementContent(request: request);
// getUserAgreementContent(request: request);
}
// TODO: setPreferences and stuff
// sharedPref.remove(FAMILY_FILE);
@ -501,8 +504,8 @@ class AuthenticationViewModel extends ChangeNotifier {
_localAuthService.authenticate().then((value) {
if (value) {
// we have to handle this if verification true;
checkActivationCode(otpTypeEnum: OTPTypeEnum.faceIDFingerprint, activationCode: 0000, onWrongActivationCode: (String? message) { });
// authenticated = true;
checkActivationCode(otpTypeEnum: OTPTypeEnum.faceIDFingerprint, activationCode: 0000, onWrongActivationCode: (String? message) {});
// authenticated = true;
notifyListeners();
// navigateToHomeScreen();
} else {
@ -512,15 +515,14 @@ class AuthenticationViewModel extends ChangeNotifier {
});
this.selectedOption = selectedOption;
notifyListeners();
}
checkLastLoginStatus(Function() onSuccess) async {
if(_appState.getSelectDeviceByImeiRespModelElement !=null && (_appState.getSelectDeviceByImeiRespModelElement!.logInType ==1 || _appState.getSelectDeviceByImeiRespModelElement!.logInType ==4)){
Future.delayed(Duration(seconds: 1),(){
if (_appState.getSelectDeviceByImeiRespModelElement != null &&
(_appState.getSelectDeviceByImeiRespModelElement!.logInType == 1 || _appState.getSelectDeviceByImeiRespModelElement!.logInType == 4)) {
Future.delayed(Duration(seconds: 1), () {
onSuccess();
});
}
}

Loading…
Cancel
Save