/**
 * Latest activities feed for discovery module.
 * Plugs into discovery feeds service.
 * Used in memberships tab and Minds+ latest tab
 */ import { Component , OnInit } from '@angular/core' ; import { Observable , BehaviorSubject } from 'rxjs' ; import { ActivatedRoute } from '@angular/router' ; import { FeedsService } from '../../../common/services/feeds.service' ; import { DiscoveryFeedsService } from '../feeds/feeds.service' ; @ Component ( { selector : 'm-discovery__latestFeed' , templateUrl : './latest.component.html' , providers : [ DiscoveryFeedsService , FeedsService ] , } ) export class DiscoveryLatestFeedComponent implements OnInit { constructor ( public route , private discoveryFeed ) { } async ngOnInit ( ) { await this . load ( ) ; } returns { Observable < BehaviorSubject < Object > [ ] > } public get feed$ ( ) : Observable < BehaviorSubject < Object > [ ] > { return this . discoveryFeed . entities$ ; } returns { Observable < boolean > } public get hasMore$ ( ) : Observable < boolean > { return this . discoveryFeed . hasMoreData$ ; } returns { Observable < boolean > } public get inProgress$ ( ) : Observable < boolean > { return this . discoveryFeed . inProgress$ ; } param { boolean } refresh return { Promise < boolean > } private async load ( refresh = false ) { try { this . discoveryFeed . setFilter ( 'latest' ) . setType ( 'all' ) . load ( ) ; return true ; } catch ( e ) { return false ; } } returns { Promise < void > } public async loadNext ( ) { this . discoveryFeed . loadMore ( ) ; } }