refactor(flatten-threads): migrate to the new DI architecture
Bug: twpowertools:176
Change-Id: I7a24fb504ce53697112f11128d2d5249a5a7c7e7
diff --git a/src/entryPoints/communityConsole/contentScripts/main.ts b/src/entryPoints/communityConsole/contentScripts/main.ts
index 35088ea..2274fd0 100644
--- a/src/entryPoints/communityConsole/contentScripts/main.ts
+++ b/src/entryPoints/communityConsole/contentScripts/main.ts
@@ -42,6 +42,12 @@
import InjectLitComponentsScript from '../../../presentation/standaloneScripts/litComponents/injectLitComponents.script';
import ApplyStartupDataModificationsOnMainScript from '../../../presentation/standaloneScripts/startupDataStorage/applyStartupDataModificationsOnMain.script';
import ThreadPageDesignWarningInjectHandler from '../../../features/threadPageDesignWarning/presentation/nodeWatcherHandlers/inject.handler';
+import FlattenThreadsAdditionalInfoHandler from '../../../features/flattenThreads/presentation/nodeWatcherHandlers/additionalInfo.handler';
+import FlattenThreadsQuoteHandler from '../../../features/flattenThreads/presentation/nodeWatcherHandlers/quote.handler';
+import FlattenThreadsReaddReplyBtnHandler from '../../../features/flattenThreads/presentation/nodeWatcherHandlers/readdReplyBtn.handler';
+import FlattenThreadsReplyBtnHandler from '../../../features/flattenThreads/presentation/nodeWatcherHandlers/replyBtn.handler';
+import FlattenThreads from '../../../features/flattenThreads/core/flattenThreads';
+import FlattenThreadsStylesScript from '../../../features/flattenThreads/presentation/scripts/styles.script';
const scriptRunner = createScriptRunner();
scriptRunner.run();
@@ -64,6 +70,7 @@
);
const ccInfiniteScroll = new CCInfiniteScroll();
+ const flattenThreads = new FlattenThreads();
return new ScriptRunner(
new SortedScriptsProviderAdapter(
@@ -133,6 +140,22 @@
new CCInfiniteScrollLoadMoreBtnHandler(ccInfiniteScroll),
],
[
+ 'flattenThreadsAdditionalInfo',
+ new FlattenThreadsAdditionalInfoHandler(flattenThreads),
+ ],
+ [
+ 'flattenThreadsQuote',
+ new FlattenThreadsQuoteHandler(flattenThreads),
+ ],
+ [
+ 'flattenThreadsReaddReplyBtn',
+ new FlattenThreadsReaddReplyBtnHandler(flattenThreads),
+ ],
+ [
+ 'flattenThreadsReplyBtn',
+ new FlattenThreadsReplyBtnHandler(flattenThreads),
+ ],
+ [
'threadPageDesignWarningInject',
new ThreadPageDesignWarningInjectHandler(threadPageDesignWarning),
],
@@ -151,6 +174,7 @@
new AutoRefreshStylesScript(),
new CCExtraInfoInjectScript(),
new CCExtraInfoStylesScript(),
+ new FlattenThreadsStylesScript(),
new WorkflowsImportStylesheetScript(),
// Standalone scripts
diff --git a/src/entryPoints/communityConsole/contentScripts/start.ts b/src/entryPoints/communityConsole/contentScripts/start.ts
index 72302ff..21ef427 100644
--- a/src/entryPoints/communityConsole/contentScripts/start.ts
+++ b/src/entryPoints/communityConsole/contentScripts/start.ts
@@ -24,6 +24,8 @@
import ApplyStartupDataModificationsOnStartScript from '../../../presentation/standaloneScripts/startupDataStorage/applyStartupDataModificationsOnStart.script';
import XHRInterceptorScript from '../../../presentation/standaloneScripts/xhrInterceptor/xhrInterceptor.script';
import ThreadPageDesignWarningSetUpScript from '../../../features/threadPageDesignWarning/presentation/scripts/setUp.script';
+import FlattenThreadsSetUpReplyActionHandlerScript from '../../../features/flattenThreads/presentation/scripts/setUpReplyActionHandler.script';
+import FlattenThreadsReplyActionHandler from '../../../features/flattenThreads/core/replyActionHandler';
const scriptRunner = createScriptRunner();
scriptRunner.run();
@@ -53,10 +55,11 @@
new CCDarkThemeInjectAutoDarkTheme(),
new CCDarkThemeInjectForcedDarkTheme(),
new CCExtraInfoSetUpScript(extraInfo),
- new InteropThreadPageSetupScript(),
- new ThreadPageDesignWarningSetUpScript(
- threadPageDesignWarning,
+ new FlattenThreadsSetUpReplyActionHandlerScript(
+ new FlattenThreadsReplyActionHandler(optionsProvider),
),
+ new InteropThreadPageSetupScript(),
+ new ThreadPageDesignWarningSetUpScript(threadPageDesignWarning),
new LoadDraftsSetupScript(optionsProvider, startupDataStorage),
new WorkflowsImportSetUpScript(workflowsImport),