2021-01-18 16:24:57 +01:00
|
|
|
import { Injectable } from '@angular/core';
|
2021-10-26 15:27:25 +01:00
|
|
|
import { ThemeService } from 'src/app/services/theme.service';
|
2021-11-23 13:55:43 +01:00
|
|
|
import { StorageService} from 'src/app/services/storage.service';
|
2021-01-18 16:24:57 +01:00
|
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
|
providedIn: 'root'
|
|
|
|
|
})
|
2021-08-27 15:30:02 +01:00
|
|
|
export class BackgroundService {
|
2021-01-18 16:24:57 +01:00
|
|
|
|
2021-10-18 17:42:25 +01:00
|
|
|
callBacks: {
|
2021-10-19 09:41:06 +01:00
|
|
|
type: 'Offline' | 'Online' | 'Notification',
|
2021-10-18 17:42:25 +01:00
|
|
|
object?: string
|
|
|
|
|
funx: Function
|
|
|
|
|
}[] = []
|
|
|
|
|
|
2021-10-26 15:27:25 +01:00
|
|
|
constructor(
|
2021-11-23 13:55:43 +01:00
|
|
|
private themeservice: ThemeService,
|
|
|
|
|
private storageservice: StorageService
|
2021-10-26 15:27:25 +01:00
|
|
|
) { }
|
2021-08-27 15:35:29 +01:00
|
|
|
|
|
|
|
|
online() {
|
2021-10-26 15:27:25 +01:00
|
|
|
if (this.themeservice.currentTheme == 'gov') {
|
|
|
|
|
|
|
|
|
|
document.body.style.setProperty(`--color`, "#d9d9d9");
|
|
|
|
|
document.body.style.setProperty(`--color2`, "#f0f0f0");
|
|
|
|
|
document.body.style.setProperty(`--color3`, "#d9d9d9");
|
|
|
|
|
document.body.style.setProperty(`--color4`, "#d9d9d9ee");
|
|
|
|
|
document.body.style.setProperty(`--color5`, "#ececec");
|
2021-11-23 13:55:43 +01:00
|
|
|
this.storageservice.store('networkCheckStore','online');
|
2021-10-26 15:27:25 +01:00
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
document.body.style.setProperty(`--color`, "#0782C9");
|
|
|
|
|
document.body.style.setProperty(`--color2`, "#45BAFF");
|
|
|
|
|
document.body.style.setProperty(`--color3`, "#0782C9");
|
|
|
|
|
document.body.style.setProperty(`--color4`, "#0782c9f0");
|
|
|
|
|
document.body.style.setProperty(`--color5`, "#45BAFF");
|
2021-11-23 13:55:43 +01:00
|
|
|
this.storageservice.store('networkCheckStore','online');
|
2021-10-26 15:27:25 +01:00
|
|
|
}
|
|
|
|
|
|
2021-10-18 17:42:25 +01:00
|
|
|
this.callBacks.forEach((e) => {
|
|
|
|
|
if (e.type == 'Online') {
|
|
|
|
|
e.funx()
|
|
|
|
|
}
|
|
|
|
|
})
|
2021-08-27 15:35:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
offline() {
|
|
|
|
|
document.body.style.setProperty(`--color`, "#ffb703");
|
|
|
|
|
document.body.style.setProperty(`--color2`, "#ffb703");
|
|
|
|
|
document.body.style.setProperty(`--color3`, "#ffb703");
|
|
|
|
|
document.body.style.setProperty(`--color4`, "#ffb703");
|
|
|
|
|
document.body.style.setProperty(`--color5`, "#ffb703");
|
2021-11-23 13:55:43 +01:00
|
|
|
this.storageservice.store('networkCheckStore','offline');
|
2021-10-18 17:42:25 +01:00
|
|
|
this.callBacks.forEach((e) => {
|
|
|
|
|
if (e.type == 'Offline') {
|
|
|
|
|
e.funx()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-19 09:41:06 +01:00
|
|
|
registerBackService(type: 'Offline' | 'Online' | 'Notification', funx: Function, object = '') {
|
2021-10-18 17:42:25 +01:00
|
|
|
this.callBacks.push({
|
|
|
|
|
type,
|
|
|
|
|
funx,
|
|
|
|
|
object
|
|
|
|
|
})
|
2021-08-27 15:35:29 +01:00
|
|
|
}
|
2021-10-20 17:46:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
greyTheme() {
|
|
|
|
|
document.body.style.setProperty(`--color`, "#D9D9D9");
|
|
|
|
|
document.body.style.setProperty(`--color2`, "#f0f0f0");
|
|
|
|
|
document.body.style.setProperty(`--color3`, "#D9D9D9");
|
|
|
|
|
document.body.style.setProperty(`--color4`, "#d9d9d9ee");
|
|
|
|
|
document.body.style.setProperty(`--color5`, "#ececec");
|
|
|
|
|
|
|
|
|
|
document.body.style.setProperty(`--header-container-background`, "#fff");
|
|
|
|
|
document.body.style.setProperty(`--headercolor`, "#000");
|
|
|
|
|
|
2021-10-22 14:00:07 +01:00
|
|
|
document.body.style.setProperty(`--login-background`, "linear-gradient(180deg, #c63527 60%, #000 100%) !important");
|
|
|
|
|
document.body.style.setProperty(`--button-hover`, "#ffb81c");
|
|
|
|
|
document.body.style.setProperty(`--inicio-open-page-from-box`, "#c63527");
|
|
|
|
|
document.body.style.setProperty(`--header-tab-top-border`, "#000");
|
|
|
|
|
document.body.style.setProperty(`--header-tab-text-white`, "rgb(0, 0, 0)");
|
|
|
|
|
document.body.style.setProperty(`--header-tab-text-white`, "rgb(0, 0, 0)");
|
|
|
|
|
|
2021-10-20 17:46:03 +01:00
|
|
|
document.body.style.setProperty(`--header-bottom-line-background`, "rgb(255, 0, 0)");
|
|
|
|
|
document.body.style.setProperty(`--header-bottom-line-background-image`, "linear-gradient(to right, #C63527, #FFB81C, #FFC72C)");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
blueTheme() {
|
|
|
|
|
|
|
|
|
|
document.body.style.setProperty(`--color`, "#0782C9");
|
|
|
|
|
document.body.style.setProperty(`--color2`, "#45BAFF");
|
|
|
|
|
document.body.style.setProperty(`--color3`, "#0782C9");
|
|
|
|
|
document.body.style.setProperty(`--color4`, "#0782c9f0");
|
|
|
|
|
document.body.style.setProperty(`--color5`, "#f7f5f2");
|
|
|
|
|
|
|
|
|
|
document.body.style.setProperty(`--header-container-background`, "linear-gradient(270deg, var(--color2) 0%, var(--color3) 23.44%, var(--color4) 78.13%, var(--color5) 100%) !important");
|
|
|
|
|
document.body.style.setProperty(`--headercolor`, "#000");
|
|
|
|
|
|
|
|
|
|
document.body.style.setProperty(`--header-bottom-line-background`, "linear-gradient(270deg, var(--color2) 0%, var(--color3) 23.44%, var(--color4) 78.13%, var(--color5) 100%) !important");
|
|
|
|
|
document.body.style.setProperty(`--header-bottom-line-background-image`, "linear-gradient(270deg, var(--color2) 0%, var(--color3) 23.44%, var(--color4) 78.13%, var(--color5) 100%) !important");
|
|
|
|
|
|
2021-10-22 14:00:07 +01:00
|
|
|
document.body.style.setProperty(`--login-background`, "linear-gradient(180deg, #42b9fe 0%, #0782c9 100%) !importantt");
|
|
|
|
|
document.body.style.setProperty(`--button-hover`, "#42b9fe");
|
|
|
|
|
document.body.style.setProperty(`--inicio-open-page-from-box`, "#42b9fe");
|
|
|
|
|
document.body.style.setProperty(`--header-tab-top-border`, "white");
|
|
|
|
|
document.body.style.setProperty(`--header-tab-text-white`, "white");
|
|
|
|
|
|
2021-10-20 17:46:03 +01:00
|
|
|
}
|
2021-10-21 16:24:49 +01:00
|
|
|
|
|
|
|
|
default() {
|
|
|
|
|
document.body.style.setProperty(`--color`, "#0782C9");
|
|
|
|
|
document.body.style.setProperty(`--color2`, "#45BAFF");
|
|
|
|
|
document.body.style.setProperty(`--color3`, "#0782C9");
|
|
|
|
|
document.body.style.setProperty(`--color4`, "#0782c9f0");
|
|
|
|
|
document.body.style.setProperty(`--color5`, "#45BAFF");
|
|
|
|
|
}
|
2021-01-18 16:24:57 +01:00
|
|
|
}
|