diff --git a/src/popup/app/components/action-buttons.component.ts b/src/popup/app/components/action-buttons.component.ts index 5ebc6480d0..74ce1d56ae 100644 --- a/src/popup/app/components/action-buttons.component.ts +++ b/src/popup/app/components/action-buttons.component.ts @@ -44,6 +44,10 @@ export class ActionButtonsController implements ng.IController { } } + +ActionButtonsController.$inject = ['i18nService', '$analytics', 'constantsService', 'toastr', + '$timeout', '$window']; + export const ActionButtonsComponent = { bindings: { cipher: '<', diff --git a/src/popup/app/components/cipher-items.component.ts b/src/popup/app/components/cipher-items.component.ts index c6387c0a26..899bacbde9 100644 --- a/src/popup/app/components/cipher-items.component.ts +++ b/src/popup/app/components/cipher-items.component.ts @@ -19,6 +19,8 @@ export class CipherItemsController implements ng.IController { } } +CipherItemsController.$inject = ['i18nService']; + export const CipherItemsComponent = { bindings: { ciphers: '<', diff --git a/src/popup/app/components/icon.component.ts b/src/popup/app/components/icon.component.ts index eabbb2c589..6962e37288 100644 --- a/src/popup/app/components/icon.component.ts +++ b/src/popup/app/components/icon.component.ts @@ -79,6 +79,8 @@ export class IconController implements ng.IController { } } +IconController.$inject = ['stateService', 'environmentService']; + export const IconComponent = { bindings: { cipher: '<', diff --git a/src/popup/app/current/current.component.ts b/src/popup/app/current/current.component.ts index 1729577391..a16a8d6072 100644 --- a/src/popup/app/current/current.component.ts +++ b/src/popup/app/current/current.component.ts @@ -55,8 +55,8 @@ export class CurrentController { this.loadVault(); } - refresh() { - this.loadVault(); + async refresh() { + await this.loadVault(); } addCipher() { @@ -106,63 +106,61 @@ export class CurrentController { }); } - private loadVault() { - BrowserApi.getTabFromCurrentWindow().then((tab: any) => { - if (tab) { - this.url = tab.url; - } else { - this.$timeout(() => { - this.loaded = true; - }); - return; + private async loadVault() { + const tab = await BrowserApi.getTabFromCurrentWindow(); + if (tab) { + this.url = tab.url; + } else { + this.$timeout(() => { + this.loaded = true; + }); + 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); - - BrowserApi.tabSendMessage(tab, { - command: 'collectPageDetails', - tab: tab, - 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; - }); - }); + 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 = { bindings: {}, controller: CurrentController, diff --git a/src/popup/app/global/tabs.controller.ts b/src/popup/app/global/tabs.controller.ts index a910240f41..e0f76dc82e 100644 --- a/src/popup/app/global/tabs.controller.ts +++ b/src/popup/app/global/tabs.controller.ts @@ -4,3 +4,5 @@ export class TabsController implements ng.IController { $scope.i18n = i18nService; } } + +TabsController.$inject = ['$scope', '$state', 'i18nService']; diff --git a/src/popup/app/settings/sync.component.ts b/src/popup/app/settings/sync.component.ts index 2cf2ba07e8..0ed1ab8eba 100644 --- a/src/popup/app/settings/sync.component.ts +++ b/src/popup/app/settings/sync.component.ts @@ -40,6 +40,8 @@ export class SyncController { } } +SyncController.$inject = ['syncService', 'toastr', '$analytics', 'i18nService', '$timeout']; + export const SyncComponent = { bindings: {}, controller: SyncController,