1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-05 09:10:53 +01:00

icon load function

This commit is contained in:
Kyle Spearrin 2018-11-15 16:55:54 -05:00
parent da47faca5c
commit e13f317aad

View File

@ -37,7 +37,7 @@ export class IconComponent implements OnChanges {
private iconsUrl: string; private iconsUrl: string;
constructor(private environmentService: EnvironmentService, private stateService: StateService) { constructor(environmentService: EnvironmentService, protected stateService: StateService) {
this.iconsUrl = environmentService.iconsUrl; this.iconsUrl = environmentService.iconsUrl;
if (!this.iconsUrl) { if (!this.iconsUrl) {
if (environmentService.baseUrl) { if (environmentService.baseUrl) {
@ -49,8 +49,16 @@ export class IconComponent implements OnChanges {
} }
async ngOnChanges() { async ngOnChanges() {
console.log('load it changes');
this.imageEnabled = !(await this.stateService.get<boolean>(ConstantsService.disableFaviconKey)); this.imageEnabled = !(await this.stateService.get<boolean>(ConstantsService.disableFaviconKey));
this.load();
}
get iconCode(): string {
return IconMap[this.icon];
}
protected load() {
switch (this.cipher.type) { switch (this.cipher.type) {
case CipherType.Login: case CipherType.Login:
this.icon = 'fa-globe'; this.icon = 'fa-globe';
@ -70,10 +78,6 @@ export class IconComponent implements OnChanges {
} }
} }
get iconCode(): string {
return IconMap[this.icon];
}
private setLoginIcon() { private setLoginIcon() {
if (this.cipher.login.uri) { if (this.cipher.login.uri) {
let hostnameUri = this.cipher.login.uri; let hostnameUri = this.cipher.login.uri;