aboutsummaryrefslogtreecommitdiff
path: root/src/background
diff options
context:
space:
mode:
Diffstat (limited to 'src/background')
-rw-r--r--src/background/controllers/SettingController.ts2
-rw-r--r--src/background/infrastructures/ContentMessageListener.ts3
-rw-r--r--src/background/repositories/SettingRepository.ts7
-rw-r--r--src/background/usecases/SettingUseCase.ts2
4 files changed, 6 insertions, 8 deletions
diff --git a/src/background/controllers/SettingController.ts b/src/background/controllers/SettingController.ts
index 34951ff..8d05852 100644
--- a/src/background/controllers/SettingController.ts
+++ b/src/background/controllers/SettingController.ts
@@ -1,7 +1,7 @@
import { injectable } from 'tsyringe';
import SettingUseCase from '../usecases/SettingUseCase';
import ContentMessageClient from '../infrastructures/ContentMessageClient';
-import Settings from '../../shared/Settings';
+import Settings from '../../shared/settings/Settings';
@injectable()
export default class SettingController {
diff --git a/src/background/infrastructures/ContentMessageListener.ts b/src/background/infrastructures/ContentMessageListener.ts
index f348a74..f80d686 100644
--- a/src/background/infrastructures/ContentMessageListener.ts
+++ b/src/background/infrastructures/ContentMessageListener.ts
@@ -8,7 +8,6 @@ import AddonEnabledController from '../controllers/AddonEnabledController';
import LinkController from '../controllers/LinkController';
import OperationController from '../controllers/OperationController';
import MarkController from '../controllers/MarkController';
-import { toJSON } from '../../shared/Settings';
@injectable()
export default class ContentMessageListener {
@@ -103,7 +102,7 @@ export default class ContentMessageListener {
}
async onSettingsQuery(): Promise<any> {
- return toJSON(await this.settingController.getSetting());
+ return (await this.settingController.getSetting()).toJSON();
}
onFindGetKeyword(): Promise<string> {
diff --git a/src/background/repositories/SettingRepository.ts b/src/background/repositories/SettingRepository.ts
index a11b65f..e775a32 100644
--- a/src/background/repositories/SettingRepository.ts
+++ b/src/background/repositories/SettingRepository.ts
@@ -1,6 +1,6 @@
import { injectable } from 'tsyringe';
import MemoryStorage from '../infrastructures/MemoryStorage';
-import Settings, { valueOf, toJSON } from '../../shared/Settings';
+import Settings from '../../shared/settings/Settings';
import Properties from '../../shared/settings/Properties';
const CACHED_SETTING_KEY = 'setting';
@@ -15,12 +15,11 @@ export default class SettingRepository {
get(): Promise<Settings> {
let data = this.cache.get(CACHED_SETTING_KEY);
- return Promise.resolve(valueOf(data));
+ return Promise.resolve(Settings.fromJSON(data));
}
update(value: Settings): void {
- let data = toJSON(value);
- return this.cache.set(CACHED_SETTING_KEY, data);
+ return this.cache.set(CACHED_SETTING_KEY, value.toJSON());
}
async setProperty(
diff --git a/src/background/usecases/SettingUseCase.ts b/src/background/usecases/SettingUseCase.ts
index d73521f..d78d440 100644
--- a/src/background/usecases/SettingUseCase.ts
+++ b/src/background/usecases/SettingUseCase.ts
@@ -3,7 +3,7 @@ import PersistentSettingRepository
from '../repositories/PersistentSettingRepository';
import SettingRepository from '../repositories/SettingRepository';
import { DefaultSettingData } from '../../shared/SettingData';
-import Settings from '../../shared/Settings';
+import Settings from '../../shared/settings/Settings';
import NotifyPresenter from '../presenters/NotifyPresenter';
@injectable()