refactor(cc-dark-theme): migrate to the new DI architecture
Bug: twpowertools:226
Change-Id: I735013393d1d99cadee48399bba53a22fe59e27c
diff --git a/src/entryPoints/communityConsole/contentScripts/main.ts b/src/entryPoints/communityConsole/contentScripts/main.ts
index ff70c11..fb6fa17 100644
--- a/src/entryPoints/communityConsole/contentScripts/main.ts
+++ b/src/entryPoints/communityConsole/contentScripts/main.ts
@@ -1,5 +1,6 @@
import DependenciesProviderSingleton, {
AutoRefreshDependency,
+ OptionsProviderDependency,
} from '../../../common/architecture/dependenciesProvider/DependenciesProvider';
import { Context } from '../../../common/architecture/entrypoint/Context';
import {
@@ -21,6 +22,10 @@
// Run legacy Javascript entry point
import '../../../contentScripts/communityConsole/main';
+import CCDarkThemeEcAppHandler from '../../../features/ccDarkTheme/nodeWatcherHandlers/ecApp.handler';
+import CCDarkThemeReportDialogHandler from '../../../features/ccDarkTheme/nodeWatcherHandlers/reportDialog.handler';
+import CCDarkThemeUnifiedProfilesIframeHandler from '../../../features/ccDarkTheme/nodeWatcherHandlers/unifiedProfilesIframe.handler';
+import ReportDialogColorThemeFix from '../../../features/ccDarkTheme/core/logic/reportDialog';
const scriptRunner = createScriptRunner();
scriptRunner.run();
@@ -28,6 +33,9 @@
function createScriptRunner() {
const dependenciesProvider = DependenciesProviderSingleton.getInstance();
const autoRefresh = dependenciesProvider.getDependency(AutoRefreshDependency);
+ const optionsProvider = dependenciesProvider.getDependency(
+ OptionsProviderDependency,
+ );
const context: Context = {
page: ScriptPage.CommunityConsole,
@@ -50,6 +58,18 @@
'autoRefreshThreadListHide',
new AutoRefreshThreadListHideHandler(autoRefresh),
],
+ ['ccDarkThemeEcApp', new CCDarkThemeEcAppHandler(optionsProvider)],
+ [
+ 'ccDarkThemeReportDialog',
+ new CCDarkThemeReportDialogHandler(
+ optionsProvider,
+ new ReportDialogColorThemeFix(),
+ ),
+ ],
+ [
+ 'ccDarkThemeUnifiedProfilesIframe',
+ new CCDarkThemeUnifiedProfilesIframeHandler(optionsProvider),
+ ],
]),
),
diff --git a/src/entryPoints/communityConsole/contentScripts/start.ts b/src/entryPoints/communityConsole/contentScripts/start.ts
index 5e11a87..e9be92c 100644
--- a/src/entryPoints/communityConsole/contentScripts/start.ts
+++ b/src/entryPoints/communityConsole/contentScripts/start.ts
@@ -16,6 +16,8 @@
// Run legacy Javascript entry point
import '../../../contentScripts/communityConsole/start';
+import CCDarkThemeInjectAutoDarkTheme from '../../../features/ccDarkTheme/scripts/injectAutoDarkTheme.script';
+import CCDarkThemeInjectForcedDarkTheme from '../../../features/ccDarkTheme/scripts/injectForcedDarkTheme.script';
const scriptRunner = createScriptRunner();
scriptRunner.run();
@@ -35,6 +37,8 @@
[
// Individual feature scripts
new AutoRefreshSetUpScript(autoRefresh),
+ new CCDarkThemeInjectAutoDarkTheme(),
+ new CCDarkThemeInjectForcedDarkTheme(),
// Non-DI scripts (legacy, should be migrated to use a DI approach)
...new Features().getScripts(context),