From 02e8b55884fd530dee03613d79adad8aa9180b61 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 3 Feb 2020 12:11:17 +0900 Subject: Rename setting repositories and refactor --- src/background/usecases/SettingUseCase.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/background/usecases/SettingUseCase.ts') diff --git a/src/background/usecases/SettingUseCase.ts b/src/background/usecases/SettingUseCase.ts index d78d440..bd61157 100644 --- a/src/background/usecases/SettingUseCase.ts +++ b/src/background/usecases/SettingUseCase.ts @@ -1,7 +1,6 @@ import { injectable } from 'tsyringe'; -import PersistentSettingRepository - from '../repositories/PersistentSettingRepository'; -import SettingRepository from '../repositories/SettingRepository'; +import LocalSettingRepository from '../repositories/LocalSettingRepository'; +import CachedSettingRepository from '../repositories/CachedSettingRepository'; import { DefaultSettingData } from '../../shared/SettingData'; import Settings from '../../shared/settings/Settings'; import NotifyPresenter from '../presenters/NotifyPresenter'; @@ -10,20 +9,20 @@ import NotifyPresenter from '../presenters/NotifyPresenter'; export default class SettingUseCase { constructor( - private persistentSettingRepository: PersistentSettingRepository, - private settingRepository: SettingRepository, + private localSettingRepository: LocalSettingRepository, + private cachedSettingRepository: CachedSettingRepository, private notifyPresenter: NotifyPresenter, ) { } - get(): Promise { - return this.settingRepository.get(); + getCached(): Promise { + return this.cachedSettingRepository.get(); } async reload(): Promise { let data; try { - data = await this.persistentSettingRepository.load(); + data = await this.localSettingRepository.load(); } catch (e) { this.showUnableToLoad(e); } @@ -38,7 +37,7 @@ export default class SettingUseCase { this.showUnableToLoad(e); value = DefaultSettingData.toSettings(); } - this.settingRepository.update(value!!); + this.cachedSettingRepository.update(value!!); return value; } -- cgit v1.2.3