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