fixed issues of feedback

enad-Q1
umasoodch 4 years ago
parent 7c3e6501cc
commit cdd82fc774

@ -58,7 +58,7 @@
</ion-col> </ion-col>
</ion-row> </ion-row>
<!-- <div><p style="color: red; font-weight: bold; font-size: 10px; text-align: center;">{{'general,noOfTriesLogin' | translate}}</p></div> --> <div *ngIf="showErrorMessage"><p style="color: red; font-weight: bold; font-size: 14px; text-align: center;">{{messageValue}}</p></div>
</div> </div>

@ -50,6 +50,8 @@ export class SmsPageComponent implements OnInit {
loginType: any; loginType: any;
activeType: any; activeType: any;
public isNFCAvailable = false; public isNFCAvailable = false;
public showErrorMessage = false;
public messageValue: string;
constructor( constructor(
public navCtrl: NavController, public navCtrl: NavController,
@ -183,6 +185,7 @@ export class SmsPageComponent implements OnInit {
} }
public checkSMS() { public checkSMS() {
this.showErrorMessage = false;
const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false); const data = this.sharedData.getSharedData(AuthenticationService.LOGIN_DATA, false);
const request = new SMSCheckRequest(); const request = new SMSCheckRequest();
request.LogInTokenID = data.LogInTokenID; request.LogInTokenID = data.LogInTokenID;
@ -190,9 +193,8 @@ export class SmsPageComponent implements OnInit {
request.P_USER_NAME = data.P_USER_NAME; request.P_USER_NAME = data.P_USER_NAME;
request.MobileNumber = data.MobileNumber; request.MobileNumber = data.MobileNumber;
request.IsDeviceNFC = this.isNFCAvailable; request.IsDeviceNFC = this.isNFCAvailable;
this.authService.checkSMS(request, () => {}, this.translate.trPK('general', 'ok')).subscribe((result: SMSCheckResponse) => { this.authService.checkSMS(request, () => {}, this.translate.trPK('general', 'ok'), true).subscribe((result: SMSCheckResponse) => {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
// Wifi Credientials // Wifi Credientials
CommonService.MOHEMM_WIFI_SSID = result.Mohemm_Wifi_SSID; CommonService.MOHEMM_WIFI_SSID = result.Mohemm_Wifi_SSID;
CommonService.MOHEMM_WIFI_PASSWORD = result.Mohemm_Wifi_Password; CommonService.MOHEMM_WIFI_PASSWORD = result.Mohemm_Wifi_Password;
@ -210,6 +212,16 @@ export class SmsPageComponent implements OnInit {
this.activeType =this.common.setActiveTypeLogin(0); this.activeType =this.common.setActiveTypeLogin(0);
this.common.openHome(); this.common.openHome();
}); });
} else {
let errorResult: any;
errorResult = result;
this.showErrorMessage = true;
this.messageValue = errorResult.ErrorEndUserMessage;
this.smc_code = [];
(document.activeElement as HTMLElement).blur();
setTimeout(() => {
this.showErrorMessage = false;
}, 5000);
} }
}); });
} }

@ -485,10 +485,10 @@ export class AuthenticationService {
return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel); return this.con.post(AuthenticationService.activationCodeURL, request, onError, errorLabel);
} }
public checkSMS(request: SMSCheckRequest, onError: any, errorLabel: string) public checkSMS(request: SMSCheckRequest, onError: any, errorLabel: string, fromSMS = false )
: Observable<SMSCheckResponse> { : Observable<SMSCheckResponse> {
this.setPublicFields(request); this.setPublicFields(request);
return this.con.post(AuthenticationService.smsCheck, request, onError, errorLabel); return this.con.post(AuthenticationService.smsCheck, request, onError, errorLabel, fromSMS);
} }
public checkForgetSMS(request: SMSCheckRequest, onError: any, errorLabel: string) public checkForgetSMS(request: SMSCheckRequest, onError: any, errorLabel: string)

@ -27,8 +27,8 @@ export class ConnectorService {
public static retryTimes = 0; public static retryTimes = 0;
public static timeOut = 120 * 1000; public static timeOut = 120 * 1000;
// public static host = 'https://uat.hmgwebservices.com/'; public static host = 'https://uat.hmgwebservices.com/';
public static host = 'https://hmgwebservices.com/'; // public static host = 'https://hmgwebservices.com/';
constructor(public httpClient: HttpClient, constructor(public httpClient: HttpClient,
public cs: CommonService, public cs: CommonService,
@ -39,7 +39,8 @@ export class ConnectorService {
service: string, service: string,
data: any, data: any,
onError: any, onError: any,
errorLabel?: string errorLabel?: string,
fromSMS = false
): Observable<any> { ): Observable<any> {
this.cs.startLoading(); this.cs.startLoading();
return this.httpClient return this.httpClient
@ -52,7 +53,7 @@ export class ConnectorService {
timeout(ConnectorService.timeOut), timeout(ConnectorService.timeOut),
retry(ConnectorService.retryTimes), retry(ConnectorService.retryTimes),
tap( tap(
res => this.handleResponse(res, onError, errorLabel), res => this.handleResponse(res, onError, errorLabel, false, fromSMS),
error => this.handleError(error, onError, errorLabel) error => this.handleError(error, onError, errorLabel)
) )
); );
@ -218,7 +219,8 @@ export class ConnectorService {
}); });
} }
public handleResponse(result: Response, onError: any, errorLabel: string, isPostNoLoad = false) { public handleResponse(result: Response, onError: any, errorLabel: string, isPostNoLoad = false, fromSMS = false) {
console.log('fromSMSValue ' + fromSMS)
if (!isPostNoLoad) { if (!isPostNoLoad) {
this.cs.stopLoading(); this.cs.stopLoading();
} }
@ -236,11 +238,16 @@ export class ConnectorService {
this.cs.stopLoading(); this.cs.stopLoading();
} else { } else {
this.cs.stopLoading(); this.cs.stopLoading();
this.cs.showErrorMessageDialog( if (!fromSMS) {
onError, this.cs.showErrorMessageDialog(
errorLabel, onError,
result.ErrorEndUserMessage errorLabel,
); result.ErrorEndUserMessage
);
} else {
console.log('its an error from sms')
}
//add flag if user not auth //add flag if user not auth
} }

Loading…
Cancel
Save