1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 08:13:42 +00:00

separated BrowserUtils from generic Utils

This commit is contained in:
Kyle Spearrin
2018-01-04 12:32:10 -05:00
parent ac0126b210
commit 0dd711471b
42 changed files with 474 additions and 451 deletions

View File

@@ -11,7 +11,7 @@ import { Identity } from './identity';
import { Login } from './login';
import { SecureNote } from './secureNote';
import { UtilsService } from '../../services/abstractions/utils.service';
import { BrowserUtilsService } from '../../services/abstractions/browserUtils.service';
class Cipher extends Domain {
id: string;
@@ -32,7 +32,7 @@ class Cipher extends Domain {
fields: Field[];
collectionIds: string[];
private utilsService: UtilsService;
private browserUtilsService: BrowserUtilsService;
constructor(obj?: CipherData, alreadyEncrypted: boolean = false, localData: any = null) {
super();
@@ -119,12 +119,12 @@ class Cipher extends Domain {
model.login = await this.login.decrypt(this.organizationId);
model.subTitle = model.login.username;
if (model.login.uri) {
if (this.utilsService == null) {
this.utilsService = chrome.extension.getBackgroundPage()
.bitwardenMain.utilsService as UtilsService;
if (this.browserUtilsService == null) {
this.browserUtilsService = chrome.extension.getBackgroundPage()
.bitwardenMain.browserUtilsService as BrowserUtilsService;
}
model.login.domain = this.utilsService.getDomain(model.login.uri);
model.login.domain = this.browserUtilsService.getDomain(model.login.uri);
}
break;
case CipherType.SecureNote:

View File

@@ -1,5 +1,5 @@
import { BrowserType } from '../../enums/browserType.enum';
import { UtilsService } from '../../services/abstractions/utils.service';
import { BrowserUtilsService } from '../../services/abstractions/browserUtils.service';
class DeviceRequest {
type: BrowserType;
@@ -7,9 +7,9 @@ class DeviceRequest {
identifier: string;
pushToken?: string;
constructor(appId: string, utilsService: UtilsService) {
this.type = utilsService.getBrowser();
this.name = utilsService.getBrowserString();
constructor(appId: string, browserUtilsService: BrowserUtilsService) {
this.type = browserUtilsService.getBrowser();
this.name = browserUtilsService.getBrowserString();
this.identifier = appId;
this.pushToken = null;
}