Adrià Vilanova MartÃnez | 917797e | 2024-05-25 22:41:25 +0200 | [diff] [blame] | 1 | import DependenciesProviderSingleton, { |
| 2 | OptionsProviderDependency, |
| 3 | ReportDialogColorThemeFixDependency, |
| 4 | } from '../../../common/architecture/dependenciesProvider/DependenciesProvider'; |
| 5 | import { |
| 6 | ScriptEnvironment, |
| 7 | ScriptPage, |
| 8 | ScriptRunPhase, |
| 9 | } from '../../../common/architecture/scripts/Script'; |
| 10 | import NodeWatcherScript from '../../../common/architecture/scripts/nodeWatcher/NodeWatcherScript'; |
| 11 | import OptionsProvider from '../../../common/options/OptionsProvider'; |
| 12 | import ReportDialogColorThemeFix from '../core/logic/reportDialog'; |
| 13 | import CCDarkThemeEcAppHandler from '../nodeWatcherHandlers/ecApp.handler'; |
| 14 | import CCDarkThemeReportDialogHandler from '../nodeWatcherHandlers/reportDialog.handler'; |
| 15 | import CCDarkThemeUnifiedProfilesIframeHandler from '../nodeWatcherHandlers/unifiedProfilesIframe.handler'; |
| 16 | |
| 17 | export interface CCDarkThemeNodeWatcherDependencies { |
| 18 | reportDialogColorThemeFix: ReportDialogColorThemeFix; |
| 19 | optionsProvider: OptionsProvider; |
| 20 | } |
| 21 | |
| 22 | export 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 | } |