aboutsummaryrefslogtreecommitdiff
path: root/src/content/usecases
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/usecases')
-rw-r--r--src/content/usecases/AddonEnabledUseCase.ts16
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);
}
}