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