mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
[PM-5574] sends state provider (#8373)
* Adding the key definitions and tests and initial send state service * Adding the abstraction and implementing * Planning comments * Everything but fixing the send tests * Moving send tests over to the state provider * jslib needed name refactor * removing get/set encrypted sends from web vault state service * browser send state service factory * Fixing conflicts * Removing send service from services module and fixing send service observable * Commenting the migrator to be clear on why only encrypted * No need for service factories in browser * browser send service is no longer needed * Key def test cases to use toStrictEqual * Running prettier * Creating send test data to avoid code duplication * Adding state provider and account service to send in cli * Fixing the send service test cases * Fixing state definition keys * Moving to observables and implementing encryption service * Fixing key def tests * The cli was using the deprecated get method * The observables init doesn't need to happen in constructor * Missed commented out code * If enc key is null get user key * Service factory fix
This commit is contained in:
@@ -191,6 +191,8 @@ import {
|
||||
} from "@bitwarden/common/tools/password-strength";
|
||||
import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service";
|
||||
import { SendApiService as SendApiServiceAbstraction } from "@bitwarden/common/tools/send/services/send-api.service.abstraction";
|
||||
import { SendStateProvider as SendStateProvider } from "@bitwarden/common/tools/send/services/send-state.provider";
|
||||
import { SendStateProvider as SendStateProviderAbstraction } from "@bitwarden/common/tools/send/services/send-state.provider.abstraction";
|
||||
import { SendService } from "@bitwarden/common/tools/send/services/send.service";
|
||||
import {
|
||||
InternalSendService,
|
||||
@@ -567,9 +569,15 @@ const safeProviders: SafeProvider[] = [
|
||||
CryptoServiceAbstraction,
|
||||
I18nServiceAbstraction,
|
||||
KeyGenerationServiceAbstraction,
|
||||
StateServiceAbstraction,
|
||||
SendStateProviderAbstraction,
|
||||
EncryptService,
|
||||
],
|
||||
}),
|
||||
safeProvider({
|
||||
provide: SendStateProviderAbstraction,
|
||||
useClass: SendStateProvider,
|
||||
deps: [StateProvider],
|
||||
}),
|
||||
safeProvider({
|
||||
provide: SendApiServiceAbstraction,
|
||||
useClass: SendApiService,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Directive, NgZone, OnDestroy, OnInit } from "@angular/core";
|
||||
import { Subject, firstValueFrom, takeUntil } from "rxjs";
|
||||
import { Subject, firstValueFrom, mergeMap, takeUntil } from "rxjs";
|
||||
|
||||
import { SearchService } from "@bitwarden/common/abstractions/search.service";
|
||||
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
||||
@@ -77,9 +77,15 @@ export class SendComponent implements OnInit, OnDestroy {
|
||||
|
||||
async load(filter: (send: SendView) => boolean = null) {
|
||||
this.loading = true;
|
||||
this.sendService.sendViews$.pipe(takeUntil(this.destroy$)).subscribe((sends) => {
|
||||
this.sends = sends;
|
||||
});
|
||||
this.sendService.sendViews$
|
||||
.pipe(
|
||||
mergeMap(async (sends) => {
|
||||
this.sends = sends;
|
||||
await this.search(null);
|
||||
}),
|
||||
takeUntil(this.destroy$),
|
||||
)
|
||||
.subscribe();
|
||||
if (this.onSuccessfulLoad != null) {
|
||||
await this.onSuccessfulLoad();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user