refactor(load-drafts): migrate to the new DI architecture

Bug: twpowertools:226
Change-Id: Ia85adb1af9440182323bebf4516bbd5ee3efbe4d
diff --git a/src/features/loadDrafts/loadDrafts.feature.ts b/src/features/loadDrafts/loadDrafts.feature.ts
deleted file mode 100644
index 23f6873..0000000
--- a/src/features/loadDrafts/loadDrafts.feature.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import Feature from '../../common/architecture/features/Feature';
-import { ConcreteScript } from '../../common/architecture/scripts/Script';
-import { OptionCodename } from '../../common/options/optionsPrototype';
-import EnableLoadDraftsFlagInDataStartupScript from './scripts/setThreadPageInDataStartupScript.script';
-
-export default class LoadDraftsFeature extends Feature {
-  public readonly scripts: ConcreteScript[] = [
-    EnableLoadDraftsFlagInDataStartupScript,
-  ];
-
-  readonly codename = 'loadDrafts';
-  readonly relatedOptions: OptionCodename[] = ['loaddrafts'];
-}
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();
+    }
+  }
+}
diff --git a/src/features/loadDrafts/scripts/setThreadPageInDataStartupScript.script.ts b/src/features/loadDrafts/scripts/setThreadPageInDataStartupScript.script.ts
deleted file mode 100644
index 6319fb7..0000000
--- a/src/features/loadDrafts/scripts/setThreadPageInDataStartupScript.script.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import DependenciesProviderSingleton, {
-  OptionsProviderDependency,
-  StartupDataStorageDependency,
-} from '../../../common/architecture/dependenciesProvider/DependenciesProvider';
-import Script, {
-  ScriptEnvironment,
-  ScriptPage,
-  ScriptRunPhase,
-} from '../../../common/architecture/scripts/Script';
-
-export default class EnableLoadDraftsFlagInDataStartupScript extends Script {
-  page = ScriptPage.CommunityConsole;
-  environment = ScriptEnvironment.ContentScript;
-  runPhase = ScriptRunPhase.Start;
-
-  async execute() {
-    const dependenciesProvider = DependenciesProviderSingleton.getInstance();
-    const optionsProvider = dependenciesProvider.getDependency(
-      OptionsProviderDependency,
-    );
-    if (await optionsProvider.isEnabled('loaddrafts')) {
-      const startupDataStorage = dependenciesProvider.getDependency(
-        StartupDataStorageDependency,
-      );
-      startupDataStorage.enqueueModification((startupDataModel) => {
-        startupDataModel.data[4][13] = true;
-      });
-      // NOTE: Workaround because otherwise the modifications would be applied too late.
-      startupDataStorage.applyModifications();
-    }
-  }
-}