diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-05-02 17:25:56 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-02 17:25:56 +0900 |
commit | 5df0537bcf65a341e79852b1b30379c73318529c (patch) | |
tree | aee5efe52412855f620cb514a13a2c14373f27b7 /src/background/usecases/SettingUseCase.ts | |
parent | 685f2b7b69218b06b5bb676069e35f79c5048c9b (diff) | |
parent | 75abd90ecb8201ad845b266f96220d8adfe19b2d (diff) |
Merge pull request #749 from ueokande/qa-0.28
QA 0.28
Diffstat (limited to 'src/background/usecases/SettingUseCase.ts')
-rw-r--r-- | src/background/usecases/SettingUseCase.ts | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/background/usecases/SettingUseCase.ts b/src/background/usecases/SettingUseCase.ts index 69b4572..ccee227 100644 --- a/src/background/usecases/SettingUseCase.ts +++ b/src/background/usecases/SettingUseCase.ts @@ -1,20 +1,21 @@ -import {inject, injectable} from 'tsyringe'; -import CachedSettingRepository from '../repositories/CachedSettingRepository'; -import SettingData, {DefaultSettingData} from '../../shared/SettingData'; -import Settings from '../../shared/settings/Settings'; -import Notifier from '../presenters/Notifier'; +import { inject, injectable } from "tsyringe"; +import CachedSettingRepository from "../repositories/CachedSettingRepository"; +import SettingData, { DefaultSettingData } from "../../shared/SettingData"; +import Settings from "../../shared/settings/Settings"; +import Notifier from "../presenters/Notifier"; import SettingRepository from "../repositories/SettingRepository"; @injectable() export default class SettingUseCase { - constructor( - @inject("LocalSettingRepository") private localSettingRepository: SettingRepository, - @inject("SyncSettingRepository") private syncSettingRepository: SettingRepository, - @inject("CachedSettingRepository") private cachedSettingRepository: CachedSettingRepository, - @inject("Notifier") private notifier: Notifier, - ) { - } + @inject("LocalSettingRepository") + private localSettingRepository: SettingRepository, + @inject("SyncSettingRepository") + private syncSettingRepository: SettingRepository, + @inject("CachedSettingRepository") + private cachedSettingRepository: CachedSettingRepository, + @inject("Notifier") private notifier: Notifier + ) {} getCached(): Promise<Settings> { return this.cachedSettingRepository.get(); @@ -42,7 +43,7 @@ export default class SettingUseCase { private async loadSettings(): Promise<SettingData> { const sync = await this.syncSettingRepository.load(); if (sync) { - return sync; + return sync; } const local = await this.localSettingRepository.load(); if (local) { @@ -52,7 +53,7 @@ export default class SettingUseCase { } private showUnableToLoad(e: Error) { - console.error('unable to load settings', e); + console.error("unable to load settings", e); this.notifier.notifyInvalidSettings(() => { browser.runtime.openOptionsPage(); }); |