refactor(load-drafts): migrate to the new DI architecture
Bug: twpowertools:226
Change-Id: Ia85adb1af9440182323bebf4516bbd5ee3efbe4d
diff --git a/src/features/loadDrafts/presentation/scripts/setup.script.ts b/src/features/loadDrafts/presentation/scripts/setup.script.ts
new file mode 100644
index 0000000..9195ebd
--- /dev/null
+++ b/src/features/loadDrafts/presentation/scripts/setup.script.ts
@@ -0,0 +1,26 @@
+import Script from '../../../../common/architecture/scripts/Script';
+import { StartupDataStoragePort } from '../../../../services/communityConsole/StartupDataStorage.port';
+import { OptionsProviderPort } from '../../../../services/options/OptionsProvider';
+
+export default class LoadDraftsSetupScript extends Script {
+ page: never;
+ environment: never;
+ runPhase: never;
+
+ constructor(
+ private optionsProvider: OptionsProviderPort,
+ private startupDataStorage: StartupDataStoragePort,
+ ) {
+ super();
+ }
+
+ async execute() {
+ if (await this.optionsProvider.isEnabled('loaddrafts')) {
+ this.startupDataStorage.enqueueModification((startupDataModel) => {
+ startupDataModel.data[4][13] = true;
+ });
+ // NOTE: Workaround because otherwise the modifications would be applied too late.
+ this.startupDataStorage.applyModifications();
+ }
+ }
+}