diff --git a/src/popup/accounts/home.component.ts b/src/popup/accounts/home.component.ts index 04b4938249..7f3b2fa0dd 100644 --- a/src/popup/accounts/home.component.ts +++ b/src/popup/accounts/home.component.ts @@ -1,10 +1,11 @@ import { Component } from '@angular/core'; import { ConstantsService } from 'jslib/services/constants.service'; + import { CryptoFunctionService } from 'jslib/abstractions/cryptoFunction.service'; import { EnvironmentService } from 'jslib/abstractions/environment.service'; -import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service'; +import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { StorageService } from 'jslib/abstractions/storage.service'; import { Utils } from 'jslib/misc/utils'; diff --git a/src/popup/accounts/two-factor.component.ts b/src/popup/accounts/two-factor.component.ts index 57aef6e4d9..7624d642f1 100644 --- a/src/popup/accounts/two-factor.component.ts +++ b/src/popup/accounts/two-factor.component.ts @@ -25,6 +25,7 @@ import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; import { TwoFactorComponent as BaseTwoFactorComponent } from 'jslib/angular/components/two-factor.component'; import { PopupUtilsService } from '../services/popup-utils.service'; + import { BrowserApi } from '../../browser/browserApi'; const BroadcasterSubscriptionId = 'TwoFactorComponent'; @@ -81,7 +82,7 @@ export class TwoFactorComponent extends BaseTwoFactorComponent { } } - const queryParamsSub = this.route.queryParams.subscribe(async (qParams) => { + const queryParamsSub = this.route.queryParams.subscribe(async qParams => { if (qParams.sso === 'true') { super.onSuccessfulLogin = () => { BrowserApi.reloadOpenWindows(); diff --git a/src/popup/send/send-add-edit.component.ts b/src/popup/send/send-add-edit.component.ts index 4823f8027f..80f6289a7e 100644 --- a/src/popup/send/send-add-edit.component.ts +++ b/src/popup/send/send-add-edit.component.ts @@ -73,7 +73,7 @@ export class SendAddEditComponent extends BaseAddEditComponent { this.inPopout = this.popupUtilsService.inPopout(window); this.inSidebar = this.popupUtilsService.inSidebar(window); - const queryParamsSub = this.route.queryParams.subscribe(async (params) => { + const queryParamsSub = this.route.queryParams.subscribe(async params => { if (params.sendId) { this.sendId = params.sendId; } diff --git a/src/popup/services/services.module.ts b/src/popup/services/services.module.ts index d3cbd23230..41b0d80ece 100644 --- a/src/popup/services/services.module.ts +++ b/src/popup/services/services.module.ts @@ -20,8 +20,8 @@ import { AuditService } from 'jslib/abstractions/audit.service'; import { AuthService as AuthServiceAbstraction } from 'jslib/abstractions/auth.service'; import { CipherService } from 'jslib/abstractions/cipher.service'; import { CollectionService } from 'jslib/abstractions/collection.service'; -import { CryptoFunctionService } from 'jslib/abstractions/cryptoFunction.service'; import { CryptoService } from 'jslib/abstractions/crypto.service'; +import { CryptoFunctionService } from 'jslib/abstractions/cryptoFunction.service'; import { EnvironmentService } from 'jslib/abstractions/environment.service'; import { EventService } from 'jslib/abstractions/event.service'; import { ExportService } from 'jslib/abstractions/export.service'; @@ -47,10 +47,10 @@ import { AutofillService } from '../../services/abstractions/autofill.service'; import BrowserMessagingService from '../../services/browserMessaging.service'; import { AuthService } from 'jslib/services/auth.service'; +import { ConsoleLogService } from 'jslib/services/consoleLog.service'; import { ConstantsService } from 'jslib/services/constants.service'; import { SearchService } from 'jslib/services/search.service'; import { StateService } from 'jslib/services/state.service'; -import { ConsoleLogService } from 'jslib/services/consoleLog.service'; import { Analytics } from 'jslib/misc/analytics'; @@ -93,9 +93,9 @@ export function initFactory(platformUtilsService: PlatformUtilsService, i18nServ if (theme == null) { theme = platformUtilsService.getDefaultSystemTheme(); - platformUtilsService.onDefaultSystemThemeChange((theme) => { + platformUtilsService.onDefaultSystemThemeChange(sysTheme => { window.document.documentElement.classList.remove('theme_light', 'theme_dark'); - window.document.documentElement.classList.add('theme_' + theme); + window.document.documentElement.classList.add('theme_' + sysTheme); }); } window.document.documentElement.classList.add('locale_' + i18nService.translationLocale); diff --git a/src/popup/settings/excluded-domains.component.ts b/src/popup/settings/excluded-domains.component.ts index 57bfa0bb02..33ebfd2fa8 100644 --- a/src/popup/settings/excluded-domains.component.ts +++ b/src/popup/settings/excluded-domains.component.ts @@ -1,18 +1,22 @@ import { Component, + NgZone, OnDestroy, OnInit, - NgZone } from '@angular/core'; + import { Router } from '@angular/router'; +import { ConstantsService } from 'jslib/services/constants.service'; + import { I18nService } from 'jslib/abstractions/i18n.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { StorageService } from 'jslib/abstractions/storage.service'; -import { ConstantsService } from 'jslib/services/constants.service'; + import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; import { BrowserApi } from '../../browser/browserApi'; + import { Utils } from 'jslib/misc/utils'; interface ExcludedDomain { @@ -104,7 +108,7 @@ export class ExcludedDomainsComponent implements OnInit, OnDestroy { async loadCurrentUris() { const tabs = await BrowserApi.tabsQuery({ windowType: 'normal' }); if (tabs) { - const uriSet = new Set(tabs.map((tab) => Utils.getHostname(tab.url))); + const uriSet = new Set(tabs.map(tab => Utils.getHostname(tab.url))); uriSet.delete(null); this.currentUris = Array.from(uriSet); } diff --git a/src/popup/settings/folder-add-edit.component.ts b/src/popup/settings/folder-add-edit.component.ts index dc7727d8dd..bf313c82a3 100644 --- a/src/popup/settings/folder-add-edit.component.ts +++ b/src/popup/settings/folder-add-edit.component.ts @@ -24,7 +24,7 @@ export class FolderAddEditComponent extends BaseFolderAddEditComponent { } async ngOnInit() { - const queryParamsSub = this.route.queryParams.subscribe(async (params) => { + const queryParamsSub = this.route.queryParams.subscribe(async params => { if (params.folderId) { this.folderId = params.folderId; } diff --git a/src/popup/settings/settings.component.ts b/src/popup/settings/settings.component.ts index cddb5c07f8..be4e6f1923 100644 --- a/src/popup/settings/settings.component.ts +++ b/src/popup/settings/settings.component.ts @@ -214,8 +214,8 @@ export class SettingsComponent implements OnInit { // Request permission to use the optional permission for nativeMessaging if (!this.platformUtilsService.isFirefox()) { - const hasPermission = await new Promise((resolve) => { - chrome.permissions.contains({permissions: ['nativeMessaging']}, resolve); + const hasPermission = await new Promise(resolve => { + chrome.permissions.contains({ permissions: ['nativeMessaging'] }, resolve); }); if (!hasPermission) { @@ -224,9 +224,9 @@ export class SettingsComponent implements OnInit { this.i18nService.t('ok'), null); const granted = await new Promise((resolve, reject) => { - chrome.permissions.request({permissions: ['nativeMessaging']}, resolve); + chrome.permissions.request({ permissions: ['nativeMessaging'] }, resolve); }); - + if (!granted) { await this.platformUtilsService.showDialog( this.i18nService.t('nativeMessaginPermissionErrorDesc'), this.i18nService.t('nativeMessaginPermissionErrorTitle'), @@ -254,23 +254,23 @@ export class SettingsComponent implements OnInit { await this.cryptoService.toggleKey(); await Promise.race([ - submitted.then((result) => { + submitted.then(result => { if (result.dismiss === Swal.DismissReason.cancel) { this.biometric = false; this.storageService.remove(ConstantsService.biometricAwaitingAcceptance); } }), - this.platformUtilsService.authenticateBiometric().then((result) => { + this.platformUtilsService.authenticateBiometric().then(result => { this.biometric = result; Swal.close(); if (this.biometric === false) { this.platformUtilsService.showToast('error', this.i18nService.t('errorEnableBiometricTitle'), this.i18nService.t('errorEnableBiometricDesc')); } - }).catch((e) => { + }).catch(e => { // Handle connection errors this.biometric = false; - }) + }), ]); } else { await this.storageService.remove(ConstantsService.biometricUnlockKey); diff --git a/src/popup/vault/add-edit.component.ts b/src/popup/vault/add-edit.component.ts index 01f159d7a8..0e28beab41 100644 --- a/src/popup/vault/add-edit.component.ts +++ b/src/popup/vault/add-edit.component.ts @@ -49,7 +49,7 @@ export class AddEditComponent extends BaseAddEditComponent { async ngOnInit() { await super.ngOnInit(); - const queryParamsSub = this.route.queryParams.subscribe(async (params) => { + const queryParamsSub = this.route.queryParams.subscribe(async params => { if (params.cipherId) { this.cipherId = params.cipherId; } @@ -57,7 +57,7 @@ export class AddEditComponent extends BaseAddEditComponent { this.folderId = params.folderId; } if (params.collectionId) { - const collection = this.writeableCollections.find((c) => c.id === params.collectionId); + const collection = this.writeableCollections.find(c => c.id === params.collectionId); if (collection != null) { this.collectionIds = [collection.id]; this.organizationId = collection.organizationId; @@ -92,7 +92,7 @@ export class AddEditComponent extends BaseAddEditComponent { if (!this.editMode) { const tabs = await BrowserApi.tabsQuery({ windowType: 'normal' }); this.currentUris = tabs == null ? null : - tabs.filter((tab) => tab.url != null && tab.url !== '').map((tab) => tab.url); + tabs.filter(tab => tab.url != null && tab.url !== '').map(tab => tab.url); } window.setTimeout(() => { @@ -150,7 +150,7 @@ export class AddEditComponent extends BaseAddEditComponent { this.stateService.save('addEditCipherInfo', { cipher: this.cipher, collectionIds: this.collections == null ? [] : - this.collections.filter((c) => (c as any).checked).map((c) => c.id), + this.collections.filter(c => (c as any).checked).map(c => c.id), }); this.router.navigate(['generator']); } diff --git a/src/popup/vault/attachments.component.ts b/src/popup/vault/attachments.component.ts index fe4714132e..152c06d70d 100644 --- a/src/popup/vault/attachments.component.ts +++ b/src/popup/vault/attachments.component.ts @@ -25,7 +25,7 @@ export class AttachmentsComponent extends BaseAttachmentsComponent { } async ngOnInit() { - const queryParamsSub = this.route.queryParams.subscribe(async (params) => { + const queryParamsSub = this.route.queryParams.subscribe(async params => { this.cipherId = params.cipherId; await this.init(); if (queryParamsSub != null) { diff --git a/src/popup/vault/ciphers.component.ts b/src/popup/vault/ciphers.component.ts index a241102a4b..0087347aad 100644 --- a/src/popup/vault/ciphers.component.ts +++ b/src/popup/vault/ciphers.component.ts @@ -73,7 +73,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On async ngOnInit() { this.searchTypeSearch = !this.platformUtilsService.isSafari(); - const queryParamsSub = this.route.queryParams.subscribe(async (params) => { + const queryParamsSub = this.route.queryParams.subscribe(async params => { if (this.applySavedState) { this.state = (await this.stateService.get(ComponentId)) || {}; if (this.state.searchText) { @@ -104,7 +104,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On default: break; } - await this.load((c) => c.type === this.type); + await this.load(c => c.type === this.type); } else if (params.folderId) { this.folderId = params.folderId === 'none' ? null : params.folderId; this.searchPlaceholder = this.i18nService.t('searchFolder'); @@ -118,7 +118,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On } else { this.groupingTitle = this.i18nService.t('noneFolder'); } - await this.load((c) => c.folderId === this.folderId); + await this.load(c => c.folderId === this.folderId); } else if (params.collectionId) { this.collectionId = params.collectionId; this.searchPlaceholder = this.i18nService.t('searchCollection'); @@ -128,7 +128,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On this.nestedCollections = collectionNode.children != null && collectionNode.children.length > 0 ? collectionNode.children : null; } - await this.load((c) => c.collectionIds != null && c.collectionIds.indexOf(this.collectionId) > -1); + await this.load(c => c.collectionIds != null && c.collectionIds.indexOf(this.collectionId) > -1); } else { this.groupingTitle = this.i18nService.t('allItems'); await this.load(); diff --git a/src/popup/vault/collections.component.ts b/src/popup/vault/collections.component.ts index 573e2fd0e4..0d52124df0 100644 --- a/src/popup/vault/collections.component.ts +++ b/src/popup/vault/collections.component.ts @@ -24,7 +24,7 @@ export class CollectionsComponent extends BaseCollectionsComponent { this.onSavedCollections.subscribe(() => { this.back(); }); - const queryParamsSub = this.route.queryParams.subscribe(async (params) => { + const queryParamsSub = this.route.queryParams.subscribe(async params => { this.cipherId = params.cipherId; await this.load(); if (queryParamsSub != null) { diff --git a/src/popup/vault/current-tab.component.ts b/src/popup/vault/current-tab.component.ts index 1baa178f4d..2430b6ef07 100644 --- a/src/popup/vault/current-tab.component.ts +++ b/src/popup/vault/current-tab.component.ts @@ -212,7 +212,7 @@ export class CurrentTabComponent implements OnInit, OnDestroy { this.cardCiphers = []; this.identityCiphers = []; - ciphers.forEach((c) => { + ciphers.forEach(c => { switch (c.type) { case CipherType.Login: this.loginCiphers.push(c); diff --git a/src/popup/vault/groupings.component.ts b/src/popup/vault/groupings.component.ts index 5c6c2bc79a..ab2a9c0681 100644 --- a/src/popup/vault/groupings.component.ts +++ b/src/popup/vault/groupings.component.ts @@ -112,7 +112,7 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit }); const restoredScopeState = await this.restoreState(); - const queryParamsSub = this.route.queryParams.subscribe(async (params) => { + const queryParamsSub = this.route.queryParams.subscribe(async params => { this.state = (await this.stateService.get(ComponentId)) || {}; if (this.state.searchText) { this.searchText = this.state.searchText; @@ -167,7 +167,7 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit if (!this.hasLoadedAllCiphers) { this.hasLoadedAllCiphers = !this.searchService.isSearchable(this.searchText); } - this.deletedCount = this.allCiphers.filter((c) => c.isDeleted).length; + this.deletedCount = this.allCiphers.filter(c => c.isDeleted).length; await this.search(null); let favoriteCiphers: CipherView[] = null; let noFolderCiphers: CipherView[] = null; @@ -175,7 +175,7 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit const collectionCounts = new Map(); const typeCounts = new Map(); - this.ciphers.forEach((c) => { + this.ciphers.forEach(c => { if (c.isDeleted) { return; } @@ -206,7 +206,7 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit } if (c.collectionIds != null) { - c.collectionIds.forEach((colId) => { + c.collectionIds.forEach(colId => { if (collectionCounts.has(colId)) { collectionCounts.set(colId, collectionCounts.get(colId) + 1); } else { diff --git a/src/popup/vault/password-history.component.ts b/src/popup/vault/password-history.component.ts index 811ba76e69..ecf64a0dd0 100644 --- a/src/popup/vault/password-history.component.ts +++ b/src/popup/vault/password-history.component.ts @@ -22,7 +22,7 @@ export class PasswordHistoryComponent extends BasePasswordHistoryComponent { } async ngOnInit() { - const queryParamsSub = this.route.queryParams.subscribe(async (params) => { + const queryParamsSub = this.route.queryParams.subscribe(async params => { if (params.cipherId) { this.cipherId = params.cipherId; } else { diff --git a/src/popup/vault/share.component.ts b/src/popup/vault/share.component.ts index 230e27ac86..d467b51df5 100644 --- a/src/popup/vault/share.component.ts +++ b/src/popup/vault/share.component.ts @@ -29,7 +29,7 @@ export class ShareComponent extends BaseShareComponent { this.onSharedCipher.subscribe(() => { this.router.navigate(['view-cipher', { cipherId: this.cipherId }]); }); - const queryParamsSub = this.route.queryParams.subscribe(async (params) => { + const queryParamsSub = this.route.queryParams.subscribe(async params => { this.cipherId = params.cipherId; await this.load(); if (queryParamsSub != null) { diff --git a/src/popup/vault/view.component.ts b/src/popup/vault/view.component.ts index 4622e200d5..facde21fc3 100644 --- a/src/popup/vault/view.component.ts +++ b/src/popup/vault/view.component.ts @@ -57,7 +57,7 @@ export class ViewComponent extends BaseViewComponent { ngOnInit() { this.inPopout = this.popupUtilsService.inPopout(window); - const queryParamsSub = this.route.queryParams.subscribe(async (params) => { + const queryParamsSub = this.route.queryParams.subscribe(async params => { if (params.cipherId) { this.cipherId = params.cipherId; } else { @@ -155,7 +155,7 @@ export class ViewComponent extends BaseViewComponent { if (this.cipher.login.uris == null) { this.cipher.login.uris = []; } else { - if (this.cipher.login.uris.some((uri) => uri.uri === this.tab.url)) { + if (this.cipher.login.uris.some(uri => uri.uri === this.tab.url)) { this.platformUtilsService.showToast('success', null, this.i18nService.t('autoFillSuccessAndSavedUri')); return; diff --git a/src/services/vaultTimeout.service.ts b/src/services/vaultTimeout.service.ts index a36970e0de..8764155af0 100644 --- a/src/services/vaultTimeout.service.ts +++ b/src/services/vaultTimeout.service.ts @@ -16,12 +16,13 @@ export default class VaultTimeoutService extends BaseVaultTimeoutService { // setIntervals. It works by calling the native extension which sleeps for 10s, // efficiently replicating setInterval. async checkSafari() { - while(true) { + while (true) { try { await SafariApp.sendMessageToApp('sleep'); this.checkVaultTimeout(); - } catch(e) { - console.log("Exception Safari VaultTimeout", e); + } catch (e) { + // tslint:disable-next-line + console.log('Exception Safari VaultTimeout', e); } } }