blob: 7a78798fc9acc76c943abb946de43944e35eb81a [file] [log] [blame]
Adrià Vilanova Martínez917797e2024-05-25 22:41:25 +02001import DependenciesProviderSingleton, {
2 OptionsProviderDependency,
3 ReportDialogColorThemeFixDependency,
4} from '../../../common/architecture/dependenciesProvider/DependenciesProvider';
5import {
6 ScriptEnvironment,
7 ScriptPage,
8 ScriptRunPhase,
9} from '../../../common/architecture/scripts/Script';
10import NodeWatcherScript from '../../../common/architecture/scripts/nodeWatcher/NodeWatcherScript';
11import OptionsProvider from '../../../common/options/OptionsProvider';
12import ReportDialogColorThemeFix from '../core/logic/reportDialog';
13import CCDarkThemeEcAppHandler from '../nodeWatcherHandlers/ecApp.handler';
14import CCDarkThemeReportDialogHandler from '../nodeWatcherHandlers/reportDialog.handler';
15import CCDarkThemeUnifiedProfilesIframeHandler from '../nodeWatcherHandlers/unifiedProfilesIframe.handler';
16
17export interface CCDarkThemeNodeWatcherDependencies {
18 reportDialogColorThemeFix: ReportDialogColorThemeFix;
19 optionsProvider: OptionsProvider;
20}
21
22export default class CCDarkThemeNodeWatcherScript extends NodeWatcherScript<CCDarkThemeNodeWatcherDependencies> {
23 public page = ScriptPage.CommunityConsole;
24 public environment = ScriptEnvironment.ContentScript;
25 public runPhase = ScriptRunPhase.Main;
26 public handlers = new Map([
27 ['cc-dark-theme-ec-app', CCDarkThemeEcAppHandler],
28 ['cc-dark-theme-report-dialog', CCDarkThemeReportDialogHandler],
29 [
30 'cc-dark-theme-unified-profiles-iframe',
31 CCDarkThemeUnifiedProfilesIframeHandler,
32 ],
33 ]);
34
35 protected optionsFactory(): CCDarkThemeNodeWatcherDependencies {
36 const dependenciesProvider = DependenciesProviderSingleton.getInstance();
37 return {
38 reportDialogColorThemeFix: dependenciesProvider.getDependency(
39 ReportDialogColorThemeFixDependency,
40 ),
41 optionsProvider: dependenciesProvider.getDependency(
42 OptionsProviderDependency,
43 ),
44 };
45 }
46}