1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core'
4 import { HooksService } from '@app/core/plugins/hooks.service'
5 import { immutableAssign } from '@app/helpers'
6 import { VideoService } from '@app/shared/shared-main'
7 import { UserSubscriptionService } from '@app/shared/shared-user-subscription'
8 import { AbstractVideoList, OwnerDisplayType } from '@app/shared/shared-video-miniature'
9 import { I18n } from '@ngx-translate/i18n-polyfill'
10 import { VideoSortField } from '@shared/models'
13 selector: 'my-videos-user-subscriptions',
14 styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ],
15 templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html'
17 export class VideoUserSubscriptionsComponent extends AbstractVideoList implements OnInit, OnDestroy {
19 sort = '-publishedAt' as VideoSortField
20 ownerDisplayType: OwnerDisplayType = 'auto'
25 protected router: Router,
26 protected serverService: ServerService,
27 protected route: ActivatedRoute,
28 protected notifier: Notifier,
29 protected authService: AuthService,
30 protected userService: UserService,
31 protected screenService: ScreenService,
32 protected storageService: LocalStorageService,
33 private userSubscription: UserSubscriptionService,
34 private videoService: VideoService,
35 private hooks: HooksService
39 this.titlePage = i18n('Videos from your subscriptions')
41 routerLink: '/my-account/subscriptions',
42 label: i18n('Subscriptions'),
55 getVideosObservable (page: number) {
56 const newPagination = immutableAssign(this.pagination, { currentPage: page })
58 videoPagination: newPagination,
63 return this.hooks.wrapObsFun(
64 this.userSubscription.getUserSubscriptionVideos.bind(this.userSubscription),
67 'filter:api.user-subscriptions-videos.videos.list.params',
68 'filter:api.user-subscriptions-videos.videos.list.result'
72 generateSyndicationList () {
73 // not implemented yet