diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-02-03 12:11:17 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-02-03 14:26:56 +0900 |
commit | 02e8b55884fd530dee03613d79adad8aa9180b61 (patch) | |
tree | 7379e14ef3da8164c6af806aba2dbe7f40c4927a /src/background/usecases/SettingUseCase.ts | |
parent | 23c59c9747f83d70df6fc630b1ce99639029dbe7 (diff) |
Rename setting repositories and refactor
Diffstat (limited to 'src/background/usecases/SettingUseCase.ts')
-rw-r--r-- | src/background/usecases/SettingUseCase.ts | 17 |
1 files changed, 8 insertions, 9 deletions
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<Settings> { - return this.settingRepository.get(); + getCached(): Promise<Settings> { + return this.cachedSettingRepository.get(); } async reload(): Promise<Settings> { 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; } |