added stream update on settings changes

This commit is contained in:
Nicolas Constant 2019-06-23 23:11:16 -04:00
parent b5f063b158
commit dcb929eac3
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
1 changed files with 24 additions and 15 deletions

View File

@ -49,6 +49,8 @@ export class StreamStatusesComponent implements OnInit, OnDestroy {
@Input() userLocked = true; @Input() userLocked = true;
private goToTopSubscription: Subscription; private goToTopSubscription: Subscription;
private streamsSubscription: Subscription;
private streams$: Observable<StreamElement[]>;
constructor( constructor(
private readonly store: Store, private readonly store: Store,
@ -56,16 +58,23 @@ export class StreamStatusesComponent implements OnInit, OnDestroy {
private readonly notificationService: NotificationService, private readonly notificationService: NotificationService,
private readonly streamingService: StreamingService, private readonly streamingService: StreamingService,
private readonly mastodonService: MastodonService) { private readonly mastodonService: MastodonService) {
this.streams$ = this.store.select(state => state.streamsstatemodel.streams);
} }
ngOnInit() { ngOnInit() {
this.goToTopSubscription = this.goToTop.subscribe(() => { this.goToTopSubscription = this.goToTop.subscribe(() => {
this.applyGoToTop(); this.applyGoToTop();
}); });
this.streamsSubscription = this.streams$.subscribe((streams: StreamElement[]) => {
this.streamElement = streams.find(x => x.id === this.streamElement.id);
});
} }
ngOnDestroy() { ngOnDestroy() {
if (this.goToTopSubscription) this.goToTopSubscription.unsubscribe(); if (this.goToTopSubscription) this.goToTopSubscription.unsubscribe();
if (this.streamsSubscription) this.streamsSubscription.unsubscribe();
} }
refresh(): any { refresh(): any {