injection parameter strings

This commit is contained in:
Kyle Spearrin 2018-01-15 20:28:33 -05:00
parent fa9bfa915d
commit 0bfd4329b0
6 changed files with 71 additions and 57 deletions

View File

@ -44,6 +44,10 @@ export class ActionButtonsController implements ng.IController {
} }
} }
ActionButtonsController.$inject = ['i18nService', '$analytics', 'constantsService', 'toastr',
'$timeout', '$window'];
export const ActionButtonsComponent = { export const ActionButtonsComponent = {
bindings: { bindings: {
cipher: '<', cipher: '<',

View File

@ -19,6 +19,8 @@ export class CipherItemsController implements ng.IController {
} }
} }
CipherItemsController.$inject = ['i18nService'];
export const CipherItemsComponent = { export const CipherItemsComponent = {
bindings: { bindings: {
ciphers: '<', ciphers: '<',

View File

@ -79,6 +79,8 @@ export class IconController implements ng.IController {
} }
} }
IconController.$inject = ['stateService', 'environmentService'];
export const IconComponent = { export const IconComponent = {
bindings: { bindings: {
cipher: '<', cipher: '<',

View File

@ -55,8 +55,8 @@ export class CurrentController {
this.loadVault(); this.loadVault();
} }
refresh() { async refresh() {
this.loadVault(); await this.loadVault();
} }
addCipher() { addCipher() {
@ -106,63 +106,61 @@ export class CurrentController {
}); });
} }
private loadVault() { private async loadVault() {
BrowserApi.getTabFromCurrentWindow().then((tab: any) => { const tab = await BrowserApi.getTabFromCurrentWindow();
if (tab) { if (tab) {
this.url = tab.url; this.url = tab.url;
} else { } else {
this.$timeout(() => { this.$timeout(() => {
this.loaded = true; this.loaded = true;
}); });
return; return;
}
this.domain = this.platformUtilsService.getDomain(this.url);
BrowserApi.tabSendMessage(tab, {
command: 'collectPageDetails',
tab: tab,
sender: 'currentController',
}).then(() => {
this.canAutofill = true;
});
const otherTypes = [
CipherType.Card,
CipherType.Identity,
];
const ciphers = await this.cipherService.getAllDecryptedForDomain(this.domain, otherTypes);
const loginCiphers: any = [];
const cardCiphers: any = [];
const identityCiphers: any = [];
const sortedCiphers = this.$filter('orderBy')(ciphers,
[this.sortUriMatch, this.sortLastUsed, 'name', 'subTitle']);
sortedCiphers.forEach((cipher: any) => {
switch (cipher.type) {
case CipherType.Login:
loginCiphers.push(cipher);
break;
case CipherType.Card:
cardCiphers.push(cipher);
break;
case CipherType.Identity:
identityCiphers.push(cipher);
break;
default:
break;
} }
});
this.domain = this.platformUtilsService.getDomain(this.url); this.$timeout(() => {
this.loginCiphers = loginCiphers;
BrowserApi.tabSendMessage(tab, { this.cardCiphers = cardCiphers;
command: 'collectPageDetails', this.identityCiphers = identityCiphers;
tab: tab, this.loaded = true;
sender: 'currentController',
}).then(() => {
this.canAutofill = true;
});
const otherTypes = [
CipherType.Card,
CipherType.Identity,
];
this.cipherService.getAllDecryptedForDomain(this.domain, otherTypes).then((ciphers: any[]) => {
const loginCiphers: any = [];
const cardCiphers: any = [];
const identityCiphers: any = [];
const sortedCiphers = this.$filter('orderBy')(ciphers,
[this.sortUriMatch, this.sortLastUsed, 'name', 'subTitle']);
sortedCiphers.forEach((cipher: any) => {
switch (cipher.type) {
case CipherType.Login:
loginCiphers.push(cipher);
break;
case CipherType.Card:
cardCiphers.push(cipher);
break;
case CipherType.Identity:
identityCiphers.push(cipher);
break;
default:
break;
}
});
this.$timeout(() => {
this.loginCiphers = loginCiphers;
this.cardCiphers = cardCiphers;
this.identityCiphers = identityCiphers;
this.loaded = true;
});
});
}); });
} }
@ -176,6 +174,10 @@ export class CurrentController {
} }
} }
CurrentController.$inject = ['$scope', 'cipherService', 'platformUtilsService', 'utilsService',
'toastr', '$window', '$state', '$timeout', 'autofillService', '$analytics', 'i18nService',
'$filter'];
export const CurrentComponent = { export const CurrentComponent = {
bindings: {}, bindings: {},
controller: CurrentController, controller: CurrentController,

View File

@ -4,3 +4,5 @@ export class TabsController implements ng.IController {
$scope.i18n = i18nService; $scope.i18n = i18nService;
} }
} }
TabsController.$inject = ['$scope', '$state', 'i18nService'];

View File

@ -40,6 +40,8 @@ export class SyncController {
} }
} }
SyncController.$inject = ['syncService', 'toastr', '$analytics', 'i18nService', '$timeout'];
export const SyncComponent = { export const SyncComponent = {
bindings: {}, bindings: {},
controller: SyncController, controller: SyncController,