mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
rename storage service implementation
This commit is contained in:
parent
d39c5b37dc
commit
701d81a2eb
@ -15,8 +15,8 @@ import ApiService from '../services/api.service';
|
||||
import AppIdService from '../services/appId.service';
|
||||
import AutofillService from '../services/autofill.service';
|
||||
import BrowserMessagingService from '../services/browserMessaging.service';
|
||||
import BrowserStorageService from '../services/browserStorage.service';
|
||||
import BrowserUtilsService from '../services/browserUtils.service';
|
||||
import ChromeStorageService from '../services/chromeStorage.service';
|
||||
import CipherService from '../services/cipher.service';
|
||||
import CollectionService from '../services/collection.service';
|
||||
import ConstantsService from '../services/constants.service';
|
||||
@ -82,7 +82,7 @@ export default class MainBackground {
|
||||
this.utilsService = new UtilsService();
|
||||
this.browserUtilsService = new BrowserUtilsService();
|
||||
this.messagingService = new BrowserMessagingService(this.browserUtilsService);
|
||||
this.storageService = new ChromeStorageService();
|
||||
this.storageService = new BrowserStorageService(this.browserUtilsService);
|
||||
this.i18nService = i18nService(this.browserUtilsService);
|
||||
this.constantsService = new ConstantsService(this.i18nService, this.browserUtilsService);
|
||||
this.cryptoService = ContainerService.cryptoService = new CryptoService(this.storageService,
|
||||
|
@ -1,7 +1,12 @@
|
||||
import { BrowserUtilsService } from './abstractions/browserUtils.service';
|
||||
import { StorageService as StorageServiceInterface } from './abstractions/storage.service';
|
||||
|
||||
export default class ChromeStorageService implements StorageServiceInterface {
|
||||
export default class BrowserStorageService implements StorageServiceInterface {
|
||||
constructor(private browserUtilsService: BrowserUtilsService) {
|
||||
}
|
||||
|
||||
get<T>(key: string): Promise<T> {
|
||||
// if safari, else
|
||||
return new Promise((resolve) => {
|
||||
chrome.storage.local.get(key, (obj: any) => {
|
||||
if (obj && (typeof obj[key] !== 'undefined') && obj[key] !== null) {
|
||||
@ -14,6 +19,7 @@ export default class ChromeStorageService implements StorageServiceInterface {
|
||||
}
|
||||
|
||||
save(key: string, obj: any): Promise<any> {
|
||||
// if safari, else
|
||||
return new Promise((resolve) => {
|
||||
chrome.storage.local.set({ [key]: obj }, () => {
|
||||
resolve();
|
||||
@ -22,6 +28,7 @@ export default class ChromeStorageService implements StorageServiceInterface {
|
||||
}
|
||||
|
||||
remove(key: string): Promise<any> {
|
||||
// if safari, else
|
||||
return new Promise((resolve) => {
|
||||
chrome.storage.local.remove(key, () => {
|
||||
resolve();
|
Loading…
Reference in New Issue
Block a user