blob: 67c93aa96d817cd42f4bb79a73d334854f883569 [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à Vilanova Martínez18d03c42024-04-21 16:43:01 +02008
9export type ConcreteFeatureClass = { new (): Feature };
10
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020011export default class Features extends ScriptFilterListProvider {
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +020012 private features: ConcreteFeatureClass[] = [
13 AutoRefreshFeature,
Adrià Vilanova Martínez917797e2024-05-25 22:41:25 +020014 CCDarkThemeFeature,
Adrià Vilanova Martínez66836fd2024-05-04 22:43:06 +020015 ExtraInfoFeature,
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +020016 InfiniteScrollFeature,
Adrià Vilanova Martínezc78c3ad2024-05-18 00:35:51 +020017 WorkflowsFeature,
Adrià Vilanova Martínez58cc67c2024-04-21 16:43:01 +020018 ];
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020019 private initializedFeatures: Feature[];
20
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020021 protected getUnfilteredScriptsList() {
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020022 const features = this.getFeatures();
Adrià Vilanova Martínez2ba5d8d2024-05-04 21:17:16 +020023 return features.map((feature) => feature.getScripts()).flat(1);
Adrià Vilanova Martínez18d03c42024-04-21 16:43:01 +020024 }
25
26 private getFeatures() {
27 if (this.initializedFeatures === undefined) {
28 this.initializedFeatures = this.features.map((feature) => new feature());
29 }
30 return this.initializedFeatures;
31 }
32}