Commit fbb23169 authored by Lukas Mauß's avatar Lukas Mauß

Allow the user to use only if he has accepted cookies and privacy protection

parent fd1b91c5
......@@ -30,7 +30,8 @@ export class CookiesComponent implements OnInit {
acceptCookies() {
localStorage.setItem('cookieAccepted', 'true');
this.dialogRef.close();
localStorage.setItem('dataProtectionConsent', 'true');
this.dialogRef.close(true);
setTimeout( () => {
document.getElementById('live_announcer-button').focus();
}, 500);
......@@ -39,7 +40,7 @@ export class CookiesComponent implements OnInit {
exitApp() {
localStorage.setItem('cookieAccepted', 'false');
// TODO somehow exit the app, since the user didn't accept cookie usage
this.dialogRef.close(true);
this.dialogRef.close(false);
}
openDataProtection() {
......
......@@ -25,7 +25,7 @@ export class DataProtectionComponent implements OnInit {
accept() {
this.dataProtectionConsent(true);
this.dialogRef.close();
this.dialogRef.close(true);
}
decline() {
......@@ -40,7 +40,7 @@ export class DataProtectionComponent implements OnInit {
} else { // otherwise: go there
this.router.navigate(['/home']);
}
this.dialogRef.close();
this.dialogRef.close(false);
}
/**
......
......@@ -32,6 +32,7 @@ export class FooterComponent implements OnInit {
public open: string;
public deviceType: string;
public cookieAccepted: boolean;
public dataProtectionConsent: boolean;
public themeClass = localStorage.getItem('theme');
......@@ -60,11 +61,12 @@ export class FooterComponent implements OnInit {
this.themes = this.themeService.getThemes();
this.updateScale(this.themeService.getThemeByKey(this.themeClass));
this.cookieAccepted = localStorage.getItem('cookieAccepted') === 'true';
this.dataProtectionConsent = localStorage.getItem('dataProtectionConsent') === 'true';
if (!localStorage.getItem('cookieAccepted')) {
this.showCookieModal();
} else {
if (!this.cookieAccepted) {
if (!this.cookieAccepted || !this.dataProtectionConsent) {
this.showOverlay();
}
}
......@@ -86,7 +88,9 @@ export class FooterComponent implements OnInit {
dialogRef.disableClose = true;
dialogRef.componentInstance.deviceType = this.deviceType;
dialogRef.afterClosed().subscribe(res => {
if (res) {
this.cookieAccepted = res;
this.dataProtectionConsent = res;
if (!res) {
this.showOverlay();
}
});
......@@ -111,6 +115,12 @@ export class FooterComponent implements OnInit {
width: '80%'
});
dialogRef.componentInstance.deviceType = this.deviceType;
dialogRef.afterClosed().subscribe(res => {
this.dataProtectionConsent = res;
if (!res) {
this.showOverlay();
}
});
}
showOverlay() {
......@@ -120,7 +130,11 @@ export class FooterComponent implements OnInit {
dialogRef.disableClose = true;
dialogRef.afterClosed().subscribe(res => {
if (res) {
this.showCookieModal();
if (!this.cookieAccepted) {
this.showCookieModal();
} else if (!this.dataProtectionConsent) {
this.showDataProtection();
}
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment