1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 13:53:34 +00:00

[CL-152] undeprecate openSimpleDialogRef (#7232)

This commit is contained in:
Will Martin
2023-12-15 11:22:19 -05:00
committed by GitHub
parent 74a70e420a
commit 4d5c955018

View File

@@ -86,10 +86,7 @@ export class DialogService extends Dialog implements OnDestroy {
* @returns `boolean` - True if the user accepted the dialog, false otherwise. * @returns `boolean` - True if the user accepted the dialog, false otherwise.
*/ */
async openSimpleDialog(simpleDialogOptions: SimpleDialogOptions): Promise<boolean> { async openSimpleDialog(simpleDialogOptions: SimpleDialogOptions): Promise<boolean> {
const dialogRef = this.open<boolean>(SimpleConfigurableDialogComponent, { const dialogRef = this.openSimpleDialogRef(simpleDialogOptions);
data: simpleDialogOptions,
disableClose: simpleDialogOptions.disableClose,
});
return firstValueFrom(dialogRef.closed); return firstValueFrom(dialogRef.closed);
} }
@@ -97,16 +94,15 @@ export class DialogService extends Dialog implements OnDestroy {
/** /**
* Opens a simple dialog. * Opens a simple dialog.
* *
* @deprecated Use `openSimpleDialog` instead. If you find a use case for the `dialogRef` * You should probably use `openSimpleDialog` instead, unless you need to programmatically close the dialog.
* please let #wg-component-library know and we can un-deprecate this method.
* *
* @param {SimpleDialogOptions} simpleDialogOptions - An object containing options for the dialog. * @param {SimpleDialogOptions} simpleDialogOptions - An object containing options for the dialog.
* @returns `DialogRef` - The reference to the opened dialog. * @returns `DialogRef` - The reference to the opened dialog.
* Contains a closed observable which can be subscribed to for determining which button * Contains a closed observable which can be subscribed to for determining which button
* a user pressed * a user pressed
*/ */
openSimpleDialogRef(simpleDialogOptions: SimpleDialogOptions): DialogRef { openSimpleDialogRef(simpleDialogOptions: SimpleDialogOptions): DialogRef<boolean> {
return this.open(SimpleConfigurableDialogComponent, { return this.open<boolean, SimpleDialogOptions>(SimpleConfigurableDialogComponent, {
data: simpleDialogOptions, data: simpleDialogOptions,
disableClose: simpleDialogOptions.disableClose, disableClose: simpleDialogOptions.disableClose,
}); });