Skip to content

Commit

Permalink
Import and use conditional routing for new credential generator compo…
Browse files Browse the repository at this point in the history
…nent

app.component: The original if, didn't make any sense as it meant that it would behave differently on the Send page vs Vault, which it doesn't, in addition to a duplicate message receiver was added in vault.component which I also removed.

Old generator for cipher add/edit is still in place and will be replaced by the vault team
  • Loading branch information
djsmith85 committed Oct 4, 2024
1 parent e26543f commit 2a895b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
15 changes: 11 additions & 4 deletions apps/desktop/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { MasterPasswordServiceAbstraction } from "@bitwarden/common/auth/abstrac
import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction";
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
import { ForceSetPasswordReason } from "@bitwarden/common/auth/models/domain/force-set-password-reason";
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
import { VaultTimeoutAction } from "@bitwarden/common/enums/vault-timeout-action.enum";
import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service";
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
Expand Down Expand Up @@ -60,6 +61,7 @@ import { FolderAddEditComponent } from "../vault/app/vault/folder-add-edit.compo

import { SettingsComponent } from "./accounts/settings.component";
import { ExportDesktopComponent } from "./tools/export/export-desktop.component";
import { CredentialGeneratorComponent } from "./tools/generator/credential-generator.component";
import { GeneratorComponent } from "./tools/generator.component";
import { ImportDesktopComponent } from "./tools/import/import-desktop.component";
import { PasswordGeneratorHistoryComponent } from "./tools/password-generator-history.component";
Expand Down Expand Up @@ -398,10 +400,7 @@ export class AppComponent implements OnInit, OnDestroy {
await this.addFolder();
break;
case "openGenerator":
// openGenerator has extended functionality if called in the vault
if (!this.router.url.includes("vault")) {
await this.openGenerator();
}
await this.openGenerator();
break;
case "convertAccountToKeyConnector":
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
Expand Down Expand Up @@ -503,6 +502,14 @@ export class AppComponent implements OnInit, OnDestroy {
}

async openGenerator() {
const isGeneratorSwapEnabled = await this.configService.getFeatureFlag(
FeatureFlag.GeneratorToolsModernization,
);
if (isGeneratorSwapEnabled) {
await this.dialogService.open(CredentialGeneratorComponent);
return;
}

this.modalService.closeAll();

[this.modal] = await this.modalService.openViewRef(
Expand Down
3 changes: 0 additions & 3 deletions apps/desktop/src/vault/app/vault/vault.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ export class VaultComponent implements OnInit, OnDestroy {
(document.querySelector("#search") as HTMLInputElement).select();
detectChanges = false;
break;
case "openGenerator":
await this.openGenerator(false);
break;
case "syncCompleted":
await this.vaultItemsComponent.reload(this.activeFilter.buildFilter());
await this.vaultFilterComponent.reloadCollectionsAndFolders(this.activeFilter);
Expand Down

0 comments on commit 2a895b6

Please sign in to comment.