From eb4eb6021e4ec03ee9a3aea977db13472e3c9242 Mon Sep 17 00:00:00 2001 From: 4gray Date: Sun, 10 Dec 2023 13:03:00 +0100 Subject: [PATCH] fix(portals): fix favorite button behavior in vod-details view this commit closes #327 --- src/app/xtream/detail-view.scss | 1 + .../vod-details/vod-details.component.ts | 22 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/app/xtream/detail-view.scss b/src/app/xtream/detail-view.scss index 6a9acc43e..63835fa12 100644 --- a/src/app/xtream/detail-view.scss +++ b/src/app/xtream/detail-view.scss @@ -29,6 +29,7 @@ width: 300px; height: 500px; background-color: #999; + border-radius: 5px; &::after { content: 'No cover'; diff --git a/src/app/xtream/vod-details/vod-details.component.ts b/src/app/xtream/vod-details/vod-details.component.ts index c38cd8380..25e4adf36 100644 --- a/src/app/xtream/vod-details/vod-details.component.ts +++ b/src/app/xtream/vod-details/vod-details.component.ts @@ -42,11 +42,21 @@ export class VodDetailsComponent implements OnInit { this.playlistService .getPortalFavorites(this.portalId) .subscribe((favorites) => { - this.isFavorite = favorites.some( - (i) => - i?.stream_id === this.item?.movie_data?.stream_id || - (i as any)?.details?.id === (this.item as any)?.id - ); + this.isFavorite = favorites.some((i) => { + const hasStreamId = + i?.stream_id !== undefined && + this.item?.movie_data?.stream_id !== undefined; + const hasId = + (i as any)?.details?.id !== undefined && + (this.item as any)?.id !== undefined; + + return ( + (hasStreamId && + i.stream_id === this.item.movie_data.stream_id) || + (hasId && + (i as any).details.id === (this.item as any).id) + ); + }); }); } @@ -67,7 +77,7 @@ export class VodDetailsComponent implements OnInit { }); } else { this.addToFavoritesClicked.emit({ - name: this.item.info.name, + name: this.item.movie_data.name, stream_id: this.item.movie_data.stream_id, container_extension: this.item.movie_data.container_extension,