From df49e482b902248e80844a1060a681e3c14b9956 Mon Sep 17 00:00:00 2001 From: John Harrington <84741727+harr1424@users.noreply.github.com> Date: Sat, 4 Oct 2025 16:27:54 -0700 Subject: [PATCH] added methods to EnvService that were originally not migrated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • PlatformUtilsService.copyToClipboard() • PlatformUtilsService.readFromClipboard() • DEPRECATED PlatformUtilsService.showToast() these methods weren't being used, but in order to avoid breaking anything, I've added them --- .../src/tools/abstractions/env.service.ts | 11 ++++++++++ libs/common/src/tools/providers.ts | 20 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/libs/common/src/tools/abstractions/env.service.ts b/libs/common/src/tools/abstractions/env.service.ts index d7eb881fa8d..8281cfc3c62 100644 --- a/libs/common/src/tools/abstractions/env.service.ts +++ b/libs/common/src/tools/abstractions/env.service.ts @@ -53,6 +53,17 @@ export abstract class EnvService { abstract supportsFileDownloads(): boolean; abstract isDev(): boolean; abstract isSelfHost(): boolean; + abstract copyToClipboard(text: string, options?: any): void | boolean; + abstract readFromClipboard(): Promise; abstract supportsSecureStorage(): boolean; abstract getAutofillKeyboardShortcut(): Promise; + /** + * @deprecated use `@bitwarden/components/ToastService.showToast` instead + */ + abstract showToast( + type: "error" | "success" | "warning" | "info", + title: string, + text: string | string[], + options?: any, + ): void; } diff --git a/libs/common/src/tools/providers.ts b/libs/common/src/tools/providers.ts index 266e7b42b64..b3b20810dd6 100644 --- a/libs/common/src/tools/providers.ts +++ b/libs/common/src/tools/providers.ts @@ -210,6 +210,14 @@ export class DefaultEnvService extends EnvService { return this.platformUtilsService.isSelfHost(); } + copyToClipboard(text: string, options?: any) { + return this.platformUtilsService.copyToClipboard(text, options); + } + + readFromClipboard() { + return this.platformUtilsService.readFromClipboard(); + } + supportsSecureStorage() { return this.platformUtilsService.supportsSecureStorage(); } @@ -217,4 +225,16 @@ export class DefaultEnvService extends EnvService { getAutofillKeyboardShortcut() { return this.platformUtilsService.getAutofillKeyboardShortcut(); } + + /** + * @deprecated use `@bitwarden/components/ToastService.showToast` instead + */ + showToast( + type: "error" | "success" | "warning" | "info", + title: string, + text: string | string[], + options?: any, + ) { + return this.platformUtilsService.showToast(type, title, text, options); + } }