blob: afcba59fbd5b7153f8073a238a11f7bc2caf3513 [file] [log] [blame]
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02001import Feature from '../common/architecture/features/Feature';
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +02002import AutoRefreshFeature from './autoRefresh/autoRefresh.feature';
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +02003import InfiniteScrollFeature from './infiniteScroll/infiniteScroll.feature';
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +02004import ScriptFilterListProvider from '../common/architecture/scripts/ScriptFilterListProvider';
Adrià Vilanova Martínez66836fd2024-05-04 22:43:06 +02005import ExtraInfoFeature from './extraInfo/extraInfo.feature';
Adrià Vilanova Martínezc78c3ad2024-05-18 00:35:51 +02006import WorkflowsFeature from './workflows/workflows.feature';
Adrià Vilanova Martínez917797e2024-05-25 22:41:25 +02007import CCDarkThemeFeature from './ccDarkTheme/ccDarkTheme.feature';
Adrià Vilanova61f782f2024-05-31 22:57:24 +00008import LoadDraftsFeature from './loadDrafts/loadDrafts.feature';
9import InteropThreadPageFeature from './interopThreadPage/interopThreadPage.feature';
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020010
11export type ConcreteFeatureClass = { new (): Feature };
12
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020013export default class Features extends ScriptFilterListProvider {
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +020014 private features: ConcreteFeatureClass[] = [
15 AutoRefreshFeature,
Adrià Vilanova Martínez917797e2024-05-25 22:41:25 +020016 CCDarkThemeFeature,
Adrià Vilanova Martínez66836fd2024-05-04 22:43:06 +020017 ExtraInfoFeature,
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +020018 InfiniteScrollFeature,
Adrià Vilanova61f782f2024-05-31 22:57:24 +000019 InteropThreadPageFeature,
20 LoadDraftsFeature,
Adrià Vilanova Martínezc78c3ad2024-05-18 00:35:51 +020021 WorkflowsFeature,
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +020022 ];
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020023 private initializedFeatures: Feature[];
24
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020025 protected getUnfilteredScriptsList() {
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020026 const features = this.getFeatures();
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020027 return features.map((feature) => feature.getScripts()).flat(1);
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020028 }
29
30 private getFeatures() {
31 if (this.initializedFeatures === undefined) {
32 this.initializedFeatures = this.features.map((feature) => new feature());
33 }
34 return this.initializedFeatures;
35 }
36}