From cb4f318419f7ad691c6925e98d9ab709aca47c8a Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Fri, 12 Feb 2021 10:38:55 -0600 Subject: [PATCH] [Send] Update jslib and Send component (#826) * changes made affected by jslib update * Update jslib (380b28d -> 0951424) --- jslib | 2 +- src/app/send/send.component.ts | 28 +++++++++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/jslib b/jslib index d376927e5e..0951424de7 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit d376927e5e583d816e78a26168f870ac78b071c0 +Subproject commit 0951424de77fbb61a38616d13d6c67f74ee19775 diff --git a/src/app/send/send.component.ts b/src/app/send/send.component.ts index 55d96aefea..ff4feb2f75 100644 --- a/src/app/send/send.component.ts +++ b/src/app/send/send.component.ts @@ -24,6 +24,8 @@ import { UserService } from 'jslib/abstractions/user.service'; import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; +const BroadcasterSubscriptionId = 'SendComponent'; + @Component({ selector: 'app-send', templateUrl: 'send.component.html', @@ -35,16 +37,32 @@ export class SendComponent extends BaseSendComponent { constructor(sendService: SendService, i18nService: I18nService, platformUtilsService: PlatformUtilsService, environmentService: EnvironmentService, - broadcasterService: BroadcasterService, ngZone: NgZone, searchService: SearchService, - policyService: PolicyService, userService: UserService, - private componentFactoryResolver: ComponentFactoryResolver) { - super(sendService, i18nService, platformUtilsService, environmentService, broadcasterService, ngZone, - searchService, policyService, userService); + ngZone: NgZone, searchService: SearchService, policyService: PolicyService, userService: UserService, + private componentFactoryResolver: ComponentFactoryResolver, private broadcasterService: BroadcasterService) { + super(sendService, i18nService, platformUtilsService, environmentService, ngZone, searchService, + policyService, userService); } async ngOnInit() { await super.ngOnInit(); await this.load(); + + // Broadcaster subscription - load if sync completes in the background + this.broadcasterService.subscribe(BroadcasterSubscriptionId, (message: any) => { + this.ngZone.run(async () => { + switch (message.command) { + case 'syncCompleted': + if (message.successfully) { + await this.load(); + } + break; + } + }); + }); + } + + ngOnDestroy() { + this.broadcasterService.unsubscribe(BroadcasterSubscriptionId); } addSend() {