mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
Remove specific client services.
This commit is contained in:
@@ -42,10 +42,7 @@ import {
|
||||
import { AnonLayoutWrapperDataService } from "../anon-layout/anon-layout-wrapper-data.service";
|
||||
import { WaveIcon } from "../icons";
|
||||
|
||||
import { DesktopLoginService } from "./desktop-login.service";
|
||||
import { ExtensionLoginService } from "./extension-login.service";
|
||||
import { LoginComponentService } from "./login-component.service";
|
||||
import { WebLoginService } from "./web-login.service";
|
||||
|
||||
const BroadcasterSubscriptionId = "LoginComponent";
|
||||
|
||||
@@ -139,9 +136,6 @@ export class LoginComponent implements OnInit, OnDestroy {
|
||||
private router: Router,
|
||||
private syncService: SyncService,
|
||||
private toastService: ToastService,
|
||||
private webLoginService: WebLoginService,
|
||||
private desktopLoginService: DesktopLoginService,
|
||||
private extensionLoginService: ExtensionLoginService,
|
||||
) {
|
||||
this.clientType = this.platformUtilsService.getClientType();
|
||||
this.loginViaAuthRequestSupported = this.loginComponentService.isLoginViaAuthRequestSupported();
|
||||
@@ -275,7 +269,8 @@ export class LoginComponent implements OnInit, OnDestroy {
|
||||
await this.goAfterLogIn(authResult.userId);
|
||||
// ...on Browser/Desktop
|
||||
} else if (this.clientType === ClientType.Browser) {
|
||||
await this.extensionLoginService.handleSuccessfulLogin();
|
||||
this.loginEmailService.clearValues();
|
||||
await this.router.navigate(["/tabs/vault"]);
|
||||
} else {
|
||||
await this.router.navigate(["vault"]);
|
||||
this.loginEmailService.clearValues();
|
||||
@@ -520,21 +515,24 @@ export class LoginComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private async webOnInit(): Promise<void> {
|
||||
this.activatedRoute.queryParams
|
||||
.pipe(
|
||||
first(),
|
||||
switchMap((qParams) => this.webLoginService.handleQueryParams(qParams)),
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe({
|
||||
error: (error: unknown) => {
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
title: this.i18nService.t("errorOccurred"),
|
||||
message: String(error),
|
||||
});
|
||||
},
|
||||
});
|
||||
this.activatedRoute.queryParams.pipe(first(), takeUntil(this.destroy$)).subscribe((qParams) => {
|
||||
if (qParams.org != null) {
|
||||
const route = this.router.createUrlTree(["create-organization"], {
|
||||
queryParams: { plan: qParams.org },
|
||||
});
|
||||
this.loginComponentService.setPreviousUrl(route);
|
||||
}
|
||||
|
||||
/* If there is a parameter called 'sponsorshipToken', they are coming
|
||||
from an email for sponsoring a families organization. Therefore set
|
||||
the prevousUrl to /setup/families-for-enterprise?token=<paramValue> */
|
||||
if (qParams.sponsorshipToken != null) {
|
||||
const route = this.router.createUrlTree(["setup/families-for-enterprise"], {
|
||||
queryParams: { token: qParams.sponsorshipToken },
|
||||
});
|
||||
this.loginComponentService.setPreviousUrl(route);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* TODO-rr-bw: Verify the following
|
||||
@@ -553,6 +551,27 @@ export class LoginComponent implements OnInit, OnDestroy {
|
||||
|
||||
private async desktopOnInit(): Promise<void> {
|
||||
await this.getLoginWithDevice(this.loggedEmail);
|
||||
this.desktopLoginService.setupWindowFocusHandler(() => this.focusInput());
|
||||
|
||||
// TODO-rr-bw: refactor to not use deprecated broadcaster service.
|
||||
this.broadcasterService.subscribe(BroadcasterSubscriptionId, async (message: any) => {
|
||||
this.ngZone.run(() => {
|
||||
switch (message.command) {
|
||||
case "windowIsFocused":
|
||||
if (this.deferFocus === null) {
|
||||
this.deferFocus = !message.windowIsFocused;
|
||||
if (!this.deferFocus) {
|
||||
this.focusInput();
|
||||
}
|
||||
} else if (this.deferFocus && message.windowIsFocused) {
|
||||
this.focusInput();
|
||||
this.deferFocus = false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.messagingService.send("getWindowIsFocused");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user