feat: update Dockerfiles to use explicit image paths and enhance localStorage handling in ThemeService
This commit is contained in:
1 parent
030d00ef67
commit
3dca10b56f
7 files changed
+59
-10
No files matched your search
@@ -0,0 +1,7 @@
|
||||
export function getBrowserStorage(): Storage | null {
|
||||
try {
|
||||
return typeof globalThis.localStorage === 'undefined' ? null : globalThis.localStorage;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { DOCUMENT } from '@angular/common';
|
||||
import { effect, inject, Injectable, signal } from '@angular/core';
|
||||
import { getBrowserStorage } from './browser-storage';
|
||||
|
||||
export type ThemePreference = 'light' | 'dark' | 'system';
|
||||
|
||||
@@ -8,7 +9,7 @@ const THEME_STORAGE_KEY = 'lmnp-theme';
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ThemeService {
|
||||
private readonly document = inject(DOCUMENT);
|
||||
private readonly storage = typeof localStorage === 'undefined' ? null : localStorage;
|
||||
private readonly storage = getBrowserStorage();
|
||||
private readonly colorSchemeQuery =
|
||||
typeof window.matchMedia === 'function'
|
||||
? window.matchMedia('(prefers-color-scheme: dark)')
|
||||
|
||||
Reference in new issue
Block a user