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 { AbstractVideoList } from '@app/shared/shared-video-miniature'
8 import { I18n } from '@ngx-translate/i18n-polyfill'
9 import { VideoSortField } from '@shared/models'
12 selector: 'my-videos-recently-added',
13 styleUrls: [ '../../shared/shared-video-miniature/abstract-video-list.scss' ],
14 templateUrl: '../../shared/shared-video-miniature/abstract-video-list.html'
16 export class VideoRecentlyAddedComponent extends AbstractVideoList implements OnInit, OnDestroy {
18 sort: VideoSortField = '-publishedAt'
21 useUserVideoPreferences = true
25 protected route: ActivatedRoute,
26 protected serverService: ServerService,
27 protected router: Router,
28 protected notifier: Notifier,
29 protected authService: AuthService,
30 protected userService: UserService,
31 protected screenService: ScreenService,
32 protected storageService: LocalStorageService,
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,
58 nsfwPolicy: this.nsfwPolicy,
62 return this.hooks.wrapObsFun(
63 this.videoService.getVideos.bind(this.videoService),
66 'filter:api.recently-added-videos.videos.list.params',
67 'filter:api.recently-added-videos.videos.list.result'
71 generateSyndicationList () {
72 this.syndicationItems = this.videoService.getVideoFeedUrls(this.sort, undefined, this.categoryOneOf)