From 083fe18773c05f59666a949788844b8e7a27a9f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garci=CC=81a?= Date: Mon, 19 May 2025 16:23:49 +0200 Subject: [PATCH] Remove test code --- apps/browser/src/popup/app.component.ts | 24 +------------------ .../services/sdk/default-sdk.service.ts | 11 +-------- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/apps/browser/src/popup/app.component.ts b/apps/browser/src/popup/app.component.ts index c1172fe7727..5f7fbc1fad7 100644 --- a/apps/browser/src/popup/app.component.ts +++ b/apps/browser/src/popup/app.component.ts @@ -3,7 +3,7 @@ import { ChangeDetectorRef, Component, NgZone, OnDestroy, OnInit, inject } from "@angular/core"; import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; import { NavigationEnd, Router, RouterOutlet } from "@angular/router"; -import { Subject, takeUntil, firstValueFrom, concatMap, filter, tap, map } from "rxjs"; +import { Subject, takeUntil, firstValueFrom, concatMap, filter, tap } from "rxjs"; import { DeviceTrustToastService } from "@bitwarden/angular/auth/services/device-trust-toast.service.abstraction"; import { LogoutReason } from "@bitwarden/auth/common"; @@ -13,7 +13,6 @@ import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authenticatio import { AnimationControlService } from "@bitwarden/common/platform/abstractions/animation-control.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; -import { SdkService } from "@bitwarden/common/platform/abstractions/sdk/sdk.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { MessageListener } from "@bitwarden/common/platform/messaging"; import { UserId } from "@bitwarden/common/types/guid"; @@ -75,27 +74,10 @@ export class AppComponent implements OnInit, OnDestroy { private biometricsService: BiometricsService, private deviceTrustToastService: DeviceTrustToastService, private popupSizeService: PopupSizeService, - private sdkService: SdkService, ) { this.deviceTrustToastService.setupListeners$.pipe(takeUntilDestroyed()).subscribe(); } - /* eslint-disable no-console */ - async testSdkState() { - const userId = (await firstValueFrom(this.accountService.activeAccount$)).id; - await firstValueFrom( - this.sdkService.userClient$(userId).pipe( - map(async (clientRc) => { - using clientRef = clientRc.take(); - const client = clientRef.value; - - const ciphers = await client.vault().print_the_ciphers(); - console.log("Ciphers2: ", ciphers); - }), - ), - ); - } - async ngOnInit() { initPopupClosedListener(); @@ -218,10 +200,6 @@ export class AppComponent implements OnInit, OnDestroy { .subscribe((state) => { this.routerAnimations = state; }); - - this.testSdkState().catch((e) => { - console.error("Error in testSdkState()", e); - }); } ngOnDestroy(): void { diff --git a/libs/common/src/platform/services/sdk/default-sdk.service.ts b/libs/common/src/platform/services/sdk/default-sdk.service.ts index 36b49a9124f..5385f15a680 100644 --- a/libs/common/src/platform/services/sdk/default-sdk.service.ts +++ b/libs/common/src/platform/services/sdk/default-sdk.service.ts @@ -232,8 +232,8 @@ export class DefaultSdkService implements SdkService { ), }); + // This is optional to avoid having to mock it on the server if (this.stateProvider) { - // Initialize the cipher store client .platform() .repository() @@ -245,15 +245,6 @@ export class DefaultSdkService implements SdkService { new CipherMapper(), ), ); - - try { - const result = await client.vault().print_the_ciphers(); - // eslint-disable-next-line no-console - console.log("Ciphers: " + result); - } catch (e) { - // eslint-disable-next-line no-console - console.error("Error printing ciphers: " + e); - } } }