diff --git a/src/popup/app/components/action-buttons.component.ts b/src/popup/app/components/action-buttons.component.ts index 769ed4bf5a6..2e0ba01c7fb 100644 --- a/src/popup/app/components/action-buttons.component.ts +++ b/src/popup/app/components/action-buttons.component.ts @@ -1,5 +1,7 @@ import * as template from './action-buttons.component.html'; +import { ConstantsService } from 'jslib/services/constants.service'; + import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; export class ActionButtonsController implements ng.IController { @@ -8,10 +10,10 @@ export class ActionButtonsController implements ng.IController { cipher: any; showView: boolean; i18n: any; - constants: any; + constants: ConstantsService; - constructor(private i18nService: any, private $analytics: any, private constantsService: any, private toastr: any, - private $timeout: any, private $window: any, + constructor(private i18nService: any, private $analytics: any, private constantsService: ConstantsService, + private toastr: any, private $timeout: ng.ITimeoutService, private $window: ng.IWindowService, private platformUtilsService: PlatformUtilsService) { this.i18n = i18nService; this.constants = constantsService; diff --git a/src/popup/app/components/icon.component.ts b/src/popup/app/components/icon.component.ts index de3c0dc8770..6abed57f087 100644 --- a/src/popup/app/components/icon.component.ts +++ b/src/popup/app/components/icon.component.ts @@ -1,5 +1,9 @@ import * as template from './icon.component.html'; +import { CipherType } from 'jslib/enums/cipherType'; + +import { EnvironmentService } from 'jslib/abstractions/environment.service'; + export class IconController implements ng.IController { cipher: any; icon: string; @@ -9,7 +13,7 @@ export class IconController implements ng.IController { private iconsUrl: string; - constructor(private stateService: any, private constantsService: any, private environmentService: any) { + constructor(private stateService: any, private environmentService: EnvironmentService) { this.imageEnabled = stateService.getState('faviconEnabled'); this.iconsUrl = environmentService.iconsUrl; @@ -24,17 +28,17 @@ export class IconController implements ng.IController { $onChanges() { switch (this.cipher.type) { - case this.constantsService.cipherType.login: + case CipherType.Login: this.icon = 'fa-globe'; this.setLoginIcon(); break; - case this.constantsService.cipherType.secureNote: + case CipherType.SecureNote: this.icon = 'fa-sticky-note-o'; break; - case this.constantsService.cipherType.card: + case CipherType.Card: this.icon = 'fa-credit-card'; break; - case this.constantsService.cipherType.identity: + case CipherType.Identity: this.icon = 'fa-id-card-o'; break; default: diff --git a/src/popup/app/components/pop-out.component.ts b/src/popup/app/components/pop-out.component.ts index 4e4ecd5339c..a5c388ae584 100644 --- a/src/popup/app/components/pop-out.component.ts +++ b/src/popup/app/components/pop-out.component.ts @@ -5,9 +5,8 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; export class PopOutController implements ng.IController { i18n: any; - constructor(private $analytics: any, private $window: any, - private platformUtilsService: PlatformUtilsService, - private i18nService: any) { + constructor(private $analytics: any, private $window: ng.IWindowService, + private platformUtilsService: PlatformUtilsService, private i18nService: any) { this.i18n = i18nService; } @@ -22,7 +21,7 @@ export class PopOutController implements ng.IController { } } - if (chrome.windows.create) { + if (chrome && chrome.windows && chrome.windows.create) { if (href.indexOf('?uilocation=') > -1) { href = href.replace('uilocation=popup', 'uilocation=popout') .replace('uilocation=tab', 'uilocation=popout') @@ -43,7 +42,7 @@ export class PopOutController implements ng.IController { if (this.platformUtilsService.inPopup(this.$window)) { this.$window.close(); } - } else { + } else if (chrome && chrome.tabs && chrome.tabs.create) { href = href.replace('uilocation=popup', 'uilocation=tab') .replace('uilocation=popout', 'uilocation=tab') .replace('uilocation=sidebar', 'uilocation=tab');