mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
This PR introduces a generic `DialogService` which can be used by all the clients. This allows us to decouple dialogs from the `PlatformUtilsHelper`. The `DialogService` provides a new method, `openSimpleDialog` which is the new interface for that type of dialogs. This gives us 3 different implementations: - Web: DialogService modern dialogs - Browser: SweetAlert - Desktop: Native electron based
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { ClientType, DeviceType } from "../enums";
|
|
|
|
interface ToastOptions {
|
|
timeout?: number;
|
|
}
|
|
|
|
export abstract class PlatformUtilsService {
|
|
getDevice: () => DeviceType;
|
|
getDeviceString: () => string;
|
|
getClientType: () => ClientType;
|
|
isFirefox: () => boolean;
|
|
isChrome: () => boolean;
|
|
isEdge: () => boolean;
|
|
isOpera: () => boolean;
|
|
isVivaldi: () => boolean;
|
|
isSafari: () => boolean;
|
|
isMacAppStore: () => boolean;
|
|
isViewOpen: () => Promise<boolean>;
|
|
launchUri: (uri: string, options?: any) => void;
|
|
getApplicationVersion: () => Promise<string>;
|
|
getApplicationVersionNumber: () => Promise<string>;
|
|
supportsWebAuthn: (win: Window) => boolean;
|
|
supportsDuo: () => boolean;
|
|
showToast: (
|
|
type: "error" | "success" | "warning" | "info",
|
|
title: string,
|
|
text: string | string[],
|
|
options?: ToastOptions
|
|
) => void;
|
|
isDev: () => boolean;
|
|
isSelfHost: () => boolean;
|
|
copyToClipboard: (text: string, options?: any) => void | boolean;
|
|
readFromClipboard: (options?: any) => Promise<string>;
|
|
supportsBiometric: () => Promise<boolean>;
|
|
authenticateBiometric: () => Promise<boolean>;
|
|
supportsSecureStorage: () => boolean;
|
|
getAutofillKeyboardShortcut: () => Promise<string>;
|
|
}
|