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); + } }