Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code fix for 133637-skipping-TnC #412

Open
wants to merge 1 commit into
base: dev-master-june
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 39 additions & 7 deletions src/app/client/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,24 +275,53 @@ export class AppComponent implements OnInit, OnDestroy {
}
);
}

//used to prevent the page from being refreshed or closed by handling the beforeunload event.
preventRefresh(event: Event) {
event.preventDefault();
return '';
}
checkFormData(): Observable<any> {
const formReadInputParams = {
formType: 'newUserOnboarding',
formAction: 'onboarding',
contentType: 'global',
component: 'portal'
};
return of(this.formService.getFormConfig(formReadInputParams).subscribe(
(formResponsedata) => {
console.log('userOnboarding Form is called and we are trying to get the update',formResponsedata);
if (_.get(formResponsedata, 'shownewUserOnboarding') === 'false') {
this.FORM_CONFIG_ENABLED = true;
const observable = new Observable<any>((observer) => {
this.formService.getFormConfig(formReadInputParams).subscribe(
(formResponsedata) => {
console.log('userOnboarding Form is called and we are trying to get the update', formResponsedata);
if (_.get(formResponsedata, 'shownewUserOnboarding') === 'false') {
this.FORM_CONFIG_ENABLED = true;
}
observer.next(formResponsedata);
observer.complete();
window.removeEventListener('beforeunload', this.preventRefresh);
},
(error) => {
observer.error(error);
window.removeEventListener('beforeunload', this.preventRefresh);
}
}
));
);
});

return observable;

// return of(this.formService.getFormConfig(formReadInputParams).subscribe(
// (formResponsedata) => {
// console.log('userOnboarding Form is called and we are trying to get the update',formResponsedata);
// if (_.get(formResponsedata, 'shownewUserOnboarding') === 'false') {
// this.FORM_CONFIG_ENABLED = true;
// }
// }
// ));
}

ngOnInit() {
//used to display a warning message when the user attempts to refresh or close the page.
window.addEventListener('beforeunload', this.preventRefresh);

this.checkToShowPopups();
this.isIOS = this.utilService.isIos;
this.isDesktopApp = this.utilService.isDesktopApp;
Expand Down Expand Up @@ -886,6 +915,9 @@ export class AppComponent implements OnInit, OnDestroy {
}

ngOnDestroy() {
//used to display a warning message when the user attempts to refresh or close the page.
window.removeEventListener('beforeunload', this.preventRefresh);

if (this.resourceDataSubscription) {
this.resourceDataSubscription.unsubscribe();
}
Expand Down