Subscription and contract management app for Android based on Ionic and Angular. Written in TypeScript.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

30 lines
820 B

import { Injectable } from '@angular/core';
import { StorageService } from './storage.service';
@Injectable({
providedIn: 'root'
})
export class ThemeService {
constructor(public storageService: StorageService) { }
applyTheme() {
if (window.navigator.userAgent.includes('AndroidDarkMode')) {
document.body.classList.add('dark');
}
this.storageService.retrieveSettingsFromStorage().then(settings => {
if (settings.hasOwnProperty('forceDarkMode')) {
if (settings.forceDarkMode) {
document.body.classList.add('dark');
} else {
if (window.navigator.userAgent.includes('AndroidDarkMode')) {
document.body.classList.add('dark');
} else {
document.body.classList.remove('dark');
}
}
}
});
}
}