1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

Set theme already on the login page #587

This commit is contained in:
Patrik J. Braun 2023-08-09 23:25:56 +02:00
parent 99590487b2
commit d35d9e88e6
4 changed files with 10 additions and 10 deletions

View File

@ -1,12 +1,12 @@
import {Component, OnDestroy, OnInit} from '@angular/core'; import {Component, OnDestroy, OnInit} from '@angular/core';
import {AuthenticationService} from './model/network/authentication.service'; import {AuthenticationService} from './model/network/authentication.service';
import {Router} from '@angular/router';
import {Config} from '../../common/config/public/Config'; import {Config} from '../../common/config/public/Config';
import {Title} from '@angular/platform-browser'; import {Title} from '@angular/platform-browser';
import {ShareService} from './ui/gallery/share.service'; import {ShareService} from './ui/gallery/share.service';
import 'hammerjs'; import 'hammerjs';
import {Subscription} from 'rxjs'; import {Subscription} from 'rxjs';
import {NavigationService} from './model/navigation.service'; import {NavigationService} from './model/navigation.service';
import {ThemeService} from './model/theme.service';
@Component({ @Component({
selector: 'app-pi-gallery2', selector: 'app-pi-gallery2',
@ -17,12 +17,13 @@ export class AppComponent implements OnInit, OnDestroy {
private subscription: Subscription = null; private subscription: Subscription = null;
constructor( constructor(
private router: Router,
private authenticationService: AuthenticationService, private authenticationService: AuthenticationService,
private shareService: ShareService, private shareService: ShareService,
private navigation: NavigationService, private navigation: NavigationService,
private title: Title private title: Title,
private themeService: ThemeService
) { ) {
themeService.init();
} }
async ngOnInit(): Promise<void> { async ngOnInit(): Promise<void> {

View File

@ -14,8 +14,12 @@ export class ThemeService {
public readonly matcher = window.matchMedia('(prefers-color-scheme: dark)'); public readonly matcher = window.matchMedia('(prefers-color-scheme: dark)');
constructor(private cachingService: GalleryCacheService) { constructor(private cachingService: GalleryCacheService) {
if (cachingService.getThemeMode()) { this.init();
this.setMode(cachingService.getThemeMode()); }
public init() {
if (this.cachingService.getThemeMode()) {
this.setMode(this.cachingService.getThemeMode());
} else { } else {
this.setMode(Config.Gallery.Themes.defaultMode); this.setMode(Config.Gallery.Themes.defaultMode);
} }

View File

@ -8,8 +8,6 @@
.card { .card {
min-width: 400px; min-width: 400px;
background-color: #F7F7F7;
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
} }
.error-message { .error-message {

View File

@ -24,9 +24,6 @@
.card { .card {
min-width: 400px; min-width: 400px;
background-color: #F7F7F7;
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
} }
.error-message { .error-message {