1 import { Component, OnDestroy, OnInit } from '@angular/core'
2 import { ActivatedRoute, Router } from '@angular/router'
3 import { immutableAssign } from '@app/shared/misc/utils'
4 import { AuthService } from '../../core/auth'
5 import { AbstractVideoList } from '../../shared/video/abstract-video-list'
6 import { VideoSortField } from '../../shared/video/sort-field.type'
7 import { VideoService } from '../../shared/video/video.service'
8 import { I18n } from '@ngx-translate/i18n-polyfill'
9 import { ScreenService } from '@app/shared/misc/screen.service'
10 import { Notifier, ServerService } from '@app/core'
11 import { HooksService } from '@app/core/plugins/hooks.service'
14 selector: 'my-videos-recently-added',
15 styleUrls: [ '../../shared/video/abstract-video-list.scss' ],
16 templateUrl: '../../shared/video/abstract-video-list.html'
18 export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy {
20 sort: VideoSortField = '-publishedAt'
23 useUserVideoLanguagePreferences = true
27 protected route: ActivatedRoute,
28 protected serverService: ServerService,
29 protected router: Router,
30 protected notifier: Notifier,
31 protected authService: AuthService,
32 protected screenService: ScreenService,
33 private videoService: VideoService,
34 private hooks: HooksService
38 this.titlePage = i18n('Recently added')
44 this.generateSyndicationList()
51 getVideosObservable (page: number) {
52 const newPagination = immutableAssign(this.pagination, { currentPage: page })
54 videoPagination: newPagination,
56 categoryOneOf: this.categoryOneOf,
57 languageOneOf: this.languageOneOf
60 return this.hooks.wrapObsFun(
61 this.videoService.getVideos.bind(this.videoService),
64 'filter:api.recently-added-videos.videos.list.params',
65 'filter:api.recently-added-videos.videos.list.result'
69 generateSyndicationList () {
70 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf)