- private authService: AuthService,
- private videoPlaylistService: VideoPlaylistService,
- private cd: ChangeDetectorRef
- ) {}
-
- load () {
- if (this.addedToWatchLater !== undefined) return
- if (!this.isUserLoggedIn()) return
-
- this.videoPlaylistService.doesVideoExistInPlaylist(this.video.id)
- .subscribe(
- existResult => {
- for (const playlist of this.authService.getUser().specialPlaylists) {
- const existingPlaylist = existResult[ this.video.id ].find(p => p.playlistId === playlist.id)
- this.addedToWatchLater = !!existingPlaylist
-
- if (existingPlaylist) {
- this.watchLaterPlaylist = {
- playlistId: existingPlaylist.playlistId,
- playlistElementId: existingPlaylist.playlistElementId
- }
- } else {
- this.watchLaterPlaylist = {
- playlistId: playlist.id
- }
- }
-
- this.cd.markForCheck()
- }
- }
- )
+ private i18n: I18n
+ ) {
+ this.addToWatchLaterText = this.i18n('Add to watch later')
+ this.addedToWatchLaterText = this.i18n('Remove from watch later')