mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
add types to components
This commit is contained in:
parent
482a1c6d57
commit
e2267d29a3
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user