refactor(thread-page-design-warning): migrate to the new DI architecture
Bug: twpowertools:176
Change-Id: I0f349e4dfe6fb4c13ff4b087f82529b1bdf66728
diff --git a/src/features/threadPageDesignWarning/presentation/nodeWatcherHandlers/inject.handler.ts b/src/features/threadPageDesignWarning/presentation/nodeWatcherHandlers/inject.handler.ts
new file mode 100644
index 0000000..1a016fc
--- /dev/null
+++ b/src/features/threadPageDesignWarning/presentation/nodeWatcherHandlers/inject.handler.ts
@@ -0,0 +1,16 @@
+import CssSelectorNodeWatcherHandler from '../../../../infrastructure/presentation/nodeWatcher/handlers/CssSelectorHandler.adapter';
+import { NodeMutation } from '../../../../presentation/nodeWatcher/NodeWatcherHandler';
+import ThreadPageDesignWarning from '../../core/threadPageDesignWarning';
+
+/** Inject old thread page design warning if applicable */
+export default class ThreadPageDesignWarningInjectHandler extends CssSelectorNodeWatcherHandler {
+ cssSelector = 'ec-thread > .page > .material-content > div[role="list"]';
+
+ constructor(private threadPageDesignWarning: ThreadPageDesignWarning) {
+ super();
+ }
+
+ onMutatedNode({ node }: NodeMutation) {
+ this.threadPageDesignWarning.injectWarningIfApplicable(node);
+ }
+}