aboutsummaryrefslogtreecommitdiff
path: root/src/content/operators/impls/DisableAddonOperator.ts
blob: a92e04bd5c6d4757bb4228d89453107ec84bc559 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import Operator from "../Operator";
import AddonIndicatorClient from "../../client/AddonIndicatorClient";
import AddonEnabledRepository from "../../repositories/AddonEnabledRepository";
import ConsoleFramePresenter from "../../presenters/ConsoleFramePresenter";

export default class DisableAddonOperator implements Operator {
  constructor(
    private readonly indicator: AddonIndicatorClient,
    private readonly repository: AddonEnabledRepository,
    private readonly consoleFramePresenter: ConsoleFramePresenter
  ) {}

  async run(): Promise<void> {
    this.repository.set(false);
    this.consoleFramePresenter.detach();
    await this.indicator.setEnabled(false);
  }
}