diff --git a/src/app/components/main-navigation/main-navigation.component.ts b/src/app/components/main-navigation/main-navigation.component.ts index 4f41d9d..2946e2f 100644 --- a/src/app/components/main-navigation/main-navigation.component.ts +++ b/src/app/components/main-navigation/main-navigation.component.ts @@ -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 = this.breakpointObserver.observe(Breakpoints.Handset) - .pipe( - map(result => result.matches), - shareReplay() - ); navLinksLoggedIn = [ { path: '', label: 'Home' }, { path: this.profileUrl, label: 'Profile' }, diff --git a/src/app/services/datasharing.service.ts b/src/app/services/datasharing.service.ts index 7116724..690b314 100644 --- a/src/app/services/datasharing.service.ts +++ b/src/app/services/datasharing.service.ts @@ -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); } diff --git a/src/app/services/settings/settings.service.ts b/src/app/services/settings/settings.service.ts index 8ee9373..00eca51 100644 --- a/src/app/services/settings/settings.service.ts +++ b/src/app/services/settings/settings.service.ts @@ -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; - 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');