]>
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' |
d3217560 RK |
13 | import { UserService } from '@app/shared' |
14 | import { LocalStorageService } from '@app/shared/misc/storage.service' | |
22a16e36 C |
15 | |
16 | @Component({ | |
17 | selector: 'my-videos-user-subscriptions', | |
18 | styleUrls: [ '../../shared/video/abstract-video-list.scss' ], | |
19 | templateUrl: '../../shared/video/abstract-video-list.html' | |
20 | }) | |
21 | export class VideoUserSubscriptionsComponent extends AbstractVideoList implements OnInit, OnDestroy { | |
22 | titlePage: string | |
22a16e36 C |
23 | sort = '-publishedAt' as VideoSortField |
24 | ownerDisplayType: OwnerDisplayType = 'auto' | |
34c7f429 | 25 | groupByDate = true |
22a16e36 C |
26 | |
27 | constructor ( | |
34c7f429 | 28 | protected i18n: I18n, |
22a16e36 | 29 | protected router: Router, |
489290b8 | 30 | protected serverService: ServerService, |
22a16e36 | 31 | protected route: ActivatedRoute, |
f8b2c1b4 | 32 | protected notifier: Notifier, |
22a16e36 | 33 | protected authService: AuthService, |
d3217560 | 34 | protected userService: UserService, |
22a16e36 | 35 | protected screenService: ScreenService, |
d3217560 | 36 | protected storageService: LocalStorageService, |
93cae479 C |
37 | private videoService: VideoService, |
38 | private hooks: HooksService | |
22a16e36 C |
39 | ) { |
40 | super() | |
41 | ||
42 | this.titlePage = i18n('Videos from your subscriptions') | |
13adf228 RK |
43 | this.actions.push({ |
44 | routerLink: '/my-account/subscriptions', | |
45 | label: i18n('Subscriptions'), | |
46 | iconName: 'cog' | |
47 | }) | |
22a16e36 C |
48 | } |
49 | ||
50 | ngOnInit () { | |
51 | super.ngOnInit() | |
52 | } | |
53 | ||
54 | ngOnDestroy () { | |
55 | super.ngOnDestroy() | |
56 | } | |
57 | ||
58 | getVideosObservable (page: number) { | |
59 | const newPagination = immutableAssign(this.pagination, { currentPage: page }) | |
93cae479 C |
60 | const params = { |
61 | videoPagination: newPagination, | |
440d39c5 C |
62 | sort: this.sort, |
63 | skipCount: true | |
93cae479 | 64 | } |
22a16e36 | 65 | |
93cae479 C |
66 | return this.hooks.wrapObsFun( |
67 | this.videoService.getUserSubscriptionVideos.bind(this.videoService), | |
68 | params, | |
69 | 'common', | |
7663e55a C |
70 | 'filter:api.user-subscriptions-videos.videos.list.params', |
71 | 'filter:api.user-subscriptions-videos.videos.list.result' | |
93cae479 | 72 | ) |
22a16e36 C |
73 | } |
74 | ||
75 | generateSyndicationList () { | |
76 | // not implemented yet | |
77 | } | |
78 | } |