diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-03-22 20:44:07 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-22 20:44:07 +0900 |
commit | fa733c1ff110054f673f3d4e8d4760eb90d5d1eb (patch) | |
tree | 0a7d9f041a01d29f0bc5972a343e4988dc71b468 /src/content/usecases | |
parent | 3cbaf4a9f4245bd6be4eccdbff11e20ffaaf523a (diff) | |
parent | 690c9c080a2a511a30d555a90e5005e06b750351 (diff) |
Merge pull request #1043 from ueokande/iframe-late-inject
iframe Late injection
Diffstat (limited to 'src/content/usecases')
-rw-r--r-- | src/content/usecases/AddonEnabledUseCase.ts | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/content/usecases/AddonEnabledUseCase.ts b/src/content/usecases/AddonEnabledUseCase.ts index f7e78c5..f49fde5 100644 --- a/src/content/usecases/AddonEnabledUseCase.ts +++ b/src/content/usecases/AddonEnabledUseCase.ts @@ -1,15 +1,17 @@ import { injectable, inject } from "tsyringe"; import AddonIndicatorClient from "../client/AddonIndicatorClient"; import AddonEnabledRepository from "../repositories/AddonEnabledRepository"; +import ConsoleFramePresenter from "../presenters/ConsoleFramePresenter"; @injectable() export default class AddonEnabledUseCase { constructor( @inject("AddonIndicatorClient") - private indicator: AddonIndicatorClient, - + private readonly indicator: AddonIndicatorClient, @inject("AddonEnabledRepository") - private repository: AddonEnabledRepository + private readonly repository: AddonEnabledRepository, + @inject("ConsoleFramePresenter") + private readonly consoleFramePresenter: ConsoleFramePresenter ) {} async enable(): Promise<void> { @@ -31,6 +33,14 @@ export default class AddonEnabledUseCase { private async setEnabled(on: boolean): Promise<void> { this.repository.set(on); + + if (this.consoleFramePresenter.isTopWindow()) { + if (on) { + this.consoleFramePresenter.attach(); + } else { + this.consoleFramePresenter.detach(); + } + } await this.indicator.setEnabled(on); } } |