From b0cf12936da796c8e2a56c284e4e964d9306209f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20K=C3=B6nig?= <33655937+jkoenig134@users.noreply.github.com> Date: Wed, 5 Feb 2025 11:34:00 +0100 Subject: [PATCH] Remove unused code (#415) * chore: remove unused module * chore: remove unused event --- packages/app-runtime/src/AppConfig.ts | 6 ---- packages/app-runtime/src/AppRuntime.ts | 2 -- .../src/modules/appEvents/AppLaunchModule.ts | 29 ------------------- .../src/modules/appEvents/index.ts | 1 - .../src/natives/events/UrlOpenEvent.ts | 8 ----- .../app-runtime/src/natives/events/index.ts | 1 - 6 files changed, 47 deletions(-) delete mode 100644 packages/app-runtime/src/modules/appEvents/AppLaunchModule.ts delete mode 100644 packages/app-runtime/src/natives/events/UrlOpenEvent.ts diff --git a/packages/app-runtime/src/AppConfig.ts b/packages/app-runtime/src/AppConfig.ts index e1db0e2b1..e95c47a80 100644 --- a/packages/app-runtime/src/AppConfig.ts +++ b/packages/app-runtime/src/AppConfig.ts @@ -34,12 +34,6 @@ export function createAppConfig(...configs: (AppConfigOverwrite | AppConfig)[]): datawalletEnabled: true }, modules: { - appLaunch: { - name: "appLaunch", - displayName: "App Launch Module", - location: "appLaunch", - enabled: true - }, pushNotification: { name: "pushNotification", displayName: "Push Notification Module", diff --git a/packages/app-runtime/src/AppRuntime.ts b/packages/app-runtime/src/AppRuntime.ts index 57085dd2c..7450e52df 100644 --- a/packages/app-runtime/src/AppRuntime.ts +++ b/packages/app-runtime/src/AppRuntime.ts @@ -12,7 +12,6 @@ import { AppStringProcessor } from "./AppStringProcessor"; import { AccountSelectedEvent } from "./events"; import { AppServices, IUIBridge } from "./extensibility"; import { - AppLaunchModule, AppRuntimeModuleConfiguration, AppSyncModule, IAppRuntimeModuleConstructor, @@ -238,7 +237,6 @@ export class AppRuntime extends Runtime { } private static moduleRegistry: Record = { - appLaunch: AppLaunchModule, appSync: AppSyncModule, identityDeletionProcessStatusChanged: IdentityDeletionProcessStatusChangedModule, mailReceived: MailReceivedModule, diff --git a/packages/app-runtime/src/modules/appEvents/AppLaunchModule.ts b/packages/app-runtime/src/modules/appEvents/AppLaunchModule.ts deleted file mode 100644 index 4a94895f3..000000000 --- a/packages/app-runtime/src/modules/appEvents/AppLaunchModule.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { AppRuntimeError } from "../../AppRuntimeError"; -import { UrlOpenEvent } from "../../natives"; -import { AppRuntimeModule, AppRuntimeModuleConfiguration } from "../AppRuntimeModule"; - -export interface AppLaunchModuleConfig extends AppRuntimeModuleConfiguration {} - -export class AppLaunchModuleError extends AppRuntimeError {} - -export class AppLaunchModule extends AppRuntimeModule { - public async init(): Promise { - // Nothing to do here - } - - public start(): void { - this.subscribeToEvent(UrlOpenEvent, this.handleUrlOpen.bind(this)); - } - - private async handleUrlOpen(event: UrlOpenEvent) { - const result = await this.runtime.stringProcessor.processURL(event.url); - if (result.isSuccess) return; - - const uiBridge = await this.runtime.uiBridge(); - await uiBridge.showError(result.error); - } - - public stop(): void { - this.unsubscribeFromAllEvents(); - } -} diff --git a/packages/app-runtime/src/modules/appEvents/index.ts b/packages/app-runtime/src/modules/appEvents/index.ts index d4097f75f..1b7fa5fb8 100644 --- a/packages/app-runtime/src/modules/appEvents/index.ts +++ b/packages/app-runtime/src/modules/appEvents/index.ts @@ -1,4 +1,3 @@ -export * from "./AppLaunchModule"; export * from "./MailReceivedModule"; export * from "./OnboardingChangeReceivedModule"; export * from "./RelationshipTemplateProcessedModule"; diff --git a/packages/app-runtime/src/natives/events/UrlOpenEvent.ts b/packages/app-runtime/src/natives/events/UrlOpenEvent.ts deleted file mode 100644 index 1e0ac9793..000000000 --- a/packages/app-runtime/src/natives/events/UrlOpenEvent.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { NativeEvent } from "../NativeEvent"; - -export class UrlOpenEvent extends NativeEvent { - public static namespace = "UrlOpenEvent"; - public constructor(public readonly url: string) { - super(UrlOpenEvent.namespace); - } -} diff --git a/packages/app-runtime/src/natives/events/index.ts b/packages/app-runtime/src/natives/events/index.ts index 6558dbd75..8f72d315f 100644 --- a/packages/app-runtime/src/natives/events/index.ts +++ b/packages/app-runtime/src/natives/events/index.ts @@ -1,4 +1,3 @@ export * from "./AppReadyEvent"; export * from "./RemoteNotificationEvent"; export * from "./RemoteNotificationRegistrationEvent"; -export * from "./UrlOpenEvent";