1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 11:43:46 +00:00

[PM-1504] Migrate Dialogs to DialogService (#5013)

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
This commit is contained in:
Oscar Hinton
2023-05-02 18:46:03 +02:00
committed by GitHub
parent 7c4b2c04b9
commit 4e1867682f
144 changed files with 1514 additions and 1212 deletions

View File

@@ -1,6 +1,7 @@
import { Component } from "@angular/core";
import { UntypedFormBuilder } from "@angular/forms";
import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog";
import { ModalService } from "@bitwarden/angular/services/modal.service";
import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/tools/export/components/export.component";
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
@@ -36,7 +37,8 @@ export class ExportComponent extends BaseExportComponent {
userVerificationService: UserVerificationService,
formBuilder: UntypedFormBuilder,
fileDownloadService: FileDownloadService,
private modalService: ModalService
private modalService: ModalService,
dialogService: DialogServiceAbstraction
) {
super(
cryptoService,
@@ -49,7 +51,8 @@ export class ExportComponent extends BaseExportComponent {
logService,
userVerificationService,
formBuilder,
fileDownloadService
fileDownloadService,
dialogService
);
}

View File

@@ -4,6 +4,7 @@ import * as JSZip from "jszip";
import { firstValueFrom } from "rxjs";
import Swal, { SweetAlertIcon } from "sweetalert2";
import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog";
import { ModalService } from "@bitwarden/angular/services/modal.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
@@ -11,7 +12,6 @@ import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUti
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { PolicyType } from "@bitwarden/common/admin-console/enums";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { DialogService } from "@bitwarden/components";
import {
ImportOption,
ImportType,
@@ -46,7 +46,7 @@ export class ImportComponent implements OnInit {
private logService: LogService,
protected modalService: ModalService,
protected syncService: SyncService,
protected dialogService: DialogService
protected dialogService: DialogServiceAbstraction
) {}
async ngOnInit() {

View File

@@ -1,6 +1,7 @@
import { DatePipe } from "@angular/common";
import { Component } from "@angular/core";
import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog";
import { AddEditComponent as BaseAddEditComponent } from "@bitwarden/angular/tools/send/add-edit.component";
import { EnvironmentService } from "@bitwarden/common/abstractions/environment.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
@@ -29,7 +30,8 @@ export class AddEditComponent extends BaseAddEditComponent {
messagingService: MessagingService,
policyService: PolicyService,
logService: LogService,
sendApiService: SendApiService
sendApiService: SendApiService,
dialogService: DialogServiceAbstraction
) {
super(
i18nService,
@@ -41,7 +43,8 @@ export class AddEditComponent extends BaseAddEditComponent {
policyService,
logService,
stateService,
sendApiService
sendApiService,
dialogService
);
}

View File

@@ -1,5 +1,6 @@
import { Component, NgZone, ViewChild, ViewContainerRef } from "@angular/core";
import { DialogServiceAbstraction } from "@bitwarden/angular/services/dialog";
import { ModalService } from "@bitwarden/angular/services/modal.service";
import { SendComponent as BaseSendComponent } from "@bitwarden/angular/tools/send/send.component";
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
@@ -38,7 +39,8 @@ export class SendComponent extends BaseSendComponent {
private modalService: ModalService,
private broadcasterService: BroadcasterService,
logService: LogService,
sendApiService: SendApiService
sendApiService: SendApiService,
dialogService: DialogServiceAbstraction
) {
super(
sendService,
@@ -49,7 +51,8 @@ export class SendComponent extends BaseSendComponent {
searchService,
policyService,
logService,
sendApiService
sendApiService,
dialogService
);
}