Adrià Vilanova Martínez | 18d03c4 | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 1 | import Feature from '../common/architecture/features/Feature'; |
Adrià Vilanova Martínez | 58cc67c | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 2 | import AutoRefreshFeature from './autoRefresh/autoRefresh.feature'; |
Adrià Vilanova Martínez | 18d03c4 | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 3 | import InfiniteScrollFeature from './infiniteScroll/infiniteScroll.feature'; |
Adrià Vilanova Martínez | 2ba5d8d | 2024-05-04 21:17:16 +0200 | [diff] [blame] | 4 | import ScriptFilterListProvider from '../common/architecture/scripts/ScriptFilterListProvider'; |
Adrià Vilanova Martínez | 66836fd | 2024-05-04 22:43:06 +0200 | [diff] [blame] | 5 | import ExtraInfoFeature from './extraInfo/extraInfo.feature'; |
Adrià Vilanova Martínez | c78c3ad | 2024-05-18 00:35:51 +0200 | [diff] [blame] | 6 | import WorkflowsFeature from './workflows/workflows.feature'; |
Adrià Vilanova Martínez | 917797e | 2024-05-25 22:41:25 +0200 | [diff] [blame] | 7 | import CCDarkThemeFeature from './ccDarkTheme/ccDarkTheme.feature'; |
Adrià Vilanova | 61f782f | 2024-05-31 22:57:24 +0000 | [diff] [blame] | 8 | import LoadDraftsFeature from './loadDrafts/loadDrafts.feature'; |
| 9 | import InteropThreadPageFeature from './interopThreadPage/interopThreadPage.feature'; |
Adrià Vilanova Martínez | 18d03c4 | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 10 | |
| 11 | export type ConcreteFeatureClass = { new (): Feature }; |
| 12 | |
Adrià Vilanova Martínez | 2ba5d8d | 2024-05-04 21:17:16 +0200 | [diff] [blame] | 13 | export default class Features extends ScriptFilterListProvider { |
Adrià Vilanova Martínez | 58cc67c | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 14 | private features: ConcreteFeatureClass[] = [ |
| 15 | AutoRefreshFeature, |
Adrià Vilanova Martínez | 917797e | 2024-05-25 22:41:25 +0200 | [diff] [blame] | 16 | CCDarkThemeFeature, |
Adrià Vilanova Martínez | 66836fd | 2024-05-04 22:43:06 +0200 | [diff] [blame] | 17 | ExtraInfoFeature, |
Adrià Vilanova Martínez | 58cc67c | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 18 | InfiniteScrollFeature, |
Adrià Vilanova | 61f782f | 2024-05-31 22:57:24 +0000 | [diff] [blame] | 19 | InteropThreadPageFeature, |
| 20 | LoadDraftsFeature, |
Adrià Vilanova Martínez | c78c3ad | 2024-05-18 00:35:51 +0200 | [diff] [blame] | 21 | WorkflowsFeature, |
Adrià Vilanova Martínez | 58cc67c | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 22 | ]; |
Adrià Vilanova Martínez | 18d03c4 | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 23 | private initializedFeatures: Feature[]; |
| 24 | |
Adrià Vilanova Martínez | 2ba5d8d | 2024-05-04 21:17:16 +0200 | [diff] [blame] | 25 | protected getUnfilteredScriptsList() { |
Adrià Vilanova Martínez | 18d03c4 | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 26 | const features = this.getFeatures(); |
Adrià Vilanova Martínez | 2ba5d8d | 2024-05-04 21:17:16 +0200 | [diff] [blame] | 27 | return features.map((feature) => feature.getScripts()).flat(1); |
Adrià Vilanova Martínez | 18d03c4 | 2024-04-21 16:43:01 +0200 | [diff] [blame] | 28 | } |
| 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 | } |