Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 1x 24x 24x 24x 26x 26x 26x 1x 2x 2x 2x 35x | import { Injectable, signal } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class SettingsService {
private readonly CHRISTMAS_MODE_KEY = 'christmasModeEnabled';
// Signal pour l'état du mode Noël (100% frontend avec localStorage)
christmasModeEnabled = signal<boolean>(false);
constructor() {
// Charger depuis localStorage au démarrage
this.loadChristmasMode();
}
/**
* Charge l'état du mode Noël depuis localStorage
*/
loadChristmasMode(): void {
const stored = localStorage.getItem(this.CHRISTMAS_MODE_KEY);
const enabled = stored === 'true';
this.christmasModeEnabled.set(enabled);
}
/**
* Recharge l'état du mode Noël
*/
refreshChristmasMode(): void {
this.loadChristmasMode();
}
/**
* Active ou désactive le mode Noël (100% frontend, pas de backend)
*/
setChristmasMode(enabled: boolean): { success: boolean; enabled: boolean; message: string } {
// Sauvegarder dans localStorage
localStorage.setItem(this.CHRISTMAS_MODE_KEY, String(enabled));
// Mettre à jour le signal
this.christmasModeEnabled.set(enabled);
return {
success: true,
enabled: enabled,
message: enabled ? 'Mode Noël activé' : 'Mode Noël désactivé'
};
}
/**
* Vérifie si le mode Noël est activé
*/
isChristmasModeEnabled(): boolean {
return this.christmasModeEnabled();
}
}
|