Skip to content

Commit

Permalink
PM-12077 - Final tweaks for process reload
Browse files Browse the repository at this point in the history
  • Loading branch information
JaredSnider-Bitwarden committed Oct 31, 2024
1 parent 2631ac1 commit d4249c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 27 deletions.
30 changes: 3 additions & 27 deletions apps/web/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { StateEventRunnerService } from "@bitwarden/common/platform/state";
import { SyncService } from "@bitwarden/common/platform/sync";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { InternalFolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction";
import { DialogService, ToastOptions, ToastService } from "@bitwarden/components";
import { DialogService, ToastService } from "@bitwarden/components";

Check warning on line 32 in apps/web/src/app/app.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/app.component.ts#L32

Added line #L32 was not covered by tests
import { PasswordGenerationServiceAbstraction } from "@bitwarden/generator-legacy";
import { KeyService, BiometricStateService } from "@bitwarden/key-management";

Expand Down Expand Up @@ -275,31 +275,6 @@ export class AppComponent implements OnDestroy, OnInit {
this.destroy$.complete();
}

private async displayLogoutReason(logoutReason: LogoutReason) {
let toastOptions: ToastOptions;
switch (logoutReason) {
case "invalidSecurityStamp":
case "sessionExpired": {
toastOptions = {
variant: "warning",
title: this.i18nService.t("loggedOut"),
message: this.i18nService.t("loginExpired"),
};
break;
}
default: {
toastOptions = {
variant: "info",
title: this.i18nService.t("loggedOut"),
message: this.i18nService.t("loggedOutDesc"),
};
break;
}
}

this.toastService.showToast(toastOptions);
}

private async logOut(logoutReason: LogoutReason, redirect = true) {
// Ensure the loading state is applied before proceeding to avoid a flash
// of the login screen before the process reload fires.
Expand All @@ -308,7 +283,8 @@ export class AppComponent implements OnDestroy, OnInit {
document.body.classList.add("layout_frontend");

Check warning on line 283 in apps/web/src/app/app.component.ts

View check run for this annotation

Codecov / codecov/patch

apps/web/src/app/app.component.ts#L281-L283

Added lines #L281 - L283 were not covered by tests
});

await this.displayLogoutReason(logoutReason);
// Note: we don't display a toast logout reason anymore as the process reload
// will prevent any toasts from being displayed long enough to be read

await this.eventUploadService.uploadEvents();
const userId = await firstValueFrom(this.accountService.activeAccount$.pipe(map((a) => a?.id)));
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
</head>
<body class="layout_frontend">
<app-root>
<!-- Note: any changes to this html need to be made in the app.component.html as well -->
<div class="tw-p-8 tw-flex">
<img class="new-logo-themed" alt="Bitwarden" />
<div class="spinner-container tw-justify-center">
Expand Down

0 comments on commit d4249c4

Please sign in to comment.