...
 
Commits (2)
......@@ -68,7 +68,7 @@
*ngIf="(!group['is:creator'] || (session.isAdmin()) && !group['is:invited'])"
>
</minds-groups-join-button>
<button class="m-btn m-btn--slim m-btn--with-icon" [class.m-pulsating--small]="group.hasGathering" style="margin-left: 8;" (click)="videochat.activate(group)" *ngIf="!group.videoChatDisabled">
<button class="m-btn m-btn--slim m-btn--with-icon" [class.m-pulsating--small]="group.hasGathering$ | async" style="margin-left: 8;" (click)="videochat.activate(group)" *ngIf="!group.videoChatDisabled">
<span class="m-gatheringIcon">Gathering</span>
<i class="material-icons">video_call</i>
</button>
......
import { Component, ViewChild, ChangeDetectorRef, HostListener, Input } from '@angular/core';
import { ActivatedRoute, ChildActivationEnd, NavigationEnd, Router } from '@angular/router';
import { ChangeDetectorRef, Component, HostListener, ViewChild } from '@angular/core';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import { Subscription } from 'rxjs';
import { interval, Subscription } from 'rxjs';
import { GroupsService } from '../groups-service';
......@@ -16,7 +16,7 @@ import { Client } from '../../../services/api';
import { HashtagsSelectorComponent } from '../../hashtags/selector/selector.component';
import { VideoChatService } from '../../videochat/videochat.service';
import { UpdateMarkersService } from '../../../common/services/update-markers.service';
import { filter } from "rxjs/operators";
import { filter, map, startWith, throttle } from "rxjs/operators";
@Component({
selector: 'm-groups--profile',
......@@ -181,12 +181,18 @@ export class GroupsProfile {
this.updateMarkersSubscription.unsubscribe();
this.updateMarkersSubscription = this.updateMarkers.getByEntityGuid(this.guid).subscribe((marker => {
// this.updateMarkersSubscription = this.updateMarkers.markers.subscribe(markers => {
if (!marker)
return;
this.group.hasGathering = marker && marker.entity_guid == this.group.guid
&& marker.marker == 'gathering-heartbeat'
&& marker.updated_timestamp > (Date.now() / 1000) - 60;
this.group.hasGathering$ = interval(1000).pipe(
throttle(() => interval(2000)), //only allow once per 2 seconds
startWith(0),
map(() => [marker].filter(marker => marker.entity_guid == this.group.guid
&& marker.marker == 'gathering-heartbeat'
&& marker.updated_timestamp > (Date.now() / 1000) - 60 //1 minute tollerance
).length > 0)
);
let hasMarker =
(marker.read_timestamp < marker.updated_timestamp)
......