blob: 56699e94896a546c555b6c53c663fd1821fb020a [file] [log] [blame]
Adrià Vilanova Martínez6ecaa0d2024-10-26 17:04:32 +02001import CssSelectorNodeWatcherHandler from '../../../infrastructure/presentation/nodeWatcher/handlers/CssSelectorHandler.adapter';
Adrià Vilanova Martínez43c75202024-10-19 15:55:15 +02002import { NodeMutation } from '../../../presentation/nodeWatcher/NodeWatcherHandler';
Adrià Vilanova Martínez6ecaa0d2024-10-26 17:04:32 +02003import { OptionsProviderPort } from '../../../services/options/OptionsProvider';
4import ReportDialogColorThemeFix from '../core/logic/reportDialog';
Adrià Vilanova Martínez917797e2024-05-25 22:41:25 +02005
6/**
7 * Sets the report dialog iframe's theme to the appropriate theme.
8 */
Adrià Vilanova Martínez6ecaa0d2024-10-26 17:04:32 +02009export default class CCDarkThemeReportDialogHandler extends CssSelectorNodeWatcherHandler {
Adrià Vilanova Martínez917797e2024-05-25 22:41:25 +020010 cssSelector = 'iframe';
11
Adrià Vilanova Martínez6ecaa0d2024-10-26 17:04:32 +020012 constructor(
13 private optionsProvider: OptionsProviderPort,
14 private reportDialogColorThemeFix: ReportDialogColorThemeFix,
15 ) {
16 super();
17 }
18
Adrià Vilanova Martínez917797e2024-05-25 22:41:25 +020019 onMutatedNode(mutation: NodeMutation) {
Adrià Vilanova Martínez6ecaa0d2024-10-26 17:04:32 +020020 this.reportDialogColorThemeFix.fixThemeIfReportDialogIframeAndApplicable(
Adrià Vilanova Martínez917797e2024-05-25 22:41:25 +020021 mutation.node,
Adrià Vilanova Martínez6ecaa0d2024-10-26 17:04:32 +020022 this.optionsProvider,
Adrià Vilanova Martínez917797e2024-05-25 22:41:25 +020023 );
24 }
25}