* 'master' of http://34.17.182.140/Haroon6138/HMG_Patient_App_New:
  family switch parent child and child 2 ,
pull/219/head
Sultan khan 1 day ago
commit cc9ac07923

@ -313,7 +313,11 @@ class AuthenticationRepoImp implements AuthenticationRepo {
requestBody['ProjectOutSA'] = 0; requestBody['ProjectOutSA'] = 0;
requestBody['PatientIdentificationID'] = ""; requestBody['PatientIdentificationID'] = "";
requestBody.removeWhere((key, value) => ['NationalID', 'isDentalAllowedBackend', 'ForRegisteration'].contains(key)); requestBody.removeWhere((key, value) => ['NationalID', 'isDentalAllowedBackend', 'ForRegisteration'].contains(key));
appState.setIsChildLoggedIn = false;
appState.clearUserSwitchPayloads();
} }
} else {
appState.setIsChildLoggedIn = true;
} }
} }

@ -280,13 +280,13 @@ class AuthenticationViewModel extends ChangeNotifier {
onSuccess: (dynamic respData) async { onSuccess: (dynamic respData) async {
try { try {
if (respData != null) { if (respData != null) {
dynamic data = await SelectDeviceByImeiRespModelElement.fromJson(respData.toJson()); dynamic data = await SelectDeviceByImeiRespModelElement.fromJson(respData.toJson());
_appState.setSelectDeviceByImeiRespModelElement(data); _appState.setSelectDeviceByImeiRespModelElement(data);
LoaderBottomSheet.hideLoader(); LoaderBottomSheet.hideLoader();
// TODO: Navigate to SavedLogin when available // TODO: Navigate to SavedLogin when available
// SelectDeviceByImeiRespModelElement savedData = // SelectDeviceByImeiRespModelElement savedData =
// SelectDeviceByImeiRespModelElement.fromJson(respData); // SelectDeviceByImeiRespModelElement.fromJson(respData);
if (!isInitialLoginNavigated) { if (!isInitialLoginNavigated) {
_navigationService.pushPage(page: SavedLogin()); _navigationService.pushPage(page: SavedLogin());
} }
@ -304,10 +304,11 @@ class AuthenticationViewModel extends ChangeNotifier {
_navigationService.pushPage(page: LoginScreen()); _navigationService.pushPage(page: LoginScreen());
} }
} }
}, onError: (String error) { },
LoaderBottomSheet.hideLoader(); onError: (String error) {
_dialogService.showErrorBottomSheet(message: error, onOkPressed: () {}); LoaderBottomSheet.hideLoader();
}); _dialogService.showErrorBottomSheet(message: error, onOkPressed: () {});
});
} }
Future<void> checkUserAuthentication({required OTPTypeEnum otpTypeEnum, Function(dynamic)? onSuccess, Function(String)? onError}) async { Future<void> checkUserAuthentication({required OTPTypeEnum otpTypeEnum, Function(dynamic)? onSuccess, Function(String)? onError}) async {
@ -631,8 +632,8 @@ class AuthenticationViewModel extends ChangeNotifier {
if (isSwitchUser) { if (isSwitchUser) {
if (_appState.getIsChildLoggedIn) { if (_appState.getIsChildLoggedIn) {
_appState.setSuperUserID = null; _appState.setSuperUserID = null;
_appState.setIsChildLoggedIn = false; // _appState.setIsChildLoggedIn = false;
activation.list!.first.isParentUser = true; activation.list!.first.isParentUser = false;
var allUsersPayload = _appState.getUserSwitchPayloads; var allUsersPayload = _appState.getUserSwitchPayloads;
if ((allUsersPayload.containsKey('superUser') && allUsersPayload['superUser'] != null)) { if ((allUsersPayload.containsKey('superUser') && allUsersPayload['superUser'] != null)) {
_appState.addUserSwitchPayload(activation.list!.first.toJson(), isSuperUser: false); _appState.addUserSwitchPayload(activation.list!.first.toJson(), isSuperUser: false);
@ -641,9 +642,9 @@ class AuthenticationViewModel extends ChangeNotifier {
} }
} else { } else {
_appState.setSuperUserID = _appState.getAuthenticatedUser()?.patientId; _appState.setSuperUserID = _appState.getAuthenticatedUser()?.patientId;
_appState.setIsChildLoggedIn = true; // _appState.setIsChildLoggedIn = false;
activation.list!.first.isParentUser = false; activation.list!.first.isParentUser = true;
_appState.addUserSwitchPayload(activation.list!.first.toJson(), isSuperUser: false); _appState.addUserSwitchPayload(activation.list!.first.toJson(), isSuperUser: true);
} }
} else { } else {
activation.list!.first.isParentUser = true; activation.list!.first.isParentUser = true;

Loading…
Cancel
Save