1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-14 23:45:37 +00:00

added methods to EnvService that were originally not migrated

• PlatformUtilsService.copyToClipboard()
• PlatformUtilsService.readFromClipboard()
• DEPRECATED PlatformUtilsService.showToast()

these methods weren't being used, but in order to avoid breaking anything, I've added them
This commit is contained in:
John Harrington
2025-10-04 16:27:54 -07:00
parent a67aed3233
commit df49e482b9
2 changed files with 31 additions and 0 deletions

View File

@@ -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<string>;
abstract supportsSecureStorage(): boolean;
abstract getAutofillKeyboardShortcut(): Promise<string>;
/**
* @deprecated use `@bitwarden/components/ToastService.showToast` instead
*/
abstract showToast(
type: "error" | "success" | "warning" | "info",
title: string,
text: string | string[],
options?: any,
): void;
}

View File

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