mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
interfaced utilsservice for popup and dependencies
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import * as template from './action-buttons.component.html';
|
||||
|
||||
import { UtilsService } from '../../../services/abstractions/utils.service';
|
||||
|
||||
class ActionButtonsController implements ng.IController {
|
||||
onView: Function;
|
||||
|
||||
@@ -9,7 +11,7 @@ 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 utilsService: any) {
|
||||
private $timeout: any, private $window: any, private utilsService: UtilsService) {
|
||||
this.i18n = i18nService;
|
||||
this.constants = constantsService;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import CryptoService from '../../../services/crypto.service';
|
||||
import UserService from '../../../services/user.service';
|
||||
|
||||
import * as template from './lock.component.html';
|
||||
|
||||
class LockController {
|
||||
i18n: any;
|
||||
|
||||
constructor(public $scope: any, public $state: any, public i18nService: any,
|
||||
public cryptoService: CryptoService, public toastr: any, public userService: UserService,
|
||||
public cryptoService: any, public toastr: any, public userService: any,
|
||||
public SweetAlert: any, public $timeout: any) {
|
||||
this.i18n = i18nService;
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { DeviceRequest } from '../../../models/request/deviceRequest';
|
||||
import { TokenRequest } from '../../../models/request/tokenRequest';
|
||||
|
||||
class AuthService {
|
||||
import { UtilsService } from '../../../services/abstractions/utils.service';
|
||||
|
||||
class AuthService {
|
||||
constructor(public cryptoService: any, public apiService: any, public userService: any, public tokenService: any,
|
||||
public $rootScope: any, public appIdService: any, public utilsService: any,
|
||||
public $rootScope: any, public appIdService: any, public utilsService: UtilsService,
|
||||
public constantsService: any) {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,24 +1,26 @@
|
||||
function getBackgroundService(service: string) {
|
||||
return () => {
|
||||
import { UtilsService } from '../../../services/abstractions/utils.service';
|
||||
|
||||
function getBackgroundService<T>(service: string) {
|
||||
return (): T => {
|
||||
const page = chrome.extension.getBackgroundPage();
|
||||
return page ? page['bg_' + service] : null;
|
||||
return page ? page['bg_' + service] as T : null;
|
||||
};
|
||||
}
|
||||
|
||||
export const tokenService = getBackgroundService('tokenService');
|
||||
export const cryptoService = getBackgroundService('cryptoService');
|
||||
export const userService = getBackgroundService('userService');
|
||||
export const apiService = getBackgroundService('apiService');
|
||||
export const folderService = getBackgroundService('folderService');
|
||||
export const cipherService = getBackgroundService('cipherService');
|
||||
export const syncService = getBackgroundService('syncService');
|
||||
export const autofillService = getBackgroundService('autofillService');
|
||||
export const passwordGenerationService = getBackgroundService('passwordGenerationService');
|
||||
export const utilsService = getBackgroundService('utilsService');
|
||||
export const appIdService = getBackgroundService('appIdService');
|
||||
export const i18nService = getBackgroundService('i18nService');
|
||||
export const constantsService = getBackgroundService('constantsService');
|
||||
export const settingsService = getBackgroundService('settingsService');
|
||||
export const lockService = getBackgroundService('lockService');
|
||||
export const totpService = getBackgroundService('totpService');
|
||||
export const environmentService = getBackgroundService('environmentService');
|
||||
export const tokenService = getBackgroundService<any>('tokenService');
|
||||
export const cryptoService = getBackgroundService<any>('cryptoService');
|
||||
export const userService = getBackgroundService<any>('userService');
|
||||
export const apiService = getBackgroundService<any>('apiService');
|
||||
export const folderService = getBackgroundService<any>('folderService');
|
||||
export const cipherService = getBackgroundService<any>('cipherService');
|
||||
export const syncService = getBackgroundService<any>('syncService');
|
||||
export const autofillService = getBackgroundService<any>('autofillService');
|
||||
export const passwordGenerationService = getBackgroundService<any>('passwordGenerationService');
|
||||
export const utilsService = getBackgroundService<UtilsService>('utilsService');
|
||||
export const appIdService = getBackgroundService<any>('appIdService');
|
||||
export const i18nService = getBackgroundService<any>('i18nService');
|
||||
export const constantsService = getBackgroundService<any>('constantsService');
|
||||
export const settingsService = getBackgroundService<any>('settingsService');
|
||||
export const lockService = getBackgroundService<any>('lockService');
|
||||
export const totpService = getBackgroundService<any>('totpService');
|
||||
export const environmentService = getBackgroundService<any>('environmentService');
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import { UtilsService } from '../../../services/abstractions/utils.service';
|
||||
|
||||
class StateService {
|
||||
private state: any = {};
|
||||
|
||||
constructor(private utilsService: any, private constantsService: any) {
|
||||
constructor(private utilsService: UtilsService, private constantsService: any) {
|
||||
}
|
||||
|
||||
async init() {
|
||||
const faviconsDisabled = await this.utilsService
|
||||
.getObjFromStorage(this.constantsService.disableFaviconKey);
|
||||
.getObjFromStorage<boolean>(this.constantsService.disableFaviconKey);
|
||||
|
||||
this.saveState('faviconEnabled', !faviconsDisabled);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ angular
|
||||
$scope.rate = function () {
|
||||
$analytics.eventTrack('Rate Extension');
|
||||
|
||||
switch (utilsService.getBrowser()) {
|
||||
switch (utilsService.getBrowserString()) {
|
||||
case 'chrome':
|
||||
chrome.tabs.create({
|
||||
url: 'https://chrome.google.com/webstore/detail/bitwarden-free-password-m/' +
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import * as angular from 'angular';
|
||||
import * as template from './password-generator.component.html';
|
||||
|
||||
import { UtilsService } from '../../../services/abstractions/utils.service';
|
||||
|
||||
export class PasswordGeneratorController {
|
||||
$transition$: any;
|
||||
options: any;
|
||||
@@ -11,7 +13,7 @@ export class PasswordGeneratorController {
|
||||
i18n: any;
|
||||
|
||||
constructor(private $state: any, private passwordGenerationService: any,
|
||||
private toastr: any, private utilsService: any, private $analytics: any,
|
||||
private toastr: any, private utilsService: UtilsService, private $analytics: any,
|
||||
private i18nService: any, private $timeout: any) {
|
||||
this.i18n = i18nService;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import UtilsService from '../../../services/utils.service';
|
||||
import * as template from './tools.component.html';
|
||||
|
||||
import { UtilsService } from '../../../services/abstractions/utils.service';
|
||||
|
||||
class ToolsController {
|
||||
showExport: boolean;
|
||||
i18n: any;
|
||||
|
||||
Reference in New Issue
Block a user