diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 9c2f2977f83..31870b98a3b 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -36,13 +36,14 @@ import UserService from '../services/user.service'; import UtilsService from '../services/utils.service'; import { MessagingService } from '../services/abstractions/messaging.service'; +import { PlatformUtilsService } from '../services/abstractions/platformUtils.service'; import { StorageService } from '../services/abstractions/storage.service'; export default class MainBackground { messagingService: MessagingService; storageService: StorageService; i18nService: any; - browserUtilsService: BrowserUtilsService; + platformUtilsService: PlatformUtilsService; utilsService: UtilsService; constantsService: ConstantsService; cryptoService: CryptoService; @@ -82,16 +83,16 @@ export default class MainBackground { constructor() { // Services this.utilsService = new UtilsService(); - this.browserUtilsService = new BrowserUtilsService(); - this.messagingService = new BrowserMessagingService(this.browserUtilsService); - this.storageService = new BrowserStorageService(this.browserUtilsService); - this.i18nService = i18nService(this.browserUtilsService); - this.constantsService = new ConstantsService(this.i18nService, this.browserUtilsService); + this.platformUtilsService = new BrowserUtilsService(); + this.messagingService = new BrowserMessagingService(this.platformUtilsService); + this.storageService = new BrowserStorageService(this.platformUtilsService); + this.i18nService = i18nService(this.platformUtilsService); + this.constantsService = new ConstantsService(this.i18nService, this.platformUtilsService); this.cryptoService = ContainerService.cryptoService = new CryptoService(this.storageService, this.storageService); this.tokenService = new TokenService(this.storageService); this.appIdService = new AppIdService(this.storageService); - this.apiService = new ApiService(this.tokenService, this.browserUtilsService, + this.apiService = new ApiService(this.tokenService, this.platformUtilsService, (expired: boolean) => this.logout(expired)); this.environmentService = new EnvironmentService(this.apiService, this.storageService); this.userService = new UserService(this.tokenService, this.storageService); @@ -102,7 +103,7 @@ export default class MainBackground { this.apiService, this.storageService); this.collectionService = new CollectionService(this.cryptoService, this.userService, this.storageService); this.lockService = new LockService(this.cipherService, this.folderService, this.collectionService, - this.cryptoService, this.browserUtilsService, this.storageService, + this.cryptoService, this.platformUtilsService, this.storageService, () => this.setIcon(), () => this.refreshBadgeAndMenu()); this.syncService = new SyncService(this.userService, this.apiService, this.settingsService, this.folderService, this.cipherService, this.cryptoService, this.collectionService, @@ -110,7 +111,7 @@ export default class MainBackground { this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService); this.totpService = new TotpService(this.storageService); this.autofillService = new AutofillService(this.cipherService, this.tokenService, - this.totpService, this.utilsService, this.browserUtilsService); + this.totpService, this.utilsService, this.platformUtilsService); // Other fields this.sidebarAction = (typeof opr !== 'undefined') && opr.sidebarAction ? @@ -121,9 +122,10 @@ export default class MainBackground { this.contextMenusBackground = new ContextMenusBackground(this, this.cipherService, this.passwordGenerationService); this.idleBackground = new IdleBackground(this, this.lockService, this.storageService); - this.runtimeBackground = new RuntimeBackground(this, this.autofillService, this.cipherService); + this.runtimeBackground = new RuntimeBackground(this, this.autofillService, this.cipherService, + this.platformUtilsService); this.tabsBackground = new TabsBackground(this); - this.webRequestBackground = new WebRequestBackground(this.browserUtilsService, this.cipherService); + this.webRequestBackground = new WebRequestBackground(this.platformUtilsService, this.cipherService); this.windowsBackground = new WindowsBackground(this); } @@ -262,7 +264,7 @@ export default class MainBackground { }); // Firefox & Edge do not support writing to the clipboard from background - if (!this.browserUtilsService.isFirefox() && !this.browserUtilsService.isEdge()) { + if (!this.platformUtilsService.isFirefox() && !this.platformUtilsService.isEdge()) { await this.contextMenusCreate({ type: 'normal', id: 'copy-username', @@ -306,7 +308,7 @@ export default class MainBackground { return; } - const tabDomain = BrowserUtilsService.getDomain(url); + const tabDomain = this.platformUtilsService.getDomain(url); if (tabDomain == null) { return; } @@ -381,7 +383,7 @@ export default class MainBackground { }); } - if (this.browserUtilsService.isFirefox()) { + if (this.platformUtilsService.isFirefox()) { // Firefox does not support writing to the clipboard from background return; } @@ -422,7 +424,7 @@ export default class MainBackground { return; } - const tabDomain = BrowserUtilsService.getDomain(tab.url); + const tabDomain = this.platformUtilsService.getDomain(tab.url); if (tabDomain == null) { return; } @@ -500,7 +502,7 @@ export default class MainBackground { }, }; - if (this.browserUtilsService.isFirefox()) { + if (this.platformUtilsService.isFirefox()) { await theAction.setIcon(options); } else { return new Promise((resolve) => { diff --git a/src/background/runtime.background.ts b/src/background/runtime.background.ts index 36a660ed691..8213cff93a7 100644 --- a/src/background/runtime.background.ts +++ b/src/background/runtime.background.ts @@ -5,17 +5,18 @@ import BrowserApi from '../browser/browserApi'; import MainBackground from './main.background'; import AutofillService from '../services/autofill.service'; -import BrowserUtilsService from '../services/browserUtils.service'; import CipherService from '../services/cipher.service'; import UtilsService from '../services/utils.service'; +import { PlatformUtilsService } from '../services/abstractions/platformUtils.service'; + export default class RuntimeBackground { private runtime: any; private autofillTimeout: number; private pageDetailsToAutoFill: any[] = []; constructor(private main: MainBackground, private autofillService: AutofillService, - private cipherService: CipherService) { + private cipherService: CipherService, private platformUtilsService: PlatformUtilsService) { this.runtime = chrome.runtime; } @@ -135,7 +136,7 @@ export default class RuntimeBackground { } const loginInfo = this.main.loginsToAdd[i]; - const tabDomain = BrowserUtilsService.getDomain(tab.url); + const tabDomain = this.platformUtilsService.getDomain(tab.url); if (tabDomain != null && tabDomain !== loginInfo.domain) { continue; } @@ -173,7 +174,7 @@ export default class RuntimeBackground { } const loginInfo = this.main.loginsToAdd[i]; - const tabDomain = BrowserUtilsService.getDomain(tab.url); + const tabDomain = this.platformUtilsService.getDomain(tab.url); if (tabDomain != null && tabDomain !== loginInfo.domain) { continue; } @@ -186,7 +187,7 @@ export default class RuntimeBackground { } private async addLogin(loginInfo: any, tab: any) { - const loginDomain = BrowserUtilsService.getDomain(loginInfo.url); + const loginDomain = this.platformUtilsService.getDomain(loginInfo.url); if (loginDomain == null) { return; } diff --git a/src/background/webRequest.background.ts b/src/background/webRequest.background.ts index ebf4d32dceb..9d2ed066b1e 100644 --- a/src/background/webRequest.background.ts +++ b/src/background/webRequest.background.ts @@ -1,14 +1,15 @@ -import BrowserUtilsService from '../services/browserUtils.service'; import CipherService from '../services/cipher.service'; +import { PlatformUtilsService } from '../services/abstractions/platformUtils.service'; + export default class WebRequestBackground { private pendingAuthRequests: any[] = []; private webRequest: any; private isFirefox: boolean; - constructor(browserUtilsService: BrowserUtilsService, private cipherService: CipherService) { + constructor(private platformUtilsService: PlatformUtilsService, private cipherService: CipherService) { this.webRequest = (window as any).chrome.webRequest; - this.isFirefox = browserUtilsService.isFirefox(); + this.isFirefox = platformUtilsService.isFirefox(); } async init() { @@ -24,7 +25,7 @@ export default class WebRequestBackground { return; } - const domain = BrowserUtilsService.getDomain(details.url); + const domain = this.platformUtilsService.getDomain(details.url); if (domain == null) { if (callback) { callback(); diff --git a/src/models/request/deviceRequest.ts b/src/models/request/deviceRequest.ts index 7a205043809..857ba7129e6 100644 --- a/src/models/request/deviceRequest.ts +++ b/src/models/request/deviceRequest.ts @@ -1,5 +1,5 @@ import { DeviceType } from '../../enums/deviceType.enum'; -import { BrowserUtilsService } from '../../services/abstractions/browserUtils.service'; +import { PlatformUtilsService } from '../../services/abstractions/platformUtils.service'; class DeviceRequest { type: DeviceType; @@ -7,9 +7,9 @@ class DeviceRequest { identifier: string; pushToken?: string; - constructor(appId: string, browserUtilsService: BrowserUtilsService) { - this.type = browserUtilsService.getDevice(); - this.name = browserUtilsService.getDeviceString(); + constructor(appId: string, platformUtilsService: PlatformUtilsService) { + this.type = platformUtilsService.getDevice(); + this.name = platformUtilsService.getDeviceString(); this.identifier = appId; this.pushToken = null; } diff --git a/src/popup/app/accounts/accountsHintController.js b/src/popup/app/accounts/accountsHintController.js index 62b2bb32045..f81c8e736b4 100644 --- a/src/popup/app/accounts/accountsHintController.js +++ b/src/popup/app/accounts/accountsHintController.js @@ -1,10 +1,10 @@ angular .module('bit.accounts') - .controller('accountsHintController', function ($scope, $state, apiService, toastr, $q, browserUtilsService, + .controller('accountsHintController', function ($scope, $state, apiService, toastr, $q, platformUtilsService, $analytics, i18nService, $timeout) { $timeout(function () { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); document.getElementById('email').focus(); }, 500); diff --git a/src/popup/app/accounts/accountsLoginController.js b/src/popup/app/accounts/accountsLoginController.js index c9a54cbba90..ed98a791ec1 100644 --- a/src/popup/app/accounts/accountsLoginController.js +++ b/src/popup/app/accounts/accountsLoginController.js @@ -2,9 +2,9 @@ angular .module('bit.accounts') .controller('accountsLoginController', function ($scope, $state, $stateParams, authService, userService, toastr, - browserUtilsService, $analytics, i18nService, $timeout) { + platformUtilsService, $analytics, i18nService, $timeout) { $timeout(function () { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); if ($stateParams.email) { document.getElementById('master-password').focus(); } diff --git a/src/popup/app/accounts/accountsLoginTwoFactorController.js b/src/popup/app/accounts/accountsLoginTwoFactorController.js index 9ef4b92f44a..4f384a30095 100644 --- a/src/popup/app/accounts/accountsLoginTwoFactorController.js +++ b/src/popup/app/accounts/accountsLoginTwoFactorController.js @@ -1,11 +1,11 @@ angular .module('bit.accounts') - .controller('accountsLoginTwoFactorController', function ($scope, $state, authService, toastr, browserUtilsService, SweetAlert, + .controller('accountsLoginTwoFactorController', function ($scope, $state, authService, toastr, platformUtilsService, $analytics, i18nService, $stateParams, $filter, constantsService, $timeout, $window, cryptoService, apiService, - environmentService) { + environmentService, SweetAlert) { $timeout(function () { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); }, 500); $scope.i18n = i18nService; @@ -130,7 +130,7 @@ angular var provider = $filter('filter')(constants.twoFactorProviderInfo, { type: keys[i], active: true }); if (provider.length && provider[0].priority > providerPriority) { if (provider[0].type == constants.twoFactorProvider.u2f && (typeof $window.u2f === 'undefined') && - !browserUtilsService.isChrome() && !browserUtilsService.isOpera()) { + !platformUtilsService.isChrome() && !platformUtilsService.isOpera()) { continue; } @@ -183,8 +183,9 @@ angular params = providers[constants.twoFactorProvider.email]; $scope.twoFactorEmail = params.Email; - if (chrome.extension.getViews({ type: 'popup' }).length > 0 && !browserUtilsService.inSidebar($window) && - !browserUtilsService.inTab($window) && !browserUtilsService.inPopout($window)) { + if (chrome.extension.getViews({ type: 'popup' }).length > 0 && + !platformUtilsService.inSidebar($window) && !platformUtilsService.inTab($window) && + !platformUtilsService.inPopout($window)) { SweetAlert.swal({ title: i18nService.twoStepLogin, text: i18nService.popup2faCloseMessage, diff --git a/src/popup/app/accounts/accountsRegisterController.js b/src/popup/app/accounts/accountsRegisterController.js index 52c2e7faebb..89943b84d8e 100644 --- a/src/popup/app/accounts/accountsRegisterController.js +++ b/src/popup/app/accounts/accountsRegisterController.js @@ -3,9 +3,10 @@ angular .controller( 'accountsRegisterController', - function ($scope, $state, cryptoService, toastr, $q, apiService, browserUtilsService, $analytics, i18nService, $timeout) { + function ($scope, $state, cryptoService, toastr, $q, apiService, platformUtilsService, $analytics, + i18nService, $timeout) { $timeout(function () { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); document.getElementById('email').focus(); }, 500); diff --git a/src/popup/app/accounts/accountsTwoFactorMethodsController.js b/src/popup/app/accounts/accountsTwoFactorMethodsController.js index 296bbb158ee..ce3d5288617 100644 --- a/src/popup/app/accounts/accountsTwoFactorMethodsController.js +++ b/src/popup/app/accounts/accountsTwoFactorMethodsController.js @@ -26,7 +26,7 @@ angular add(constants.twoFactorProvider.duo); } if (providers.hasOwnProperty(constants.twoFactorProvider.u2f) && - (browserUtilsService.isChrome() || browserUtilsService.isOpera())) { + (platformUtilsService.isChrome() || platformUtilsService.isOpera())) { add(constants.twoFactorProvider.u2f); } diff --git a/src/popup/app/components/action-buttons.component.ts b/src/popup/app/components/action-buttons.component.ts index 7ba92243cb8..020e7428f0c 100644 --- a/src/popup/app/components/action-buttons.component.ts +++ b/src/popup/app/components/action-buttons.component.ts @@ -1,6 +1,6 @@ import * as template from './action-buttons.component.html'; -import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service'; +import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service'; export class ActionButtonsController implements ng.IController { onView: Function; @@ -11,7 +11,7 @@ export class ActionButtonsController implements ng.IController { constants: any; constructor(private i18nService: any, private $analytics: any, private constantsService: any, private toastr: any, - private $timeout: any, private $window: any, private browserUtilsService: BrowserUtilsService) { + private $timeout: any, private $window: any, private platformUtilsService: PlatformUtilsService) { this.i18n = i18nService; this.constants = constantsService; } @@ -22,7 +22,7 @@ export class ActionButtonsController implements ng.IController { if (self.cipher.login.uri.startsWith('http://') || self.cipher.login.uri.startsWith('https://')) { self.$analytics.eventTrack('Launched Website From Listing'); chrome.tabs.create({ url: self.cipher.login.uri }); - if (self.browserUtilsService.inPopup(self.$window)) { + if (self.platformUtilsService.inPopup(self.$window)) { self.$window.close(); } } diff --git a/src/popup/app/components/pop-out.component.ts b/src/popup/app/components/pop-out.component.ts index 2d623e8183c..1328b2586d9 100644 --- a/src/popup/app/components/pop-out.component.ts +++ b/src/popup/app/components/pop-out.component.ts @@ -1,11 +1,11 @@ import * as template from './pop-out.component.html'; -import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service'; +import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service'; export class PopOutController implements ng.IController { i18n: any; - constructor(private $analytics: any, private $window: any, private browserUtilsService: BrowserUtilsService, + constructor(private $analytics: any, private $window: any, private platformUtilsService: PlatformUtilsService, private i18nService: any) { this.i18n = i18nService; } @@ -14,7 +14,7 @@ export class PopOutController implements ng.IController { this.$analytics.eventTrack('Expand Vault'); let href = this.$window.location.href; - if (this.browserUtilsService.isEdge()) { + if (this.platformUtilsService.isEdge()) { const popupIndex = href.indexOf('/popup/'); if (popupIndex > -1) { href = href.substring(popupIndex); @@ -39,7 +39,7 @@ export class PopOutController implements ng.IController { height: bodyRect.height, }); - if (this.browserUtilsService.inPopup(this.$window)) { + if (this.platformUtilsService.inPopup(this.$window)) { this.$window.close(); } } else { diff --git a/src/popup/app/current/current.component.ts b/src/popup/app/current/current.component.ts index 3e1a93b4fd2..ebac19526e1 100644 --- a/src/popup/app/current/current.component.ts +++ b/src/popup/app/current/current.component.ts @@ -1,6 +1,6 @@ import { CipherType } from '../../../enums/cipherType.enum'; -import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service'; +import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service'; import { UtilsService } from '../../../services/abstractions/utils.service'; import * as template from './current.component.html'; @@ -18,13 +18,13 @@ export class CurrentController { inSidebar: boolean = false; disableSearch: boolean = false; - constructor($scope: any, private cipherService: any, private browserUtilsService: BrowserUtilsService, + constructor($scope: any, private cipherService: any, private platformUtilsService: PlatformUtilsService, private utilsService: UtilsService, private toastr: any, private $window: any, private $state: any, private $timeout: any, private autofillService: any, private $analytics: any, private i18nService: any, private $filter: any) { this.i18n = i18nService; - this.inSidebar = browserUtilsService.inSidebar($window); - this.disableSearch = browserUtilsService.isEdge(); + this.inSidebar = platformUtilsService.inSidebar($window); + this.disableSearch = platformUtilsService.isEdge(); $scope.$on('syncCompleted', (event: any, successfully: boolean) => { if (this.loaded) { @@ -78,10 +78,10 @@ export class CurrentController { fromBackground: false, }).then((totpCode: string) => { this.$analytics.eventTrack('Autofilled'); - if (totpCode && this.browserUtilsService.isFirefox()) { + if (totpCode && this.platformUtilsService.isFirefox()) { this.utilsService.copyToClipboard(totpCode, document); } - if (this.browserUtilsService.inPopup(this.$window)) { + if (this.platformUtilsService.inPopup(this.$window)) { this.$window.close(); } }).catch(() => { @@ -107,7 +107,7 @@ export class CurrentController { return; } - this.domain = this.browserUtilsService.getDomain(this.url); + this.domain = this.platformUtilsService.getDomain(this.url); chrome.tabs.sendMessage(tabs[0].id, { command: 'collectPageDetails', diff --git a/src/popup/app/lock/lock.component.ts b/src/popup/app/lock/lock.component.ts index 71e67fdc0d9..4f9dccb0550 100644 --- a/src/popup/app/lock/lock.component.ts +++ b/src/popup/app/lock/lock.component.ts @@ -1,23 +1,23 @@ import * as angular from 'angular'; import * as template from './lock.component.html'; -import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service'; import { CryptoService } from '../../../services/abstractions/crypto.service'; import { MessagingService } from '../../../services/abstractions/messaging.service'; +import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service'; export class LockController { i18n: any; masterPassword: string; constructor(public $state: any, public i18nService: any, private $timeout: any, - private browserUtilsService: BrowserUtilsService, public cryptoService: CryptoService, public toastr: any, + private platformUtilsService: PlatformUtilsService, public cryptoService: CryptoService, public toastr: any, public userService: any, public messagingService: MessagingService, public SweetAlert: any) { this.i18n = i18nService; } $onInit() { this.$timeout(() => { - this.browserUtilsService.initListSectionItemListeners(document, angular); + this.platformUtilsService.initListSectionItemListeners(document, angular); document.getElementById('master-password').focus(); }, 500); } diff --git a/src/popup/app/services/auth.service.ts b/src/popup/app/services/auth.service.ts index 518f63ce485..5f78f16e6cd 100644 --- a/src/popup/app/services/auth.service.ts +++ b/src/popup/app/services/auth.service.ts @@ -1,14 +1,14 @@ import { DeviceRequest } from '../../../models/request/deviceRequest'; import { TokenRequest } from '../../../models/request/tokenRequest'; -import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service'; import { CryptoService } from '../../../services/abstractions/crypto.service'; import { MessagingService } from '../../../services/abstractions/messaging.service'; +import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service'; class AuthService { constructor(public cryptoService: CryptoService, public apiService: any, public userService: any, public tokenService: any, public $rootScope: any, public appIdService: any, - public browserUtilsService: BrowserUtilsService, public constantsService: any, + public platformUtilsService: PlatformUtilsService, public constantsService: any, public messagingService: MessagingService) { } @@ -21,7 +21,7 @@ class AuthService { const storedTwoFactorToken = await this.tokenService.getTwoFactorToken(email); const hashedPassword = await this.cryptoService.hashPassword(masterPassword, key); - const deviceRequest = new DeviceRequest(appId, this.browserUtilsService); + const deviceRequest = new DeviceRequest(appId, this.platformUtilsService); let request: TokenRequest; diff --git a/src/popup/app/services/background.service.ts b/src/popup/app/services/background.service.ts index 74f0850090f..7e9189e7a34 100644 --- a/src/popup/app/services/background.service.ts +++ b/src/popup/app/services/background.service.ts @@ -1,5 +1,5 @@ -import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service'; import { CryptoService } from '../../../services/abstractions/crypto.service'; +import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service'; import { StorageService } from '../../../services/abstractions/storage.service'; import { UtilsService } from '../../../services/abstractions/utils.service'; @@ -20,7 +20,7 @@ export const cipherService = getBackgroundService('cipherService' export const syncService = getBackgroundService('syncService'); export const autofillService = getBackgroundService('autofillService'); export const passwordGenerationService = getBackgroundService('passwordGenerationService'); -export const browserUtilsService = getBackgroundService('browserUtilsService'); +export const platformUtilsService = getBackgroundService('platformUtilsService'); export const utilsService = getBackgroundService('utilsService'); export const appIdService = getBackgroundService('appIdService'); export const i18nService = getBackgroundService('i18nService'); diff --git a/src/popup/app/services/services.module.ts b/src/popup/app/services/services.module.ts index 8a85db642a8..3395db0d656 100644 --- a/src/popup/app/services/services.module.ts +++ b/src/popup/app/services/services.module.ts @@ -6,7 +6,7 @@ import { ValidationService } from './validation.service'; import BrowserMessagingService from '../../../services/browserMessaging.service'; -const messagingService = new BrowserMessagingService(backgroundServices.browserUtilsService()); +const messagingService = new BrowserMessagingService(backgroundServices.platformUtilsService()); export default angular .module('bit.services', ['toastr']) @@ -25,7 +25,7 @@ export default angular .factory('syncService', backgroundServices.syncService) .factory('autofillService', backgroundServices.autofillService) .factory('passwordGenerationService', backgroundServices.passwordGenerationService) - .factory('browserUtilsService', backgroundServices.browserUtilsService) + .factory('platformUtilsService', backgroundServices.platformUtilsService) .factory('utilsService', backgroundServices.utilsService) .factory('appIdService', backgroundServices.appIdService) .factory('i18nService', backgroundServices.i18nService) diff --git a/src/popup/app/settings/environment.component.ts b/src/popup/app/settings/environment.component.ts index 55073b927ff..871de70f8b3 100644 --- a/src/popup/app/settings/environment.component.ts +++ b/src/popup/app/settings/environment.component.ts @@ -1,7 +1,8 @@ import * as angular from 'angular'; -import BrowserUtilsService from '../../../services/browserUtils.service'; import * as template from './environment.component.html'; +import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service'; + export class EnvironmentController { iconsUrl: string; identityUrl: string; @@ -10,12 +11,12 @@ export class EnvironmentController { baseUrl: string; i18n: any; - constructor(private i18nService: any, private $analytics: any, browserUtilsService: BrowserUtilsService, + constructor(private i18nService: any, private $analytics: any, platformUtilsService: PlatformUtilsService, private environmentService: any, private toastr: any, private $timeout: ng.ITimeoutService) { this.i18n = i18nService; $timeout(() => { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); }, 500); this.baseUrl = environmentService.baseUrl || ''; diff --git a/src/popup/app/settings/folders/add-folder.component.ts b/src/popup/app/settings/folders/add-folder.component.ts index e1552df3c8a..5ba46d3e926 100644 --- a/src/popup/app/settings/folders/add-folder.component.ts +++ b/src/popup/app/settings/folders/add-folder.component.ts @@ -2,7 +2,7 @@ import * as angular from 'angular'; import { Folder } from '../../../../models/domain/folder'; import * as template from './add-folder.component.html'; -import { BrowserUtilsService } from '../../../../services/abstractions/browserUtils.service'; +import { PlatformUtilsService } from '../../../../services/abstractions/platformUtils.service'; export class AddFolderController { savePromise: any; @@ -10,9 +10,10 @@ export class AddFolderController { i18n: any; constructor(private folderService: any, private $state: any, private toastr: any, - browserUtilsService: BrowserUtilsService, private $analytics: any, private i18nService: any, $timeout: any) { + platformUtilsService: PlatformUtilsService, private $analytics: any, private i18nService: any, + $timeout: any) { $timeout(() => { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); document.getElementById('name').focus(); }, 500); diff --git a/src/popup/app/settings/folders/edit-folder.component.ts b/src/popup/app/settings/folders/edit-folder.component.ts index 2c9dc8cf33f..4911941331c 100644 --- a/src/popup/app/settings/folders/edit-folder.component.ts +++ b/src/popup/app/settings/folders/edit-folder.component.ts @@ -2,7 +2,7 @@ import * as angular from 'angular'; import { Folder } from '../../../../models/domain/folder'; import * as template from './edit-folder.component.html'; -import { BrowserUtilsService } from '../../../../services/abstractions/browserUtils.service'; +import { PlatformUtilsService } from '../../../../services/abstractions/platformUtils.service'; export class EditFolderController { $transition$: any; @@ -12,12 +12,12 @@ export class EditFolderController { folder: Folder; constructor($scope: any, $stateParams: any, private folderService: any, private toastr: any, private $state: any, - private SweetAlert: any, browserUtilsService: BrowserUtilsService, private $analytics: any, + private SweetAlert: any, platformUtilsService: PlatformUtilsService, private $analytics: any, private i18nService: any, $timeout: any) { this.i18n = i18nService; $timeout(() => { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); document.getElementById('name').focus(); }, 500); diff --git a/src/popup/app/settings/options.component.ts b/src/popup/app/settings/options.component.ts index e474051ad77..49e76e233b0 100644 --- a/src/popup/app/settings/options.component.ts +++ b/src/popup/app/settings/options.component.ts @@ -1,6 +1,6 @@ import * as angular from 'angular'; -import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service'; import { MessagingService } from '../../../services/abstractions/messaging.service'; +import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service'; import { StorageService } from '../../../services/abstractions/storage.service'; import StateService from '../services/state.service'; import * as template from './options.component.html'; @@ -15,13 +15,13 @@ export class OptionsController { i18n: any; constructor(private i18nService: any, private $analytics: any, private constantsService: any, - private browserUtilsService: BrowserUtilsService, private totpService: any, private stateService: StateService, - private storageService: StorageService, public messagingService: MessagingService, - private $timeout: ng.ITimeoutService) { + private platformUtilsService: PlatformUtilsService, private totpService: any, + private stateService: StateService, private storageService: StorageService, + public messagingService: MessagingService, private $timeout: ng.ITimeoutService) { this.i18n = i18nService; $timeout(() => { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); }, 500); this.loadSettings(); @@ -33,7 +33,7 @@ export class OptionsController { const disableGa = await this.storageService.get( this.constantsService.disableGaKey); - this.disableGa = disableGa || (this.browserUtilsService.isFirefox() && disableGa === undefined); + this.disableGa = disableGa || (this.platformUtilsService.isFirefox() && disableGa === undefined); this.disableAddLoginNotification = await this.storageService.get( this.constantsService.disableAddLoginNotificationKey); diff --git a/src/popup/app/settings/settings.component.ts b/src/popup/app/settings/settings.component.ts index 6e4c4295d5b..be030e82845 100644 --- a/src/popup/app/settings/settings.component.ts +++ b/src/popup/app/settings/settings.component.ts @@ -1,8 +1,8 @@ import * as angular from 'angular'; import { DeviceType } from '../../../enums/deviceType.enum'; -import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service'; import { CryptoService } from '../../../services/abstractions/crypto.service'; import { MessagingService } from '../../../services/abstractions/messaging.service'; +import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service'; import { StorageService } from '../../../services/abstractions/storage.service'; import ConstantsService from '../../../services/constants.service'; @@ -28,17 +28,17 @@ export class SettingsController { i18n: any; showOnLocked: boolean; - constructor(private $state: any, private SweetAlert: any, private browserUtilsService: BrowserUtilsService, + constructor(private $state: any, private SweetAlert: any, private platformUtilsService: PlatformUtilsService, private $analytics: any, private i18nService: any, private constantsService: ConstantsService, private cryptoService: CryptoService, private lockService: any, private storageService: StorageService, public messagingService: MessagingService, private $timeout: ng.ITimeoutService) { this.i18n = i18nService; $timeout(() => { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); }, 500); - this.showOnLocked = !browserUtilsService.isFirefox() && !browserUtilsService.isEdge(); + this.showOnLocked = !platformUtilsService.isFirefox() && !platformUtilsService.isEdge(); this.storageService.get(constantsService.lockOptionKey).then((lockOption: number) => { if (lockOption != null) { let option = lockOption.toString(); @@ -147,7 +147,7 @@ export class SettingsController { rate() { this.$analytics.eventTrack('Rate Extension'); chrome.tabs.create({ - url: RateUrls[this.browserUtilsService.getDevice()], + url: RateUrls[this.platformUtilsService.getDevice()], }); } } diff --git a/src/popup/app/tools/password-generator.component.ts b/src/popup/app/tools/password-generator.component.ts index 36bacf0833f..28d39bffbaf 100644 --- a/src/popup/app/tools/password-generator.component.ts +++ b/src/popup/app/tools/password-generator.component.ts @@ -1,7 +1,7 @@ import * as angular from 'angular'; import * as template from './password-generator.component.html'; -import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service'; +import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service'; export class PasswordGeneratorController { $transition$: any; @@ -13,8 +13,8 @@ export class PasswordGeneratorController { i18n: any; constructor(private $state: any, private passwordGenerationService: any, - private toastr: any, private browserUtilsService: BrowserUtilsService, private $analytics: any, - private i18nService: any, private $timeout: any) { + private toastr: any, private platformUtilsService: PlatformUtilsService, private $analytics: any, + private i18nService: any, private $timeout: any) { this.i18n = i18nService; passwordGenerationService.getOptions().then((options: any) => { @@ -42,7 +42,7 @@ export class PasswordGeneratorController { this.showSelect = this.addState || this.editState; this.$timeout(() => { - this.browserUtilsService.initListSectionItemListeners(document, angular); + this.platformUtilsService.initListSectionItemListeners(document, angular); }, 500); } diff --git a/src/popup/app/tools/tools.component.ts b/src/popup/app/tools/tools.component.ts index 425f202852d..f5af8671686 100644 --- a/src/popup/app/tools/tools.component.ts +++ b/src/popup/app/tools/tools.component.ts @@ -1,6 +1,6 @@ import * as template from './tools.component.html'; -import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service'; +import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service'; export class ToolsController { showExport: boolean; @@ -8,10 +8,10 @@ export class ToolsController { private webVaultBaseUrl: string = 'https://vault.bitwarden.com'; constructor(private SweetAlert: any, private i18nService: any, - private $analytics: any, private browserUtilsService: BrowserUtilsService, + private $analytics: any, private platformUtilsService: PlatformUtilsService, private environmentService: any) { this.i18n = i18nService; - this.showExport = !browserUtilsService.isEdge(); + this.showExport = !platformUtilsService.isEdge(); if (environmentService.baseUrl) { this.webVaultBaseUrl = environmentService.baseUrl; } else if (environmentService.webVaultUrl) { diff --git a/src/popup/app/vault/vaultAddCipherController.js b/src/popup/app/vault/vaultAddCipherController.js index dab0c62a632..d2bb310978c 100644 --- a/src/popup/app/vault/vaultAddCipherController.js +++ b/src/popup/app/vault/vaultAddCipherController.js @@ -2,7 +2,7 @@ angular .module('bit.vault') .controller('vaultAddCipherController', function ($scope, $state, $stateParams, cipherService, folderService, - cryptoService, toastr, browserUtilsService, $analytics, i18nService, constantsService, $timeout) { + cryptoService, toastr, platformUtilsService, $analytics, i18nService, constantsService, $timeout) { $scope.i18n = i18nService; $scope.constants = constantsService; $scope.addFieldType = constantsService.fieldType.text.toString(); @@ -31,7 +31,7 @@ angular } $timeout(function () { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); if (!$stateParams.cipher && $scope.cipher.name && $scope.cipher.login && $scope.cipher.login.uri) { document.getElementById('loginUsername').focus(); @@ -49,7 +49,7 @@ angular $scope.cipher.type = parseInt($scope.selectedType); $timeout(function () { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); }, 500); }; @@ -106,7 +106,7 @@ angular }); $timeout(function () { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); }, 500); }; diff --git a/src/popup/app/vault/vaultAttachmentsController.js b/src/popup/app/vault/vaultAttachmentsController.js index f4265ea8dc4..ea196fcb002 100644 --- a/src/popup/app/vault/vaultAttachmentsController.js +++ b/src/popup/app/vault/vaultAttachmentsController.js @@ -2,9 +2,9 @@ angular .module('bit.vault') .controller('vaultAttachmentsController', function ($scope, $state, $stateParams, cipherService, toastr, - SweetAlert, browserUtilsService, $analytics, i18nService, cryptoService, tokenService, $timeout) { + SweetAlert, platformUtilsService, $analytics, i18nService, cryptoService, tokenService, $timeout) { $timeout(function () { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); }, 500); $scope.i18n = i18nService; diff --git a/src/popup/app/vault/vaultController.js b/src/popup/app/vault/vaultController.js index 37a3c8541d4..3b51ac10873 100644 --- a/src/popup/app/vault/vaultController.js +++ b/src/popup/app/vault/vaultController.js @@ -2,14 +2,14 @@ angular .module('bit.vault') .controller('vaultController', function ($scope, $rootScope, cipherService, folderService, $q, $state, $stateParams, toastr, - syncService, browserUtilsService, $analytics, i18nService, stateService, $timeout, $window, collectionService, $filter) { + syncService, platformUtilsService, $analytics, i18nService, stateService, $timeout, $window, collectionService, $filter) { var stateKey = 'vault', state = stateService.getState(stateKey) || {}; stateService.removeState('viewGrouping'); $scope.i18n = i18nService; - $scope.showGroupingCounts = !browserUtilsService.isEdge(); - $scope.disableSearch = browserUtilsService.isEdge(); + $scope.showGroupingCounts = !platformUtilsService.isEdge(); + $scope.disableSearch = platformUtilsService.isEdge(); document.getElementById('search').focus(); var syncOnLoad = $stateParams.syncOnLoad; diff --git a/src/popup/app/vault/vaultEditCipherController.js b/src/popup/app/vault/vaultEditCipherController.js index 64a8b1d28c2..d8b6e83de34 100644 --- a/src/popup/app/vault/vaultEditCipherController.js +++ b/src/popup/app/vault/vaultEditCipherController.js @@ -2,15 +2,15 @@ angular .module('bit.vault') .controller('vaultEditCipherController', function ($scope, $state, $stateParams, cipherService, folderService, - cryptoService, toastr, SweetAlert, browserUtilsService, $analytics, i18nService, constantsService, $timeout) { + cryptoService, toastr, SweetAlert, platformUtilsService, $analytics, i18nService, constantsService, $timeout) { $timeout(function () { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); document.getElementById('name').focus(); }, 500); $scope.i18n = i18nService; $scope.constants = constantsService; - $scope.showAttachments = !browserUtilsService.isEdge(); + $scope.showAttachments = !platformUtilsService.isEdge(); $scope.addFieldType = constantsService.fieldType.text.toString(); $scope.selectedType = constantsService.cipherType.login.toString(); var cipherId = $stateParams.cipherId; @@ -40,7 +40,7 @@ angular $scope.cipher.type = parseInt($scope.selectedType); $timeout(function () { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); }, 500); }; @@ -123,7 +123,7 @@ angular }); $timeout(function () { - browserUtilsService.initListSectionItemListeners(document, angular); + platformUtilsService.initListSectionItemListeners(document, angular); }, 500); }; diff --git a/src/popup/app/vault/vaultViewCipherController.js b/src/popup/app/vault/vaultViewCipherController.js index f0d6fef4dfe..2ef7d44e594 100644 --- a/src/popup/app/vault/vaultViewCipherController.js +++ b/src/popup/app/vault/vaultViewCipherController.js @@ -2,11 +2,11 @@ angular .module('bit.vault') .controller('vaultViewCipherController', function ($scope, $state, $stateParams, cipherService, toastr, - $analytics, i18nService, browserUtilsService, totpService, $timeout, tokenService, $window, cryptoService, SweetAlert, + $analytics, i18nService, platformUtilsService, totpService, $timeout, tokenService, $window, cryptoService, SweetAlert, constantsService) { $scope.constants = constantsService; $scope.i18n = i18nService; - $scope.showAttachments = !browserUtilsService.isEdge(); + $scope.showAttachments = !platformUtilsService.isEdge(); var from = $stateParams.from, totpInterval = null; @@ -30,7 +30,7 @@ angular if (model.login.uri) { $scope.cipher.showLaunch = model.login.uri.startsWith('http://') || model.login.uri.startsWith('https://'); - var domain = browserUtilsService.getDomain(model.login.uri); + var domain = platformUtilsService.getDomain(model.login.uri); if (domain) { $scope.cipher.login.website = domain; } diff --git a/src/popup/app/vault/vaultViewGroupingController.js b/src/popup/app/vault/vaultViewGroupingController.js index afe26047464..1cf939a9fa4 100644 --- a/src/popup/app/vault/vaultViewGroupingController.js +++ b/src/popup/app/vault/vaultViewGroupingController.js @@ -2,7 +2,7 @@ angular .module('bit.vault') .controller('vaultViewGroupingController', function ($scope, cipherService, folderService, $q, $state, $stateParams, toastr, - syncService, $analytics, i18nService, stateService, browserUtilsService, $timeout, $window, collectionService) { + syncService, $analytics, i18nService, stateService, platformUtilsService, $timeout, $window, collectionService) { var stateKey = 'viewGrouping', state = stateService.getState(stateKey) || {}; @@ -60,7 +60,7 @@ angular var cipherPromise = cipherService.getAllDecryptedForGrouping($scope.grouping.id, $scope.folderGrouping) .then(function (ciphers) { - if (browserUtilsService.isEdge()) { + if (platformUtilsService.isEdge()) { // Edge is super slow at sorting decCiphers = ciphers; } diff --git a/src/scripts/analytics.js b/src/scripts/analytics.js index b23164c7931..f44af5bdf0b 100644 --- a/src/scripts/analytics.js +++ b/src/scripts/analytics.js @@ -9,9 +9,9 @@ return; } - var gaTrackingId = bgMain.browserUtilsService.analyticsId(); + var gaTrackingId = bgMain.platformUtilsService.analyticsId(); var gaFunc = null; - var isFirefox = bgMain.browserUtilsService.isFirefox(); + var isFirefox = bgMain.platformUtilsService.isFirefox(); window.GoogleAnalyticsObject = 'ga'; window[window.GoogleAnalyticsObject] = function (action, param1, param2, param3, param4) { diff --git a/src/services/abstractions/browserUtils.service.ts b/src/services/abstractions/platformUtils.service.ts similarity index 93% rename from src/services/abstractions/browserUtils.service.ts rename to src/services/abstractions/platformUtils.service.ts index 7b92dccb221..063c18dcdd2 100644 --- a/src/services/abstractions/browserUtils.service.ts +++ b/src/services/abstractions/platformUtils.service.ts @@ -1,6 +1,6 @@ import { DeviceType } from '../../enums/deviceType.enum'; -export interface BrowserUtilsService { +export interface PlatformUtilsService { getDevice(): DeviceType; getDeviceString(): string; isFirefox(): boolean; diff --git a/src/services/api.service.ts b/src/services/api.service.ts index f372422f06d..e48f72a5f54 100644 --- a/src/services/api.service.ts +++ b/src/services/api.service.ts @@ -1,8 +1,9 @@ import AppIdService from './appId.service'; -import BrowserUtilsService from './browserUtils.service'; import ConstantsService from './constants.service'; import TokenService from './token.service'; +import { PlatformUtilsService } from './abstractions/platformUtils.service'; + import EnvironmentUrls from '../models/domain/environmentUrls'; import { CipherRequest } from '../models/request/cipherRequest'; @@ -35,10 +36,10 @@ export default class ApiService { deviceType: string; logoutCallback: Function; - constructor(private tokenService: TokenService, browserUtilsService: BrowserUtilsService, + constructor(private tokenService: TokenService, platformUtilsService: PlatformUtilsService, logoutCallback: Function) { this.logoutCallback = logoutCallback; - this.deviceType = browserUtilsService.getDevice().toString(); + this.deviceType = platformUtilsService.getDevice().toString(); } setUrls(urls: EnvironmentUrls) { diff --git a/src/services/autofill.service.ts b/src/services/autofill.service.ts index 945a7a9891f..bf03fea5bf2 100644 --- a/src/services/autofill.service.ts +++ b/src/services/autofill.service.ts @@ -5,12 +5,13 @@ import AutofillField from '../models/domain/autofillField'; import AutofillPageDetails from '../models/domain/autofillPageDetails'; import AutofillScript from '../models/domain/autofillScript'; -import BrowserUtilsService from './browserUtils.service'; import CipherService from './cipher.service'; import TokenService from './token.service'; import TotpService from './totp.service'; import UtilsService from './utils.service'; +import { PlatformUtilsService } from '../services/abstractions/platformUtils.service'; + const CardAttributes: string[] = ['autoCompleteType', 'data-stripe', 'htmlName', 'htmlID', 'label-tag', 'placeholder', 'label-left', 'label-top']; @@ -94,7 +95,7 @@ var IsoProvinces: { [id: string]: string; } = { export default class AutofillService { constructor(public cipherService: CipherService, public tokenService: TokenService, public totpService: TotpService, public utilsService: UtilsService, - public browserUtilsService: BrowserUtilsService) { + public platformUtilsService: PlatformUtilsService) { } getFormsWithPasswordFields(pageDetails: AutofillPageDetails): any[] { @@ -169,7 +170,7 @@ export default class AutofillService { }, { frameId: pd.frameId }); if (options.cipher.type !== CipherType.Login || totpPromise || - (options.fromBackground && this.browserUtilsService.isFirefox()) || options.skipTotp || + (options.fromBackground && this.platformUtilsService.isFirefox()) || options.skipTotp || !options.cipher.login.totp || !this.tokenService.getPremium()) { return; } @@ -207,7 +208,7 @@ export default class AutofillService { return; } - const tabDomain = BrowserUtilsService.getDomain(tab.url); + const tabDomain = this.platformUtilsService.getDomain(tab.url); if (tabDomain == null) { return; } diff --git a/src/services/browserMessaging.service.ts b/src/services/browserMessaging.service.ts index fffa94c70c1..f7c8d5600e4 100644 --- a/src/services/browserMessaging.service.ts +++ b/src/services/browserMessaging.service.ts @@ -1,8 +1,8 @@ -import { BrowserUtilsService } from './abstractions/browserUtils.service'; import { MessagingService as MessagingServiceInterface } from './abstractions/messaging.service'; +import { PlatformUtilsService } from './abstractions/platformUtils.service'; export default class BrowserMessagingService implements MessagingServiceInterface { - constructor(private browserUtilsService: BrowserUtilsService) { + constructor(private platformUtilsService: PlatformUtilsService) { } send(subscriber: string, arg: any = {}) { diff --git a/src/services/browserStorage.service.ts b/src/services/browserStorage.service.ts index d7ff69f5f94..80b060e7ff4 100644 --- a/src/services/browserStorage.service.ts +++ b/src/services/browserStorage.service.ts @@ -1,8 +1,8 @@ -import { BrowserUtilsService } from './abstractions/browserUtils.service'; +import { PlatformUtilsService } from './abstractions/platformUtils.service'; import { StorageService as StorageServiceInterface } from './abstractions/storage.service'; export default class BrowserStorageService implements StorageServiceInterface { - constructor(private browserUtilsService: BrowserUtilsService) { + constructor(private platformUtilsService: PlatformUtilsService) { } get(key: string): Promise { diff --git a/src/services/browserUtils.service.ts b/src/services/browserUtils.service.ts index 6b0db337839..9338a82adbc 100644 --- a/src/services/browserUtils.service.ts +++ b/src/services/browserUtils.service.ts @@ -1,6 +1,6 @@ import * as tldjs from 'tldjs'; import { DeviceType } from '../enums/deviceType.enum'; -import { BrowserUtilsService as BrowserUtilsServiceInterface } from './abstractions/browserUtils.service'; +import { PlatformUtilsService as PlatformUtilsServiceInterface } from './abstractions/platformUtils.service'; const AnalyticsIds = { [DeviceType.Chrome]: 'UA-81915606-6', @@ -11,7 +11,7 @@ const AnalyticsIds = { [DeviceType.Safari]: 'UA-81915606-16', }; -export default class BrowserUtilsService implements BrowserUtilsServiceInterface { +export default class BrowserUtilsService implements PlatformUtilsServiceInterface { static getDomain(uriString: string): string { if (uriString == null) { return null; diff --git a/src/services/constants.service.ts b/src/services/constants.service.ts index a5e49bd2509..9dfd82eb8d7 100644 --- a/src/services/constants.service.ts +++ b/src/services/constants.service.ts @@ -1,4 +1,4 @@ -import BrowserUtilsService from './browserUtils.service'; +import { PlatformUtilsService } from './abstractions/platformUtils.service'; export default class ConstantsService { static readonly environmentUrlsKey: string = 'environmentUrls'; @@ -57,8 +57,8 @@ export default class ConstantsService { twoFactorProviderInfo: any[]; - constructor(i18nService: any, browserUtilsService: BrowserUtilsService) { - if (browserUtilsService.isEdge()) { + constructor(i18nService: any, platformUtilsService: PlatformUtilsService) { + if (platformUtilsService.isEdge()) { // delay for i18n fetch setTimeout(() => { this.bootstrap(i18nService); diff --git a/src/services/i18n.service.ts b/src/services/i18n.service.ts index 931490f4a7c..1c6bba7a681 100644 --- a/src/services/i18n.service.ts +++ b/src/services/i18n.service.ts @@ -1,9 +1,9 @@ -import BrowserUtilsService from '../services/browserUtils.service'; +import { PlatformUtilsService } from './abstractions/platformUtils.service'; -export default function i18nService(browserUtilsService: BrowserUtilsService) { +export default function i18nService(platformUtilsService: PlatformUtilsService) { const edgeMessages: any = {}; - if (browserUtilsService.isEdge()) { + if (platformUtilsService.isEdge()) { fetch('../_locales/en/messages.json').then((file) => { return file.json(); }).then((locales) => { diff --git a/src/services/lock.service.ts b/src/services/lock.service.ts index 4476ee6f870..356ada7a2e8 100644 --- a/src/services/lock.service.ts +++ b/src/services/lock.service.ts @@ -1,23 +1,23 @@ -import BrowserUtilsService from './browserUtils.service'; import CipherService from './cipher.service'; import CollectionService from './collection.service'; import ConstantsService from './constants.service'; import CryptoService from './crypto.service'; import FolderService from './folder.service'; +import { PlatformUtilsService } from './abstractions/platformUtils.service'; import { StorageService } from './abstractions/storage.service'; export default class LockService { constructor(private cipherService: CipherService, private folderService: FolderService, private collectionService: CollectionService, private cryptoService: CryptoService, - private browserUtilsService: BrowserUtilsService, private storageService: StorageService, + private platformUtilsService: PlatformUtilsService, private storageService: StorageService, private setIcon: Function, private refreshBadgeAndMenu: Function) { this.checkLock(); setInterval(() => this.checkLock(), 10 * 1000); // check every 10 seconds } async checkLock(): Promise { - if (this.browserUtilsService.isViewOpen()) { + if (this.platformUtilsService.isViewOpen()) { // Do not lock return; }