mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-18 11:05:41 +01:00
rename browser utils to platform utils
This commit is contained in:
parent
01cf48bbed
commit
4a08bf6b71
@ -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) => {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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',
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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<CryptoService>('cipherService'
|
||||
export const syncService = getBackgroundService<any>('syncService');
|
||||
export const autofillService = getBackgroundService<any>('autofillService');
|
||||
export const passwordGenerationService = getBackgroundService<any>('passwordGenerationService');
|
||||
export const browserUtilsService = getBackgroundService<BrowserUtilsService>('browserUtilsService');
|
||||
export const platformUtilsService = getBackgroundService<PlatformUtilsService>('platformUtilsService');
|
||||
export const utilsService = getBackgroundService<UtilsService>('utilsService');
|
||||
export const appIdService = getBackgroundService<any>('appIdService');
|
||||
export const i18nService = getBackgroundService<any>('i18nService');
|
||||
|
@ -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)
|
||||
|
@ -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 || '';
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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<boolean>(
|
||||
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<boolean>(
|
||||
this.constantsService.disableAddLoginNotificationKey);
|
||||
|
@ -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()],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { DeviceType } from '../../enums/deviceType.enum';
|
||||
|
||||
export interface BrowserUtilsService {
|
||||
export interface PlatformUtilsService {
|
||||
getDevice(): DeviceType;
|
||||
getDeviceString(): string;
|
||||
isFirefox(): boolean;
|
@ -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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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 = {}) {
|
||||
|
@ -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<T>(key: string): Promise<T> {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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) => {
|
||||
|
@ -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<void> {
|
||||
if (this.browserUtilsService.isViewOpen()) {
|
||||
if (this.platformUtilsService.isViewOpen()) {
|
||||
// Do not lock
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user