fixed darkmode bug

master
Max 5 years ago
parent d474a946ab
commit 71e8dfef9b

@ -1,7 +1,5 @@
import { Component, OnInit, HostBinding } from '@angular/core';
import { BreakpointObserver, Breakpoints } from '@angular/cdk/layout';
import { Observable } from 'rxjs';
import { map, shareReplay } from 'rxjs/operators';
import { DatasharingService } from '../../services/datasharing.service';
import { RequestService } from '../../services/request/request.service';
import { SettingsService } from '../../services/settings/settings.service';
@ -42,11 +40,6 @@ export class MainNavigationComponent implements OnInit {
lighttheme = true;
overlay;
isHandset$: Observable<boolean> = this.breakpointObserver.observe(Breakpoints.Handset)
.pipe(
map(result => result.matches),
shareReplay()
);
navLinksLoggedIn = [
{ path: '', label: 'Home' },
{ path: this.profileUrl, label: 'Profile' },

@ -25,6 +25,12 @@ export class DatasharingService {
this.changeUserInfo(user);
}
setDarkMode(active: boolean) {
const user: User = this.userInfoSource.getValue();
user.darkmode = active;
this.changeUserInfo(user);
}
changeChatIDs(pChatIDs: number[]) {
this.chatIDsSource.next(pChatIDs);
}

@ -2,6 +2,7 @@ import {Injectable} from '@angular/core';
import {Http} from '@angular/http';
import { User } from 'src/app/models/user';
import { environment } from 'src/environments/environment';
import {DatasharingService} from '../datasharing.service';
@Injectable({
providedIn: 'root'
@ -9,10 +10,11 @@ import { environment } from 'src/environments/environment';
export class SettingsService {
users: Array<User>;
constructor(private http: Http) {
constructor(private http: Http, private data: DatasharingService) {
}
setDarkModeActive(active: boolean) {
this.data.setDarkMode(active);
const url = environment.graphQLUrl;
const headers = new Headers();
headers.set('Content-Type', 'application/json');

Loading…
Cancel
Save