1
0
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:
Kyle Spearrin 2018-01-11 14:09:38 -05:00
parent 482a1c6d57
commit e2267d29a3
3 changed files with 18 additions and 13 deletions

View File

@ -1,5 +1,7 @@
import * as template from './action-buttons.component.html'; import * as template from './action-buttons.component.html';
import { ConstantsService } from 'jslib/services/constants.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
export class ActionButtonsController implements ng.IController { export class ActionButtonsController implements ng.IController {
@ -8,10 +10,10 @@ export class ActionButtonsController implements ng.IController {
cipher: any; cipher: any;
showView: boolean; showView: boolean;
i18n: any; i18n: any;
constants: any; constants: ConstantsService;
constructor(private i18nService: any, private $analytics: any, private constantsService: any, private toastr: any, constructor(private i18nService: any, private $analytics: any, private constantsService: ConstantsService,
private $timeout: any, private $window: any, private toastr: any, private $timeout: ng.ITimeoutService, private $window: ng.IWindowService,
private platformUtilsService: PlatformUtilsService) { private platformUtilsService: PlatformUtilsService) {
this.i18n = i18nService; this.i18n = i18nService;
this.constants = constantsService; this.constants = constantsService;

View File

@ -1,5 +1,9 @@
import * as template from './icon.component.html'; 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 { export class IconController implements ng.IController {
cipher: any; cipher: any;
icon: string; icon: string;
@ -9,7 +13,7 @@ export class IconController implements ng.IController {
private iconsUrl: string; 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.imageEnabled = stateService.getState('faviconEnabled');
this.iconsUrl = environmentService.iconsUrl; this.iconsUrl = environmentService.iconsUrl;
@ -24,17 +28,17 @@ export class IconController implements ng.IController {
$onChanges() { $onChanges() {
switch (this.cipher.type) { switch (this.cipher.type) {
case this.constantsService.cipherType.login: case CipherType.Login:
this.icon = 'fa-globe'; this.icon = 'fa-globe';
this.setLoginIcon(); this.setLoginIcon();
break; break;
case this.constantsService.cipherType.secureNote: case CipherType.SecureNote:
this.icon = 'fa-sticky-note-o'; this.icon = 'fa-sticky-note-o';
break; break;
case this.constantsService.cipherType.card: case CipherType.Card:
this.icon = 'fa-credit-card'; this.icon = 'fa-credit-card';
break; break;
case this.constantsService.cipherType.identity: case CipherType.Identity:
this.icon = 'fa-id-card-o'; this.icon = 'fa-id-card-o';
break; break;
default: default:

View File

@ -5,9 +5,8 @@ import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
export class PopOutController implements ng.IController { export class PopOutController implements ng.IController {
i18n: any; i18n: any;
constructor(private $analytics: any, private $window: any, constructor(private $analytics: any, private $window: ng.IWindowService,
private platformUtilsService: PlatformUtilsService, private platformUtilsService: PlatformUtilsService, private i18nService: any) {
private i18nService: any) {
this.i18n = i18nService; 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) { if (href.indexOf('?uilocation=') > -1) {
href = href.replace('uilocation=popup', 'uilocation=popout') href = href.replace('uilocation=popup', 'uilocation=popout')
.replace('uilocation=tab', 'uilocation=popout') .replace('uilocation=tab', 'uilocation=popout')
@ -43,7 +42,7 @@ export class PopOutController implements ng.IController {
if (this.platformUtilsService.inPopup(this.$window)) { if (this.platformUtilsService.inPopup(this.$window)) {
this.$window.close(); this.$window.close();
} }
} else { } else if (chrome && chrome.tabs && chrome.tabs.create) {
href = href.replace('uilocation=popup', 'uilocation=tab') href = href.replace('uilocation=popup', 'uilocation=tab')
.replace('uilocation=popout', 'uilocation=tab') .replace('uilocation=popout', 'uilocation=tab')
.replace('uilocation=sidebar', 'uilocation=tab'); .replace('uilocation=sidebar', 'uilocation=tab');