]>
Commit | Line | Data |
---|---|---|
22a16e36 C |
1 | import { Component, OnDestroy, OnInit } from '@angular/core' |
2 | import { ActivatedRoute, Router } from '@angular/router' | |
3 | import { immutableAssign } from '@app/shared/misc/utils' | |
22a16e36 C |
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 { OwnerDisplayType } from '@app/shared/video/video-miniature.component' | |
489290b8 | 11 | import { Notifier, ServerService } from '@app/core' |
93cae479 | 12 | import { HooksService } from '@app/core/plugins/hooks.service' |
22a16e36 C |
13 | |
14 | @Component({ | |
15 | selector: 'my-videos-user-subscriptions', | |
16 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], | |
17 | templateUrl: '../../shared/video/abstract-video-list.html' | |
18 | }) | |
19 | export class VideoUserSubscriptionsComponent extends AbstractVideoList implements OnInit, OnDestroy { | |
20 | titlePage: string | |
22a16e36 C |
21 | sort = '-publishedAt' as VideoSortField |
22 | ownerDisplayType: OwnerDisplayType = 'auto' | |
34c7f429 | 23 | groupByDate = true |
22a16e36 C |
24 | |
25 | constructor ( | |
34c7f429 | 26 | protected i18n: I18n, |
22a16e36 | 27 | protected router: Router, |
489290b8 | 28 | protected serverService: ServerService, |
22a16e36 | 29 | protected route: ActivatedRoute, |
f8b2c1b4 | 30 | protected notifier: Notifier, |
22a16e36 | 31 | protected authService: AuthService, |
22a16e36 | 32 | protected screenService: ScreenService, |
93cae479 C |
33 | private videoService: VideoService, |
34 | private hooks: HooksService | |
22a16e36 C |
35 | ) { |
36 | super() | |
37 | ||
38 | this.titlePage = i18n('Videos from your subscriptions') | |
39 | } | |
40 | ||
41 | ngOnInit () { | |
42 | super.ngOnInit() | |
43 | } | |
44 | ||
45 | ngOnDestroy () { | |
46 | super.ngOnDestroy() | |
47 | } | |
48 | ||
49 | getVideosObservable (page: number) { | |
50 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | |
93cae479 C |
51 | const params = { |
52 | videoPagination: newPagination, | |
53 | sort: this.sort | |
54 | } | |
22a16e36 | 55 | |
93cae479 C |
56 | return this.hooks.wrapObsFun( |
57 | this.videoService.getUserSubscriptionVideos.bind(this.videoService), | |
58 | params, | |
59 | 'common', | |
60 | 'filter:api.videos.list.user-subscriptions.params', | |
61 | 'filter:api.videos.list.user-subscriptions.result' | |
62 | ) | |
22a16e36 C |
63 | } |
64 | ||
65 | generateSyndicationList () { | |
66 | // not implemented yet | |
67 | } | |
68 | } |