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 UtilsService from '../services/utils.service';
|
||||||
|
|
||||||
import { MessagingService } from '../services/abstractions/messaging.service';
|
import { MessagingService } from '../services/abstractions/messaging.service';
|
||||||
|
import { PlatformUtilsService } from '../services/abstractions/platformUtils.service';
|
||||||
import { StorageService } from '../services/abstractions/storage.service';
|
import { StorageService } from '../services/abstractions/storage.service';
|
||||||
|
|
||||||
export default class MainBackground {
|
export default class MainBackground {
|
||||||
messagingService: MessagingService;
|
messagingService: MessagingService;
|
||||||
storageService: StorageService;
|
storageService: StorageService;
|
||||||
i18nService: any;
|
i18nService: any;
|
||||||
browserUtilsService: BrowserUtilsService;
|
platformUtilsService: PlatformUtilsService;
|
||||||
utilsService: UtilsService;
|
utilsService: UtilsService;
|
||||||
constantsService: ConstantsService;
|
constantsService: ConstantsService;
|
||||||
cryptoService: CryptoService;
|
cryptoService: CryptoService;
|
||||||
|
@ -82,16 +83,16 @@ export default class MainBackground {
|
||||||
constructor() {
|
constructor() {
|
||||||
// Services
|
// Services
|
||||||
this.utilsService = new UtilsService();
|
this.utilsService = new UtilsService();
|
||||||
this.browserUtilsService = new BrowserUtilsService();
|
this.platformUtilsService = new BrowserUtilsService();
|
||||||
this.messagingService = new BrowserMessagingService(this.browserUtilsService);
|
this.messagingService = new BrowserMessagingService(this.platformUtilsService);
|
||||||
this.storageService = new BrowserStorageService(this.browserUtilsService);
|
this.storageService = new BrowserStorageService(this.platformUtilsService);
|
||||||
this.i18nService = i18nService(this.browserUtilsService);
|
this.i18nService = i18nService(this.platformUtilsService);
|
||||||
this.constantsService = new ConstantsService(this.i18nService, this.browserUtilsService);
|
this.constantsService = new ConstantsService(this.i18nService, this.platformUtilsService);
|
||||||
this.cryptoService = ContainerService.cryptoService = new CryptoService(this.storageService,
|
this.cryptoService = ContainerService.cryptoService = new CryptoService(this.storageService,
|
||||||
this.storageService);
|
this.storageService);
|
||||||
this.tokenService = new TokenService(this.storageService);
|
this.tokenService = new TokenService(this.storageService);
|
||||||
this.appIdService = new AppIdService(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));
|
(expired: boolean) => this.logout(expired));
|
||||||
this.environmentService = new EnvironmentService(this.apiService, this.storageService);
|
this.environmentService = new EnvironmentService(this.apiService, this.storageService);
|
||||||
this.userService = new UserService(this.tokenService, this.storageService);
|
this.userService = new UserService(this.tokenService, this.storageService);
|
||||||
|
@ -102,7 +103,7 @@ export default class MainBackground {
|
||||||
this.apiService, this.storageService);
|
this.apiService, this.storageService);
|
||||||
this.collectionService = new CollectionService(this.cryptoService, this.userService, this.storageService);
|
this.collectionService = new CollectionService(this.cryptoService, this.userService, this.storageService);
|
||||||
this.lockService = new LockService(this.cipherService, this.folderService, this.collectionService,
|
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.setIcon(), () => this.refreshBadgeAndMenu());
|
||||||
this.syncService = new SyncService(this.userService, this.apiService, this.settingsService,
|
this.syncService = new SyncService(this.userService, this.apiService, this.settingsService,
|
||||||
this.folderService, this.cipherService, this.cryptoService, this.collectionService,
|
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.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService);
|
||||||
this.totpService = new TotpService(this.storageService);
|
this.totpService = new TotpService(this.storageService);
|
||||||
this.autofillService = new AutofillService(this.cipherService, this.tokenService,
|
this.autofillService = new AutofillService(this.cipherService, this.tokenService,
|
||||||
this.totpService, this.utilsService, this.browserUtilsService);
|
this.totpService, this.utilsService, this.platformUtilsService);
|
||||||
|
|
||||||
// Other fields
|
// Other fields
|
||||||
this.sidebarAction = (typeof opr !== 'undefined') && opr.sidebarAction ?
|
this.sidebarAction = (typeof opr !== 'undefined') && opr.sidebarAction ?
|
||||||
|
@ -121,9 +122,10 @@ export default class MainBackground {
|
||||||
this.contextMenusBackground = new ContextMenusBackground(this, this.cipherService,
|
this.contextMenusBackground = new ContextMenusBackground(this, this.cipherService,
|
||||||
this.passwordGenerationService);
|
this.passwordGenerationService);
|
||||||
this.idleBackground = new IdleBackground(this, this.lockService, this.storageService);
|
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.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);
|
this.windowsBackground = new WindowsBackground(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +264,7 @@ export default class MainBackground {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Firefox & Edge do not support writing to the clipboard from background
|
// 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({
|
await this.contextMenusCreate({
|
||||||
type: 'normal',
|
type: 'normal',
|
||||||
id: 'copy-username',
|
id: 'copy-username',
|
||||||
|
@ -306,7 +308,7 @@ export default class MainBackground {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tabDomain = BrowserUtilsService.getDomain(url);
|
const tabDomain = this.platformUtilsService.getDomain(url);
|
||||||
if (tabDomain == null) {
|
if (tabDomain == null) {
|
||||||
return;
|
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
|
// Firefox does not support writing to the clipboard from background
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -422,7 +424,7 @@ export default class MainBackground {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tabDomain = BrowserUtilsService.getDomain(tab.url);
|
const tabDomain = this.platformUtilsService.getDomain(tab.url);
|
||||||
if (tabDomain == null) {
|
if (tabDomain == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -500,7 +502,7 @@ export default class MainBackground {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.browserUtilsService.isFirefox()) {
|
if (this.platformUtilsService.isFirefox()) {
|
||||||
await theAction.setIcon(options);
|
await theAction.setIcon(options);
|
||||||
} else {
|
} else {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
|
|
|
@ -5,17 +5,18 @@ import BrowserApi from '../browser/browserApi';
|
||||||
import MainBackground from './main.background';
|
import MainBackground from './main.background';
|
||||||
|
|
||||||
import AutofillService from '../services/autofill.service';
|
import AutofillService from '../services/autofill.service';
|
||||||
import BrowserUtilsService from '../services/browserUtils.service';
|
|
||||||
import CipherService from '../services/cipher.service';
|
import CipherService from '../services/cipher.service';
|
||||||
import UtilsService from '../services/utils.service';
|
import UtilsService from '../services/utils.service';
|
||||||
|
|
||||||
|
import { PlatformUtilsService } from '../services/abstractions/platformUtils.service';
|
||||||
|
|
||||||
export default class RuntimeBackground {
|
export default class RuntimeBackground {
|
||||||
private runtime: any;
|
private runtime: any;
|
||||||
private autofillTimeout: number;
|
private autofillTimeout: number;
|
||||||
private pageDetailsToAutoFill: any[] = [];
|
private pageDetailsToAutoFill: any[] = [];
|
||||||
|
|
||||||
constructor(private main: MainBackground, private autofillService: AutofillService,
|
constructor(private main: MainBackground, private autofillService: AutofillService,
|
||||||
private cipherService: CipherService) {
|
private cipherService: CipherService, private platformUtilsService: PlatformUtilsService) {
|
||||||
this.runtime = chrome.runtime;
|
this.runtime = chrome.runtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +136,7 @@ export default class RuntimeBackground {
|
||||||
}
|
}
|
||||||
|
|
||||||
const loginInfo = this.main.loginsToAdd[i];
|
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) {
|
if (tabDomain != null && tabDomain !== loginInfo.domain) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -173,7 +174,7 @@ export default class RuntimeBackground {
|
||||||
}
|
}
|
||||||
|
|
||||||
const loginInfo = this.main.loginsToAdd[i];
|
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) {
|
if (tabDomain != null && tabDomain !== loginInfo.domain) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +187,7 @@ export default class RuntimeBackground {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async addLogin(loginInfo: any, tab: any) {
|
private async addLogin(loginInfo: any, tab: any) {
|
||||||
const loginDomain = BrowserUtilsService.getDomain(loginInfo.url);
|
const loginDomain = this.platformUtilsService.getDomain(loginInfo.url);
|
||||||
if (loginDomain == null) {
|
if (loginDomain == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
import BrowserUtilsService from '../services/browserUtils.service';
|
|
||||||
import CipherService from '../services/cipher.service';
|
import CipherService from '../services/cipher.service';
|
||||||
|
|
||||||
|
import { PlatformUtilsService } from '../services/abstractions/platformUtils.service';
|
||||||
|
|
||||||
export default class WebRequestBackground {
|
export default class WebRequestBackground {
|
||||||
private pendingAuthRequests: any[] = [];
|
private pendingAuthRequests: any[] = [];
|
||||||
private webRequest: any;
|
private webRequest: any;
|
||||||
private isFirefox: boolean;
|
private isFirefox: boolean;
|
||||||
|
|
||||||
constructor(browserUtilsService: BrowserUtilsService, private cipherService: CipherService) {
|
constructor(private platformUtilsService: PlatformUtilsService, private cipherService: CipherService) {
|
||||||
this.webRequest = (window as any).chrome.webRequest;
|
this.webRequest = (window as any).chrome.webRequest;
|
||||||
this.isFirefox = browserUtilsService.isFirefox();
|
this.isFirefox = platformUtilsService.isFirefox();
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
|
@ -24,7 +25,7 @@ export default class WebRequestBackground {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const domain = BrowserUtilsService.getDomain(details.url);
|
const domain = this.platformUtilsService.getDomain(details.url);
|
||||||
if (domain == null) {
|
if (domain == null) {
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { DeviceType } from '../../enums/deviceType.enum';
|
import { DeviceType } from '../../enums/deviceType.enum';
|
||||||
import { BrowserUtilsService } from '../../services/abstractions/browserUtils.service';
|
import { PlatformUtilsService } from '../../services/abstractions/platformUtils.service';
|
||||||
|
|
||||||
class DeviceRequest {
|
class DeviceRequest {
|
||||||
type: DeviceType;
|
type: DeviceType;
|
||||||
|
@ -7,9 +7,9 @@ class DeviceRequest {
|
||||||
identifier: string;
|
identifier: string;
|
||||||
pushToken?: string;
|
pushToken?: string;
|
||||||
|
|
||||||
constructor(appId: string, browserUtilsService: BrowserUtilsService) {
|
constructor(appId: string, platformUtilsService: PlatformUtilsService) {
|
||||||
this.type = browserUtilsService.getDevice();
|
this.type = platformUtilsService.getDevice();
|
||||||
this.name = browserUtilsService.getDeviceString();
|
this.name = platformUtilsService.getDeviceString();
|
||||||
this.identifier = appId;
|
this.identifier = appId;
|
||||||
this.pushToken = null;
|
this.pushToken = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
angular
|
angular
|
||||||
.module('bit.accounts')
|
.module('bit.accounts')
|
||||||
|
|
||||||
.controller('accountsHintController', function ($scope, $state, apiService, toastr, $q, browserUtilsService,
|
.controller('accountsHintController', function ($scope, $state, apiService, toastr, $q, platformUtilsService,
|
||||||
$analytics, i18nService, $timeout) {
|
$analytics, i18nService, $timeout) {
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
document.getElementById('email').focus();
|
document.getElementById('email').focus();
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@ angular
|
||||||
.module('bit.accounts')
|
.module('bit.accounts')
|
||||||
|
|
||||||
.controller('accountsLoginController', function ($scope, $state, $stateParams, authService, userService, toastr,
|
.controller('accountsLoginController', function ($scope, $state, $stateParams, authService, userService, toastr,
|
||||||
browserUtilsService, $analytics, i18nService, $timeout) {
|
platformUtilsService, $analytics, i18nService, $timeout) {
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
if ($stateParams.email) {
|
if ($stateParams.email) {
|
||||||
document.getElementById('master-password').focus();
|
document.getElementById('master-password').focus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
angular
|
angular
|
||||||
.module('bit.accounts')
|
.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,
|
$analytics, i18nService, $stateParams, $filter, constantsService, $timeout, $window, cryptoService, apiService,
|
||||||
environmentService) {
|
environmentService, SweetAlert) {
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
$scope.i18n = i18nService;
|
$scope.i18n = i18nService;
|
||||||
|
@ -130,7 +130,7 @@ angular
|
||||||
var provider = $filter('filter')(constants.twoFactorProviderInfo, { type: keys[i], active: true });
|
var provider = $filter('filter')(constants.twoFactorProviderInfo, { type: keys[i], active: true });
|
||||||
if (provider.length && provider[0].priority > providerPriority) {
|
if (provider.length && provider[0].priority > providerPriority) {
|
||||||
if (provider[0].type == constants.twoFactorProvider.u2f && (typeof $window.u2f === 'undefined') &&
|
if (provider[0].type == constants.twoFactorProvider.u2f && (typeof $window.u2f === 'undefined') &&
|
||||||
!browserUtilsService.isChrome() && !browserUtilsService.isOpera()) {
|
!platformUtilsService.isChrome() && !platformUtilsService.isOpera()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,8 +183,9 @@ angular
|
||||||
params = providers[constants.twoFactorProvider.email];
|
params = providers[constants.twoFactorProvider.email];
|
||||||
$scope.twoFactorEmail = params.Email;
|
$scope.twoFactorEmail = params.Email;
|
||||||
|
|
||||||
if (chrome.extension.getViews({ type: 'popup' }).length > 0 && !browserUtilsService.inSidebar($window) &&
|
if (chrome.extension.getViews({ type: 'popup' }).length > 0 &&
|
||||||
!browserUtilsService.inTab($window) && !browserUtilsService.inPopout($window)) {
|
!platformUtilsService.inSidebar($window) && !platformUtilsService.inTab($window) &&
|
||||||
|
!platformUtilsService.inPopout($window)) {
|
||||||
SweetAlert.swal({
|
SweetAlert.swal({
|
||||||
title: i18nService.twoStepLogin,
|
title: i18nService.twoStepLogin,
|
||||||
text: i18nService.popup2faCloseMessage,
|
text: i18nService.popup2faCloseMessage,
|
||||||
|
|
|
@ -3,9 +3,10 @@ angular
|
||||||
|
|
||||||
.controller(
|
.controller(
|
||||||
'accountsRegisterController',
|
'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 () {
|
$timeout(function () {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
document.getElementById('email').focus();
|
document.getElementById('email').focus();
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ angular
|
||||||
add(constants.twoFactorProvider.duo);
|
add(constants.twoFactorProvider.duo);
|
||||||
}
|
}
|
||||||
if (providers.hasOwnProperty(constants.twoFactorProvider.u2f) &&
|
if (providers.hasOwnProperty(constants.twoFactorProvider.u2f) &&
|
||||||
(browserUtilsService.isChrome() || browserUtilsService.isOpera())) {
|
(platformUtilsService.isChrome() || platformUtilsService.isOpera())) {
|
||||||
add(constants.twoFactorProvider.u2f);
|
add(constants.twoFactorProvider.u2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as template from './action-buttons.component.html';
|
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 {
|
export class ActionButtonsController implements ng.IController {
|
||||||
onView: Function;
|
onView: Function;
|
||||||
|
@ -11,7 +11,7 @@ export class ActionButtonsController implements ng.IController {
|
||||||
constants: any;
|
constants: any;
|
||||||
|
|
||||||
constructor(private i18nService: any, private $analytics: any, private constantsService: any, private toastr: 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.i18n = i18nService;
|
||||||
this.constants = constantsService;
|
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://')) {
|
if (self.cipher.login.uri.startsWith('http://') || self.cipher.login.uri.startsWith('https://')) {
|
||||||
self.$analytics.eventTrack('Launched Website From Listing');
|
self.$analytics.eventTrack('Launched Website From Listing');
|
||||||
chrome.tabs.create({ url: self.cipher.login.uri });
|
chrome.tabs.create({ url: self.cipher.login.uri });
|
||||||
if (self.browserUtilsService.inPopup(self.$window)) {
|
if (self.platformUtilsService.inPopup(self.$window)) {
|
||||||
self.$window.close();
|
self.$window.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import * as template from './pop-out.component.html';
|
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 {
|
export class PopOutController implements ng.IController {
|
||||||
i18n: any;
|
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) {
|
private i18nService: any) {
|
||||||
this.i18n = i18nService;
|
this.i18n = i18nService;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ export class PopOutController implements ng.IController {
|
||||||
this.$analytics.eventTrack('Expand Vault');
|
this.$analytics.eventTrack('Expand Vault');
|
||||||
|
|
||||||
let href = this.$window.location.href;
|
let href = this.$window.location.href;
|
||||||
if (this.browserUtilsService.isEdge()) {
|
if (this.platformUtilsService.isEdge()) {
|
||||||
const popupIndex = href.indexOf('/popup/');
|
const popupIndex = href.indexOf('/popup/');
|
||||||
if (popupIndex > -1) {
|
if (popupIndex > -1) {
|
||||||
href = href.substring(popupIndex);
|
href = href.substring(popupIndex);
|
||||||
|
@ -39,7 +39,7 @@ export class PopOutController implements ng.IController {
|
||||||
height: bodyRect.height,
|
height: bodyRect.height,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.browserUtilsService.inPopup(this.$window)) {
|
if (this.platformUtilsService.inPopup(this.$window)) {
|
||||||
this.$window.close();
|
this.$window.close();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { CipherType } from '../../../enums/cipherType.enum';
|
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 { UtilsService } from '../../../services/abstractions/utils.service';
|
||||||
import * as template from './current.component.html';
|
import * as template from './current.component.html';
|
||||||
|
|
||||||
|
@ -18,13 +18,13 @@ export class CurrentController {
|
||||||
inSidebar: boolean = false;
|
inSidebar: boolean = false;
|
||||||
disableSearch: 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 utilsService: UtilsService, private toastr: any, private $window: any, private $state: any,
|
||||||
private $timeout: any, private autofillService: any, private $analytics: any, private i18nService: any,
|
private $timeout: any, private autofillService: any, private $analytics: any, private i18nService: any,
|
||||||
private $filter: any) {
|
private $filter: any) {
|
||||||
this.i18n = i18nService;
|
this.i18n = i18nService;
|
||||||
this.inSidebar = browserUtilsService.inSidebar($window);
|
this.inSidebar = platformUtilsService.inSidebar($window);
|
||||||
this.disableSearch = browserUtilsService.isEdge();
|
this.disableSearch = platformUtilsService.isEdge();
|
||||||
|
|
||||||
$scope.$on('syncCompleted', (event: any, successfully: boolean) => {
|
$scope.$on('syncCompleted', (event: any, successfully: boolean) => {
|
||||||
if (this.loaded) {
|
if (this.loaded) {
|
||||||
|
@ -78,10 +78,10 @@ export class CurrentController {
|
||||||
fromBackground: false,
|
fromBackground: false,
|
||||||
}).then((totpCode: string) => {
|
}).then((totpCode: string) => {
|
||||||
this.$analytics.eventTrack('Autofilled');
|
this.$analytics.eventTrack('Autofilled');
|
||||||
if (totpCode && this.browserUtilsService.isFirefox()) {
|
if (totpCode && this.platformUtilsService.isFirefox()) {
|
||||||
this.utilsService.copyToClipboard(totpCode, document);
|
this.utilsService.copyToClipboard(totpCode, document);
|
||||||
}
|
}
|
||||||
if (this.browserUtilsService.inPopup(this.$window)) {
|
if (this.platformUtilsService.inPopup(this.$window)) {
|
||||||
this.$window.close();
|
this.$window.close();
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
@ -107,7 +107,7 @@ export class CurrentController {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.domain = this.browserUtilsService.getDomain(this.url);
|
this.domain = this.platformUtilsService.getDomain(this.url);
|
||||||
|
|
||||||
chrome.tabs.sendMessage(tabs[0].id, {
|
chrome.tabs.sendMessage(tabs[0].id, {
|
||||||
command: 'collectPageDetails',
|
command: 'collectPageDetails',
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
import * as angular from 'angular';
|
import * as angular from 'angular';
|
||||||
import * as template from './lock.component.html';
|
import * as template from './lock.component.html';
|
||||||
|
|
||||||
import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service';
|
|
||||||
import { CryptoService } from '../../../services/abstractions/crypto.service';
|
import { CryptoService } from '../../../services/abstractions/crypto.service';
|
||||||
import { MessagingService } from '../../../services/abstractions/messaging.service';
|
import { MessagingService } from '../../../services/abstractions/messaging.service';
|
||||||
|
import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service';
|
||||||
|
|
||||||
export class LockController {
|
export class LockController {
|
||||||
i18n: any;
|
i18n: any;
|
||||||
masterPassword: string;
|
masterPassword: string;
|
||||||
|
|
||||||
constructor(public $state: any, public i18nService: any, private $timeout: any,
|
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) {
|
public userService: any, public messagingService: MessagingService, public SweetAlert: any) {
|
||||||
this.i18n = i18nService;
|
this.i18n = i18nService;
|
||||||
}
|
}
|
||||||
|
|
||||||
$onInit() {
|
$onInit() {
|
||||||
this.$timeout(() => {
|
this.$timeout(() => {
|
||||||
this.browserUtilsService.initListSectionItemListeners(document, angular);
|
this.platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
document.getElementById('master-password').focus();
|
document.getElementById('master-password').focus();
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { DeviceRequest } from '../../../models/request/deviceRequest';
|
import { DeviceRequest } from '../../../models/request/deviceRequest';
|
||||||
import { TokenRequest } from '../../../models/request/tokenRequest';
|
import { TokenRequest } from '../../../models/request/tokenRequest';
|
||||||
|
|
||||||
import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service';
|
|
||||||
import { CryptoService } from '../../../services/abstractions/crypto.service';
|
import { CryptoService } from '../../../services/abstractions/crypto.service';
|
||||||
import { MessagingService } from '../../../services/abstractions/messaging.service';
|
import { MessagingService } from '../../../services/abstractions/messaging.service';
|
||||||
|
import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service';
|
||||||
|
|
||||||
class AuthService {
|
class AuthService {
|
||||||
constructor(public cryptoService: CryptoService, public apiService: any, public userService: any,
|
constructor(public cryptoService: CryptoService, public apiService: any, public userService: any,
|
||||||
public tokenService: any, public $rootScope: any, public appIdService: 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) {
|
public messagingService: MessagingService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class AuthService {
|
||||||
const storedTwoFactorToken = await this.tokenService.getTwoFactorToken(email);
|
const storedTwoFactorToken = await this.tokenService.getTwoFactorToken(email);
|
||||||
const hashedPassword = await this.cryptoService.hashPassword(masterPassword, key);
|
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;
|
let request: TokenRequest;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service';
|
|
||||||
import { CryptoService } from '../../../services/abstractions/crypto.service';
|
import { CryptoService } from '../../../services/abstractions/crypto.service';
|
||||||
|
import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service';
|
||||||
import { StorageService } from '../../../services/abstractions/storage.service';
|
import { StorageService } from '../../../services/abstractions/storage.service';
|
||||||
import { UtilsService } from '../../../services/abstractions/utils.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 syncService = getBackgroundService<any>('syncService');
|
||||||
export const autofillService = getBackgroundService<any>('autofillService');
|
export const autofillService = getBackgroundService<any>('autofillService');
|
||||||
export const passwordGenerationService = getBackgroundService<any>('passwordGenerationService');
|
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 utilsService = getBackgroundService<UtilsService>('utilsService');
|
||||||
export const appIdService = getBackgroundService<any>('appIdService');
|
export const appIdService = getBackgroundService<any>('appIdService');
|
||||||
export const i18nService = getBackgroundService<any>('i18nService');
|
export const i18nService = getBackgroundService<any>('i18nService');
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { ValidationService } from './validation.service';
|
||||||
|
|
||||||
import BrowserMessagingService from '../../../services/browserMessaging.service';
|
import BrowserMessagingService from '../../../services/browserMessaging.service';
|
||||||
|
|
||||||
const messagingService = new BrowserMessagingService(backgroundServices.browserUtilsService());
|
const messagingService = new BrowserMessagingService(backgroundServices.platformUtilsService());
|
||||||
|
|
||||||
export default angular
|
export default angular
|
||||||
.module('bit.services', ['toastr'])
|
.module('bit.services', ['toastr'])
|
||||||
|
@ -25,7 +25,7 @@ export default angular
|
||||||
.factory('syncService', backgroundServices.syncService)
|
.factory('syncService', backgroundServices.syncService)
|
||||||
.factory('autofillService', backgroundServices.autofillService)
|
.factory('autofillService', backgroundServices.autofillService)
|
||||||
.factory('passwordGenerationService', backgroundServices.passwordGenerationService)
|
.factory('passwordGenerationService', backgroundServices.passwordGenerationService)
|
||||||
.factory('browserUtilsService', backgroundServices.browserUtilsService)
|
.factory('platformUtilsService', backgroundServices.platformUtilsService)
|
||||||
.factory('utilsService', backgroundServices.utilsService)
|
.factory('utilsService', backgroundServices.utilsService)
|
||||||
.factory('appIdService', backgroundServices.appIdService)
|
.factory('appIdService', backgroundServices.appIdService)
|
||||||
.factory('i18nService', backgroundServices.i18nService)
|
.factory('i18nService', backgroundServices.i18nService)
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import * as angular from 'angular';
|
import * as angular from 'angular';
|
||||||
import BrowserUtilsService from '../../../services/browserUtils.service';
|
|
||||||
import * as template from './environment.component.html';
|
import * as template from './environment.component.html';
|
||||||
|
|
||||||
|
import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service';
|
||||||
|
|
||||||
export class EnvironmentController {
|
export class EnvironmentController {
|
||||||
iconsUrl: string;
|
iconsUrl: string;
|
||||||
identityUrl: string;
|
identityUrl: string;
|
||||||
|
@ -10,12 +11,12 @@ export class EnvironmentController {
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
i18n: any;
|
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) {
|
private environmentService: any, private toastr: any, private $timeout: ng.ITimeoutService) {
|
||||||
this.i18n = i18nService;
|
this.i18n = i18nService;
|
||||||
|
|
||||||
$timeout(() => {
|
$timeout(() => {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
this.baseUrl = environmentService.baseUrl || '';
|
this.baseUrl = environmentService.baseUrl || '';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import * as angular from 'angular';
|
||||||
import { Folder } from '../../../../models/domain/folder';
|
import { Folder } from '../../../../models/domain/folder';
|
||||||
import * as template from './add-folder.component.html';
|
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 {
|
export class AddFolderController {
|
||||||
savePromise: any;
|
savePromise: any;
|
||||||
|
@ -10,9 +10,10 @@ export class AddFolderController {
|
||||||
i18n: any;
|
i18n: any;
|
||||||
|
|
||||||
constructor(private folderService: any, private $state: any, private toastr: 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(() => {
|
$timeout(() => {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
document.getElementById('name').focus();
|
document.getElementById('name').focus();
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import * as angular from 'angular';
|
||||||
import { Folder } from '../../../../models/domain/folder';
|
import { Folder } from '../../../../models/domain/folder';
|
||||||
import * as template from './edit-folder.component.html';
|
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 {
|
export class EditFolderController {
|
||||||
$transition$: any;
|
$transition$: any;
|
||||||
|
@ -12,12 +12,12 @@ export class EditFolderController {
|
||||||
folder: Folder;
|
folder: Folder;
|
||||||
|
|
||||||
constructor($scope: any, $stateParams: any, private folderService: any, private toastr: any, private $state: any,
|
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) {
|
private i18nService: any, $timeout: any) {
|
||||||
this.i18n = i18nService;
|
this.i18n = i18nService;
|
||||||
|
|
||||||
$timeout(() => {
|
$timeout(() => {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
document.getElementById('name').focus();
|
document.getElementById('name').focus();
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as angular from 'angular';
|
import * as angular from 'angular';
|
||||||
import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service';
|
|
||||||
import { MessagingService } from '../../../services/abstractions/messaging.service';
|
import { MessagingService } from '../../../services/abstractions/messaging.service';
|
||||||
|
import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service';
|
||||||
import { StorageService } from '../../../services/abstractions/storage.service';
|
import { StorageService } from '../../../services/abstractions/storage.service';
|
||||||
import StateService from '../services/state.service';
|
import StateService from '../services/state.service';
|
||||||
import * as template from './options.component.html';
|
import * as template from './options.component.html';
|
||||||
|
@ -15,13 +15,13 @@ export class OptionsController {
|
||||||
i18n: any;
|
i18n: any;
|
||||||
|
|
||||||
constructor(private i18nService: any, private $analytics: any, private constantsService: any,
|
constructor(private i18nService: any, private $analytics: any, private constantsService: any,
|
||||||
private browserUtilsService: BrowserUtilsService, private totpService: any, private stateService: StateService,
|
private platformUtilsService: PlatformUtilsService, private totpService: any,
|
||||||
private storageService: StorageService, public messagingService: MessagingService,
|
private stateService: StateService, private storageService: StorageService,
|
||||||
private $timeout: ng.ITimeoutService) {
|
public messagingService: MessagingService, private $timeout: ng.ITimeoutService) {
|
||||||
this.i18n = i18nService;
|
this.i18n = i18nService;
|
||||||
|
|
||||||
$timeout(() => {
|
$timeout(() => {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
this.loadSettings();
|
this.loadSettings();
|
||||||
|
@ -33,7 +33,7 @@ export class OptionsController {
|
||||||
|
|
||||||
const disableGa = await this.storageService.get<boolean>(
|
const disableGa = await this.storageService.get<boolean>(
|
||||||
this.constantsService.disableGaKey);
|
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.disableAddLoginNotification = await this.storageService.get<boolean>(
|
||||||
this.constantsService.disableAddLoginNotificationKey);
|
this.constantsService.disableAddLoginNotificationKey);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import * as angular from 'angular';
|
import * as angular from 'angular';
|
||||||
import { DeviceType } from '../../../enums/deviceType.enum';
|
import { DeviceType } from '../../../enums/deviceType.enum';
|
||||||
import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service';
|
|
||||||
import { CryptoService } from '../../../services/abstractions/crypto.service';
|
import { CryptoService } from '../../../services/abstractions/crypto.service';
|
||||||
import { MessagingService } from '../../../services/abstractions/messaging.service';
|
import { MessagingService } from '../../../services/abstractions/messaging.service';
|
||||||
|
import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service';
|
||||||
import { StorageService } from '../../../services/abstractions/storage.service';
|
import { StorageService } from '../../../services/abstractions/storage.service';
|
||||||
import ConstantsService from '../../../services/constants.service';
|
import ConstantsService from '../../../services/constants.service';
|
||||||
|
|
||||||
|
@ -28,17 +28,17 @@ export class SettingsController {
|
||||||
i18n: any;
|
i18n: any;
|
||||||
showOnLocked: boolean;
|
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 $analytics: any, private i18nService: any, private constantsService: ConstantsService,
|
||||||
private cryptoService: CryptoService, private lockService: any, private storageService: StorageService,
|
private cryptoService: CryptoService, private lockService: any, private storageService: StorageService,
|
||||||
public messagingService: MessagingService, private $timeout: ng.ITimeoutService) {
|
public messagingService: MessagingService, private $timeout: ng.ITimeoutService) {
|
||||||
this.i18n = i18nService;
|
this.i18n = i18nService;
|
||||||
|
|
||||||
$timeout(() => {
|
$timeout(() => {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
this.showOnLocked = !browserUtilsService.isFirefox() && !browserUtilsService.isEdge();
|
this.showOnLocked = !platformUtilsService.isFirefox() && !platformUtilsService.isEdge();
|
||||||
this.storageService.get(constantsService.lockOptionKey).then((lockOption: number) => {
|
this.storageService.get(constantsService.lockOptionKey).then((lockOption: number) => {
|
||||||
if (lockOption != null) {
|
if (lockOption != null) {
|
||||||
let option = lockOption.toString();
|
let option = lockOption.toString();
|
||||||
|
@ -147,7 +147,7 @@ export class SettingsController {
|
||||||
rate() {
|
rate() {
|
||||||
this.$analytics.eventTrack('Rate Extension');
|
this.$analytics.eventTrack('Rate Extension');
|
||||||
chrome.tabs.create({
|
chrome.tabs.create({
|
||||||
url: RateUrls[this.browserUtilsService.getDevice()],
|
url: RateUrls[this.platformUtilsService.getDevice()],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as angular from 'angular';
|
import * as angular from 'angular';
|
||||||
import * as template from './password-generator.component.html';
|
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 {
|
export class PasswordGeneratorController {
|
||||||
$transition$: any;
|
$transition$: any;
|
||||||
|
@ -13,7 +13,7 @@ export class PasswordGeneratorController {
|
||||||
i18n: any;
|
i18n: any;
|
||||||
|
|
||||||
constructor(private $state: any, private passwordGenerationService: any,
|
constructor(private $state: any, private passwordGenerationService: any,
|
||||||
private toastr: any, private browserUtilsService: BrowserUtilsService, private $analytics: any,
|
private toastr: any, private platformUtilsService: PlatformUtilsService, private $analytics: any,
|
||||||
private i18nService: any, private $timeout: any) {
|
private i18nService: any, private $timeout: any) {
|
||||||
this.i18n = i18nService;
|
this.i18n = i18nService;
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ export class PasswordGeneratorController {
|
||||||
this.showSelect = this.addState || this.editState;
|
this.showSelect = this.addState || this.editState;
|
||||||
|
|
||||||
this.$timeout(() => {
|
this.$timeout(() => {
|
||||||
this.browserUtilsService.initListSectionItemListeners(document, angular);
|
this.platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as template from './tools.component.html';
|
import * as template from './tools.component.html';
|
||||||
|
|
||||||
import { BrowserUtilsService } from '../../../services/abstractions/browserUtils.service';
|
import { PlatformUtilsService } from '../../../services/abstractions/platformUtils.service';
|
||||||
|
|
||||||
export class ToolsController {
|
export class ToolsController {
|
||||||
showExport: boolean;
|
showExport: boolean;
|
||||||
|
@ -8,10 +8,10 @@ export class ToolsController {
|
||||||
private webVaultBaseUrl: string = 'https://vault.bitwarden.com';
|
private webVaultBaseUrl: string = 'https://vault.bitwarden.com';
|
||||||
|
|
||||||
constructor(private SweetAlert: any, private i18nService: any,
|
constructor(private SweetAlert: any, private i18nService: any,
|
||||||
private $analytics: any, private browserUtilsService: BrowserUtilsService,
|
private $analytics: any, private platformUtilsService: PlatformUtilsService,
|
||||||
private environmentService: any) {
|
private environmentService: any) {
|
||||||
this.i18n = i18nService;
|
this.i18n = i18nService;
|
||||||
this.showExport = !browserUtilsService.isEdge();
|
this.showExport = !platformUtilsService.isEdge();
|
||||||
if (environmentService.baseUrl) {
|
if (environmentService.baseUrl) {
|
||||||
this.webVaultBaseUrl = environmentService.baseUrl;
|
this.webVaultBaseUrl = environmentService.baseUrl;
|
||||||
} else if (environmentService.webVaultUrl) {
|
} else if (environmentService.webVaultUrl) {
|
||||||
|
|
|
@ -2,7 +2,7 @@ angular
|
||||||
.module('bit.vault')
|
.module('bit.vault')
|
||||||
|
|
||||||
.controller('vaultAddCipherController', function ($scope, $state, $stateParams, cipherService, folderService,
|
.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.i18n = i18nService;
|
||||||
$scope.constants = constantsService;
|
$scope.constants = constantsService;
|
||||||
$scope.addFieldType = constantsService.fieldType.text.toString();
|
$scope.addFieldType = constantsService.fieldType.text.toString();
|
||||||
|
@ -31,7 +31,7 @@ angular
|
||||||
}
|
}
|
||||||
|
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
|
|
||||||
if (!$stateParams.cipher && $scope.cipher.name && $scope.cipher.login && $scope.cipher.login.uri) {
|
if (!$stateParams.cipher && $scope.cipher.name && $scope.cipher.login && $scope.cipher.login.uri) {
|
||||||
document.getElementById('loginUsername').focus();
|
document.getElementById('loginUsername').focus();
|
||||||
|
@ -49,7 +49,7 @@ angular
|
||||||
$scope.cipher.type = parseInt($scope.selectedType);
|
$scope.cipher.type = parseInt($scope.selectedType);
|
||||||
|
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ angular
|
||||||
});
|
});
|
||||||
|
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@ angular
|
||||||
.module('bit.vault')
|
.module('bit.vault')
|
||||||
|
|
||||||
.controller('vaultAttachmentsController', function ($scope, $state, $stateParams, cipherService, toastr,
|
.controller('vaultAttachmentsController', function ($scope, $state, $stateParams, cipherService, toastr,
|
||||||
SweetAlert, browserUtilsService, $analytics, i18nService, cryptoService, tokenService, $timeout) {
|
SweetAlert, platformUtilsService, $analytics, i18nService, cryptoService, tokenService, $timeout) {
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
$scope.i18n = i18nService;
|
$scope.i18n = i18nService;
|
||||||
|
|
|
@ -2,14 +2,14 @@ angular
|
||||||
.module('bit.vault')
|
.module('bit.vault')
|
||||||
|
|
||||||
.controller('vaultController', function ($scope, $rootScope, cipherService, folderService, $q, $state, $stateParams, toastr,
|
.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',
|
var stateKey = 'vault',
|
||||||
state = stateService.getState(stateKey) || {};
|
state = stateService.getState(stateKey) || {};
|
||||||
stateService.removeState('viewGrouping');
|
stateService.removeState('viewGrouping');
|
||||||
|
|
||||||
$scope.i18n = i18nService;
|
$scope.i18n = i18nService;
|
||||||
$scope.showGroupingCounts = !browserUtilsService.isEdge();
|
$scope.showGroupingCounts = !platformUtilsService.isEdge();
|
||||||
$scope.disableSearch = browserUtilsService.isEdge();
|
$scope.disableSearch = platformUtilsService.isEdge();
|
||||||
document.getElementById('search').focus();
|
document.getElementById('search').focus();
|
||||||
|
|
||||||
var syncOnLoad = $stateParams.syncOnLoad;
|
var syncOnLoad = $stateParams.syncOnLoad;
|
||||||
|
|
|
@ -2,15 +2,15 @@ angular
|
||||||
.module('bit.vault')
|
.module('bit.vault')
|
||||||
|
|
||||||
.controller('vaultEditCipherController', function ($scope, $state, $stateParams, cipherService, folderService,
|
.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 () {
|
$timeout(function () {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
document.getElementById('name').focus();
|
document.getElementById('name').focus();
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
$scope.i18n = i18nService;
|
$scope.i18n = i18nService;
|
||||||
$scope.constants = constantsService;
|
$scope.constants = constantsService;
|
||||||
$scope.showAttachments = !browserUtilsService.isEdge();
|
$scope.showAttachments = !platformUtilsService.isEdge();
|
||||||
$scope.addFieldType = constantsService.fieldType.text.toString();
|
$scope.addFieldType = constantsService.fieldType.text.toString();
|
||||||
$scope.selectedType = constantsService.cipherType.login.toString();
|
$scope.selectedType = constantsService.cipherType.login.toString();
|
||||||
var cipherId = $stateParams.cipherId;
|
var cipherId = $stateParams.cipherId;
|
||||||
|
@ -40,7 +40,7 @@ angular
|
||||||
$scope.cipher.type = parseInt($scope.selectedType);
|
$scope.cipher.type = parseInt($scope.selectedType);
|
||||||
|
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ angular
|
||||||
});
|
});
|
||||||
|
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
browserUtilsService.initListSectionItemListeners(document, angular);
|
platformUtilsService.initListSectionItemListeners(document, angular);
|
||||||
}, 500);
|
}, 500);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@ angular
|
||||||
.module('bit.vault')
|
.module('bit.vault')
|
||||||
|
|
||||||
.controller('vaultViewCipherController', function ($scope, $state, $stateParams, cipherService, toastr,
|
.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) {
|
constantsService) {
|
||||||
$scope.constants = constantsService;
|
$scope.constants = constantsService;
|
||||||
$scope.i18n = i18nService;
|
$scope.i18n = i18nService;
|
||||||
$scope.showAttachments = !browserUtilsService.isEdge();
|
$scope.showAttachments = !platformUtilsService.isEdge();
|
||||||
var from = $stateParams.from,
|
var from = $stateParams.from,
|
||||||
totpInterval = null;
|
totpInterval = null;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ angular
|
||||||
|
|
||||||
if (model.login.uri) {
|
if (model.login.uri) {
|
||||||
$scope.cipher.showLaunch = model.login.uri.startsWith('http://') || model.login.uri.startsWith('https://');
|
$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) {
|
if (domain) {
|
||||||
$scope.cipher.login.website = domain;
|
$scope.cipher.login.website = domain;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ angular
|
||||||
.module('bit.vault')
|
.module('bit.vault')
|
||||||
|
|
||||||
.controller('vaultViewGroupingController', function ($scope, cipherService, folderService, $q, $state, $stateParams, toastr,
|
.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',
|
var stateKey = 'viewGrouping',
|
||||||
state = stateService.getState(stateKey) || {};
|
state = stateService.getState(stateKey) || {};
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ angular
|
||||||
|
|
||||||
var cipherPromise = cipherService.getAllDecryptedForGrouping($scope.grouping.id, $scope.folderGrouping)
|
var cipherPromise = cipherService.getAllDecryptedForGrouping($scope.grouping.id, $scope.folderGrouping)
|
||||||
.then(function (ciphers) {
|
.then(function (ciphers) {
|
||||||
if (browserUtilsService.isEdge()) {
|
if (platformUtilsService.isEdge()) {
|
||||||
// Edge is super slow at sorting
|
// Edge is super slow at sorting
|
||||||
decCiphers = ciphers;
|
decCiphers = ciphers;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var gaTrackingId = bgMain.browserUtilsService.analyticsId();
|
var gaTrackingId = bgMain.platformUtilsService.analyticsId();
|
||||||
var gaFunc = null;
|
var gaFunc = null;
|
||||||
var isFirefox = bgMain.browserUtilsService.isFirefox();
|
var isFirefox = bgMain.platformUtilsService.isFirefox();
|
||||||
|
|
||||||
window.GoogleAnalyticsObject = 'ga';
|
window.GoogleAnalyticsObject = 'ga';
|
||||||
window[window.GoogleAnalyticsObject] = function (action, param1, param2, param3, param4) {
|
window[window.GoogleAnalyticsObject] = function (action, param1, param2, param3, param4) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { DeviceType } from '../../enums/deviceType.enum';
|
import { DeviceType } from '../../enums/deviceType.enum';
|
||||||
|
|
||||||
export interface BrowserUtilsService {
|
export interface PlatformUtilsService {
|
||||||
getDevice(): DeviceType;
|
getDevice(): DeviceType;
|
||||||
getDeviceString(): string;
|
getDeviceString(): string;
|
||||||
isFirefox(): boolean;
|
isFirefox(): boolean;
|
|
@ -1,8 +1,9 @@
|
||||||
import AppIdService from './appId.service';
|
import AppIdService from './appId.service';
|
||||||
import BrowserUtilsService from './browserUtils.service';
|
|
||||||
import ConstantsService from './constants.service';
|
import ConstantsService from './constants.service';
|
||||||
import TokenService from './token.service';
|
import TokenService from './token.service';
|
||||||
|
|
||||||
|
import { PlatformUtilsService } from './abstractions/platformUtils.service';
|
||||||
|
|
||||||
import EnvironmentUrls from '../models/domain/environmentUrls';
|
import EnvironmentUrls from '../models/domain/environmentUrls';
|
||||||
|
|
||||||
import { CipherRequest } from '../models/request/cipherRequest';
|
import { CipherRequest } from '../models/request/cipherRequest';
|
||||||
|
@ -35,10 +36,10 @@ export default class ApiService {
|
||||||
deviceType: string;
|
deviceType: string;
|
||||||
logoutCallback: Function;
|
logoutCallback: Function;
|
||||||
|
|
||||||
constructor(private tokenService: TokenService, browserUtilsService: BrowserUtilsService,
|
constructor(private tokenService: TokenService, platformUtilsService: PlatformUtilsService,
|
||||||
logoutCallback: Function) {
|
logoutCallback: Function) {
|
||||||
this.logoutCallback = logoutCallback;
|
this.logoutCallback = logoutCallback;
|
||||||
this.deviceType = browserUtilsService.getDevice().toString();
|
this.deviceType = platformUtilsService.getDevice().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
setUrls(urls: EnvironmentUrls) {
|
setUrls(urls: EnvironmentUrls) {
|
||||||
|
|
|
@ -5,12 +5,13 @@ import AutofillField from '../models/domain/autofillField';
|
||||||
import AutofillPageDetails from '../models/domain/autofillPageDetails';
|
import AutofillPageDetails from '../models/domain/autofillPageDetails';
|
||||||
import AutofillScript from '../models/domain/autofillScript';
|
import AutofillScript from '../models/domain/autofillScript';
|
||||||
|
|
||||||
import BrowserUtilsService from './browserUtils.service';
|
|
||||||
import CipherService from './cipher.service';
|
import CipherService from './cipher.service';
|
||||||
import TokenService from './token.service';
|
import TokenService from './token.service';
|
||||||
import TotpService from './totp.service';
|
import TotpService from './totp.service';
|
||||||
import UtilsService from './utils.service';
|
import UtilsService from './utils.service';
|
||||||
|
|
||||||
|
import { PlatformUtilsService } from '../services/abstractions/platformUtils.service';
|
||||||
|
|
||||||
const CardAttributes: string[] = ['autoCompleteType', 'data-stripe', 'htmlName', 'htmlID', 'label-tag',
|
const CardAttributes: string[] = ['autoCompleteType', 'data-stripe', 'htmlName', 'htmlID', 'label-tag',
|
||||||
'placeholder', 'label-left', 'label-top'];
|
'placeholder', 'label-left', 'label-top'];
|
||||||
|
|
||||||
|
@ -94,7 +95,7 @@ var IsoProvinces: { [id: string]: string; } = {
|
||||||
export default class AutofillService {
|
export default class AutofillService {
|
||||||
constructor(public cipherService: CipherService, public tokenService: TokenService,
|
constructor(public cipherService: CipherService, public tokenService: TokenService,
|
||||||
public totpService: TotpService, public utilsService: UtilsService,
|
public totpService: TotpService, public utilsService: UtilsService,
|
||||||
public browserUtilsService: BrowserUtilsService) {
|
public platformUtilsService: PlatformUtilsService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
getFormsWithPasswordFields(pageDetails: AutofillPageDetails): any[] {
|
getFormsWithPasswordFields(pageDetails: AutofillPageDetails): any[] {
|
||||||
|
@ -169,7 +170,7 @@ export default class AutofillService {
|
||||||
}, { frameId: pd.frameId });
|
}, { frameId: pd.frameId });
|
||||||
|
|
||||||
if (options.cipher.type !== CipherType.Login || totpPromise ||
|
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()) {
|
!options.cipher.login.totp || !this.tokenService.getPremium()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +208,7 @@ export default class AutofillService {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tabDomain = BrowserUtilsService.getDomain(tab.url);
|
const tabDomain = this.platformUtilsService.getDomain(tab.url);
|
||||||
if (tabDomain == null) {
|
if (tabDomain == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { BrowserUtilsService } from './abstractions/browserUtils.service';
|
|
||||||
import { MessagingService as MessagingServiceInterface } from './abstractions/messaging.service';
|
import { MessagingService as MessagingServiceInterface } from './abstractions/messaging.service';
|
||||||
|
import { PlatformUtilsService } from './abstractions/platformUtils.service';
|
||||||
|
|
||||||
export default class BrowserMessagingService implements MessagingServiceInterface {
|
export default class BrowserMessagingService implements MessagingServiceInterface {
|
||||||
constructor(private browserUtilsService: BrowserUtilsService) {
|
constructor(private platformUtilsService: PlatformUtilsService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
send(subscriber: string, arg: any = {}) {
|
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';
|
import { StorageService as StorageServiceInterface } from './abstractions/storage.service';
|
||||||
|
|
||||||
export default class BrowserStorageService implements StorageServiceInterface {
|
export default class BrowserStorageService implements StorageServiceInterface {
|
||||||
constructor(private browserUtilsService: BrowserUtilsService) {
|
constructor(private platformUtilsService: PlatformUtilsService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
get<T>(key: string): Promise<T> {
|
get<T>(key: string): Promise<T> {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as tldjs from 'tldjs';
|
import * as tldjs from 'tldjs';
|
||||||
import { DeviceType } from '../enums/deviceType.enum';
|
import { DeviceType } from '../enums/deviceType.enum';
|
||||||
import { BrowserUtilsService as BrowserUtilsServiceInterface } from './abstractions/browserUtils.service';
|
import { PlatformUtilsService as PlatformUtilsServiceInterface } from './abstractions/platformUtils.service';
|
||||||
|
|
||||||
const AnalyticsIds = {
|
const AnalyticsIds = {
|
||||||
[DeviceType.Chrome]: 'UA-81915606-6',
|
[DeviceType.Chrome]: 'UA-81915606-6',
|
||||||
|
@ -11,7 +11,7 @@ const AnalyticsIds = {
|
||||||
[DeviceType.Safari]: 'UA-81915606-16',
|
[DeviceType.Safari]: 'UA-81915606-16',
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class BrowserUtilsService implements BrowserUtilsServiceInterface {
|
export default class BrowserUtilsService implements PlatformUtilsServiceInterface {
|
||||||
static getDomain(uriString: string): string {
|
static getDomain(uriString: string): string {
|
||||||
if (uriString == null) {
|
if (uriString == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import BrowserUtilsService from './browserUtils.service';
|
import { PlatformUtilsService } from './abstractions/platformUtils.service';
|
||||||
|
|
||||||
export default class ConstantsService {
|
export default class ConstantsService {
|
||||||
static readonly environmentUrlsKey: string = 'environmentUrls';
|
static readonly environmentUrlsKey: string = 'environmentUrls';
|
||||||
|
@ -57,8 +57,8 @@ export default class ConstantsService {
|
||||||
|
|
||||||
twoFactorProviderInfo: any[];
|
twoFactorProviderInfo: any[];
|
||||||
|
|
||||||
constructor(i18nService: any, browserUtilsService: BrowserUtilsService) {
|
constructor(i18nService: any, platformUtilsService: PlatformUtilsService) {
|
||||||
if (browserUtilsService.isEdge()) {
|
if (platformUtilsService.isEdge()) {
|
||||||
// delay for i18n fetch
|
// delay for i18n fetch
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.bootstrap(i18nService);
|
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 = {};
|
const edgeMessages: any = {};
|
||||||
|
|
||||||
if (browserUtilsService.isEdge()) {
|
if (platformUtilsService.isEdge()) {
|
||||||
fetch('../_locales/en/messages.json').then((file) => {
|
fetch('../_locales/en/messages.json').then((file) => {
|
||||||
return file.json();
|
return file.json();
|
||||||
}).then((locales) => {
|
}).then((locales) => {
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
import BrowserUtilsService from './browserUtils.service';
|
|
||||||
import CipherService from './cipher.service';
|
import CipherService from './cipher.service';
|
||||||
import CollectionService from './collection.service';
|
import CollectionService from './collection.service';
|
||||||
import ConstantsService from './constants.service';
|
import ConstantsService from './constants.service';
|
||||||
import CryptoService from './crypto.service';
|
import CryptoService from './crypto.service';
|
||||||
import FolderService from './folder.service';
|
import FolderService from './folder.service';
|
||||||
|
|
||||||
|
import { PlatformUtilsService } from './abstractions/platformUtils.service';
|
||||||
import { StorageService } from './abstractions/storage.service';
|
import { StorageService } from './abstractions/storage.service';
|
||||||
|
|
||||||
export default class LockService {
|
export default class LockService {
|
||||||
constructor(private cipherService: CipherService, private folderService: FolderService,
|
constructor(private cipherService: CipherService, private folderService: FolderService,
|
||||||
private collectionService: CollectionService, private cryptoService: CryptoService,
|
private collectionService: CollectionService, private cryptoService: CryptoService,
|
||||||
private browserUtilsService: BrowserUtilsService, private storageService: StorageService,
|
private platformUtilsService: PlatformUtilsService, private storageService: StorageService,
|
||||||
private setIcon: Function, private refreshBadgeAndMenu: Function) {
|
private setIcon: Function, private refreshBadgeAndMenu: Function) {
|
||||||
this.checkLock();
|
this.checkLock();
|
||||||
setInterval(() => this.checkLock(), 10 * 1000); // check every 10 seconds
|
setInterval(() => this.checkLock(), 10 * 1000); // check every 10 seconds
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkLock(): Promise<void> {
|
async checkLock(): Promise<void> {
|
||||||
if (this.browserUtilsService.isViewOpen()) {
|
if (this.platformUtilsService.isViewOpen()) {
|
||||||
// Do not lock
|
// Do not lock
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue