]>
Commit | Line | Data |
---|---|---|
1 | import { Component, OnDestroy, OnInit } from '@angular/core' | |
2 | import { ActivatedRoute, Router } from '@angular/router' | |
3 | import { immutableAssign } from '@app/shared/misc/utils' | |
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' | |
11 | import { Notifier, ServerService } from '@app/core' | |
12 | import { HooksService } from '@app/core/plugins/hooks.service' | |
13 | import { UserService } from '@app/shared' | |
14 | import { LocalStorageService } from '@app/shared/misc/storage.service' | |
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 | |
23 | sort = '-publishedAt' as VideoSortField | |
24 | ownerDisplayType: OwnerDisplayType = 'auto' | |
25 | groupByDate = true | |
26 | ||
27 | constructor ( | |
28 | protected i18n: I18n, | |
29 | protected router: Router, | |
30 | protected serverService: ServerService, | |
31 | protected route: ActivatedRoute, | |
32 | protected notifier: Notifier, | |
33 | protected authService: AuthService, | |
34 | protected userService: UserService, | |
35 | protected screenService: ScreenService, | |
36 | protected storageService: LocalStorageService, | |
37 | private videoService: VideoService, | |
38 | private hooks: HooksService | |
39 | ) { | |
40 | super() | |
41 | ||
42 | this.titlePage = i18n('Videos from your subscriptions') | |
43 | this.actions.push({ | |
44 | routerLink: '/my-account/subscriptions', | |
45 | label: i18n('Subscriptions'), | |
46 | iconName: 'cog' | |
47 | }) | |
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 }) | |
60 | const params = { | |
61 | videoPagination: newPagination, | |
62 | sort: this.sort, | |
63 | skipCount: true | |
64 | } | |
65 | ||
66 | return this.hooks.wrapObsFun( | |
67 | this.videoService.getUserSubscriptionVideos.bind(this.videoService), | |
68 | params, | |
69 | 'common', | |
70 | 'filter:api.user-subscriptions-videos.videos.list.params', | |
71 | 'filter:api.user-subscriptions-videos.videos.list.result' | |
72 | ) | |
73 | } | |
74 | ||
75 | generateSyndicationList () { | |
76 | // not implemented yet | |
77 | } | |
78 | } |