Skip to content

Commit

Permalink
Add cookies acceptance toggle to storage settings
Browse files Browse the repository at this point in the history
page
  • Loading branch information
cophilot committed Nov 13, 2023
1 parent 50c977b commit 184194e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<div class="container">
<div class="row">
<p class="label">Cookies</p>
<button class="action" (click)="toggleCookiesAccepted()">
{{ coookiesAccepted() ? "Reject" : "Accept" }}
</button>
</div>
<div class="row" *ngIf="getUserLevel() > 0">
<p class="label">Export chapter</p>
<button class="action" (click)="showSelectChapter = true">Export</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,23 @@ export class StorageSettingsComponent {
getUserLevel() {
return UserManger.userLevel;
}
coookiesAccepted(): boolean {
return LocalStorageService.cookiesAccepted;
}

toggleCookiesAccepted() {
if (LocalStorageService.cookiesAccepted) {
LocalStorageService.rejectCookies();
NotificationComponent.showNotification(
'Cookies rejected',
'Cookies will not be used.'
);
return;
}
LocalStorageService.acceptCookies();
NotificationComponent.showNotification(
'Cookies accepted',
'Cookies will be used.'
);
}
}

0 comments on commit 184194e

Please sign in to comment.