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['LogInTokenID'] = _appState.appLoginTokenID;
} }
body['TokenID'] = "@dm!n"; // body['TokenID'] = "@dm!n";
body['PatientID'] = "4767477"; // body['PatientID'] = "4767477";
} }
body.removeWhere((key, value) => value == null); body.removeWhere((key, value) => value == null);

@ -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.uat; static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod;
// static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT // 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:flutter/material.dart';
import 'package:hijri_gregorian_calendar/hijri_gregorian_calendar.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/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/common_models/nationality_country_model.dart';
import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/loading_utils.dart'; import 'package:hmg_patient_app_new/core/utils/loading_utils.dart';
@ -32,6 +33,7 @@ class AuthenticationViewModel extends ChangeNotifier {
final DialogService _dialogService; final DialogService _dialogService;
final NavigationService _navigationService; final NavigationService _navigationService;
final LocalAuthService _localAuthService; final LocalAuthService _localAuthService;
AuthenticationViewModel({ AuthenticationViewModel({
required AppState appState, required AppState appState,
required AuthenticationRepo authenticationRepo, required AuthenticationRepo authenticationRepo,
@ -164,9 +166,11 @@ class AuthenticationViewModel extends ChangeNotifier {
Future<void> selectDeviceImei({required Function(dynamic data) onSuccess, Function(String)? onError}) async { Future<void> selectDeviceImei({required Function(dynamic data) onSuccess, Function(String)? onError}) async {
// LoadingUtils.showFullScreenLoading(); // LoadingUtils.showFullScreenLoading();
String firebaseToken = _appState.deviceToken == "" // String firebaseToken = _appState.deviceToken;
? "dOGRRszQQMGe_9wA5Hx3kO:APA91bFV5IcIJXvcCXXk0tc2ddtZgWwCPq7sGSuPr-YW7iiJpQZKgFGN9GAzCVOWL8MfheaP1slE8MdxB7lczdPBGdONQ7WbMmhgHcsUCUktq-hsapGXXqc" String firebaseToken = await Utils.getStringFromPrefs(CacheConst.pushToken);
: _appState.deviceToken; // == ""
// ? "dOGRRszQQMGe_9wA5Hx3kO:APA91bFV5IcIJXvcCXXk0tc2ddtZgWwCPq7sGSuPr-YW7iiJpQZKgFGN9GAzCVOWL8MfheaP1slE8MdxB7lczdPBGdONQ7WbMmhgHcsUCUktq-hsapGXXqc"
// : _appState.deviceToken;
final result = await _authenticationRepo.selectDeviceByImei(firebaseToken: firebaseToken); final result = await _authenticationRepo.selectDeviceByImei(firebaseToken: firebaseToken);
result.fold( result.fold(
@ -396,7 +400,7 @@ class AuthenticationViewModel extends ChangeNotifier {
// GifLoaderDialogUtils.hideDialog(context); // GifLoaderDialogUtils.hideDialog(context);
onWrongActivationCode(activation.errorEndUserMessage); onWrongActivationCode(activation.errorEndUserMessage);
return; return;
} else if(activation.messageStatus ==2){ } else if (activation.messageStatus == 2) {
onWrongActivationCode(activation.errorEndUserMessage); onWrongActivationCode(activation.errorEndUserMessage);
return; return;
} else if (registerd_data?.isRegister == true) { } else if (registerd_data?.isRegister == true) {
@ -406,7 +410,6 @@ class AuthenticationViewModel extends ChangeNotifier {
} 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);
} }
_appState.setUserBloodGroup = (activation.patientBlodType ?? ""); _appState.setUserBloodGroup = (activation.patientBlodType ?? "");
_appState.setAppLoginTokenID = activation.authenticationTokenId; _appState.setAppLoginTokenID = activation.authenticationTokenId;
@ -501,7 +504,7 @@ class AuthenticationViewModel extends ChangeNotifier {
_localAuthService.authenticate().then((value) { _localAuthService.authenticate().then((value) {
if (value) { if (value) {
// we have to handle this if verification true; // we have to handle this if verification true;
checkActivationCode(otpTypeEnum: OTPTypeEnum.faceIDFingerprint, activationCode: 0000, onWrongActivationCode: (String? message) { }); checkActivationCode(otpTypeEnum: OTPTypeEnum.faceIDFingerprint, activationCode: 0000, onWrongActivationCode: (String? message) {});
// authenticated = true; // authenticated = true;
notifyListeners(); notifyListeners();
// navigateToHomeScreen(); // navigateToHomeScreen();
@ -512,15 +515,14 @@ class AuthenticationViewModel extends ChangeNotifier {
}); });
this.selectedOption = selectedOption; this.selectedOption = selectedOption;
notifyListeners(); notifyListeners();
} }
checkLastLoginStatus(Function() onSuccess) async { checkLastLoginStatus(Function() onSuccess) async {
if(_appState.getSelectDeviceByImeiRespModelElement !=null && (_appState.getSelectDeviceByImeiRespModelElement!.logInType ==1 || _appState.getSelectDeviceByImeiRespModelElement!.logInType ==4)){ if (_appState.getSelectDeviceByImeiRespModelElement != null &&
Future.delayed(Duration(seconds: 1),(){ (_appState.getSelectDeviceByImeiRespModelElement!.logInType == 1 || _appState.getSelectDeviceByImeiRespModelElement!.logInType == 4)) {
Future.delayed(Duration(seconds: 1), () {
onSuccess(); onSuccess();
}); });
} }
} }

Loading…
Cancel
Save