use observeSize to emit update on memberCount rather than custom handler

This commit is contained in:
Bruno Windels 2023-01-26 11:56:30 +01:00
parent 725757e235
commit 59ebcf99fb

View File

@ -34,22 +34,9 @@ type MinimumNeededSegmentType = {
export class CallToastNotificationViewModel<N extends MinimumNeededSegmentType = SegmentType, O extends Options<N> = Options<N>> extends BaseToastNotificationViewModel<N, O> implements IAvatarContract {
constructor(options: O) {
super(options);
this.track(
this.call.members.subscribe({
onAdd: (_, __) => {
this.track(this.call.members.observeSize().subscribe(() => {
this.emitChange("memberCount");
},
onUpdate: (_, __) => {
this.emitChange("memberCount");
},
onRemove: (_, __) => {
this.emitChange("memberCount");
},
onReset: () => {
this.emitChange("memberCount");
},
})
);
}));
// Dismiss the toast if the room is opened manually
this.track(
this.navigation.observe("room").subscribe((roomId) => {